프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM / Services / BaseServices.cs @ 7841e9fb

이력 | 보기 | 이력해설 | 다운로드 (44.2 KB)

1 787a4489 KangIngu
using Microsoft.AspNet.SignalR.Client;
2
using IKCOM;
3
using KCOM.Common;
4
using KCOM.ServiceDeepView;
5
using KCOMDataModel.DataModel;
6
using Newtonsoft.Json;
7
using RestSharp;
8
using System;
9
using System.Collections.Generic;
10
using System.Collections.ObjectModel;
11
using System.ComponentModel;
12
using System.Linq;
13
using System.Runtime.CompilerServices;
14
using System.Text;
15
using System.Windows;
16
using System.Windows.Controls;
17
using Telerik.Windows.Controls;
18 036650a0 humkyung
using MarkupToPDF.Controls.Parsing;
19 fddb48f7 ljiyeon
using Telerik.Windows.Data;
20 90a0bfa9 djkim
using System.Web;
21 787a4489 KangIngu
22
namespace KCOM.Views
23
{
24
    public partial class MainMenu : UserControl, INotifyPropertyChanged
25 29010418 ljiyeon
    {
26 eb5cdefc djkim
        //const string DeepZoomUrl = @"http://{baseUrl}/TileSource/{TileSourcePath}/{ItemsPath}/{SharepointItemID}/{PageNo}.jpg";
27 787a4489 KangIngu
        public ServiceDeepViewClient BaseClient;
28 6b6e937c taeseongkim
        public KcomService.ServiceDeepViewClient BaseTaskClient;
29 787a4489 KangIngu
        public ViewInfo _ViewInfo;
30
        public DOCINFO _DocInfo;
31
        public DOCUMENT_ITEM _DocItem;
32
        public MEMBER userData;
33
34
        public event PropertyChangedEventHandler PropertyChanged;
35
        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
36
        {
37
            if (PropertyChanged != null)
38
            {
39
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
40
            }
41
        }
42
43
        private Common.DocumentSet _CurrentDoc { get; set; }
44
        public Common.DocumentSet CurrentDoc
45
        {
46
            get
47
            {
48
                return _CurrentDoc;
49
            }
50
            set
51
            {
52
                if (value != CurrentDoc)
53
                {
54
                    _CurrentDoc = value;
55
                    NotifyPropertyChanged();
56
                }
57
            }
58
        }
59
        public void ServiceOn()
60
        {
61 6b6e937c taeseongkim
            BaseTaskClient = new KcomService.ServiceDeepViewClient(App._binding, App._EndPoint);
62 29010418 ljiyeon
            BaseClient = new ServiceDeepViewClient(App._binding, App._EndPoint);
63
64 787a4489 KangIngu
            BaseClient.GetDocInfoCompleted += BaseClient_GetDocInfoCompleted; //문서 섬네일, 페이지크기, 마크업 정보 [3]
65 0f065e57 ljiyeon
            BaseClient.GetConversionStateCompleted += BaseClient_GetConversionStateCompleted;  //컨버팅의 여부 [2] 
66
            BaseClient.GetSystemDataCompleted += BaseClient_GetSystemDataCompleted; //시스템 정보 [1] 
67 787a4489 KangIngu
            BaseClient.GetDocumentItemInfoCompleted += BaseClient_GetDocumentItemInfoCompleted; // 문서 자체의 정보 [4]
68 29010418 ljiyeon
            BaseClient.GetMarkupInfoItemsCompleted += BaseClient_GetMarkupInfoItemsCompleted;
69
            BaseClient.GetDeptDataCompleted += BaseClient_GetDeptDataCompleted;
70
            BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted;
71 787a4489 KangIngu
            BaseClient.GetVPRevisionHistoryCompleted += BaseClient_GetVPRevisionHistoryCompleted;
72 29010418 ljiyeon
            BaseClient.SetFinalPDFCompleted += BaseClient_SetFinalPDFCompleted;
73
            BaseClient.GetCompareRectCompleted += BaseClient_GetCompareRectCompleted;
74
            BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted;
75
            BaseClient.DelFavoriteVPCompleted += BaseClient_DelFavoriteVPCompleted;
76
            BaseClient.EditFavoriteVPCompleted += BaseClient_EditFavoriteVPCompleted;
77 992a98b4 KangIngu
        }
78
79 29010418 ljiyeon
80 992a98b4 KangIngu
81
        private void BaseClient_EditFavoriteVPCompleted(object sender, EditFavoriteVPCompletedEventArgs e)
82
        {
83 0f065e57 ljiyeon
            Logger.sendResLog("EditFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
84
            
85 53880c83 ljiyeon
            if (e.Error == null && e.Result != false)
86 992a98b4 KangIngu
            {
87 0f065e57 ljiyeon
                Logger.sendReqLog("GetFavoriteVPAsync", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1);
88 992a98b4 KangIngu
                BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID);
89
            }
90
            else
91
            {
92
                DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning");
93
            }
94
        }
95
96
        private void BaseClient_DelFavoriteVPCompleted(object sender, DelFavoriteVPCompletedEventArgs e)
97
        {
98 0f065e57 ljiyeon
            Logger.sendResLog("DelFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
99
100 53880c83 ljiyeon
            if (e.Error == null && e.Result != false)
101 992a98b4 KangIngu
            {
102 0f065e57 ljiyeon
                Logger.sendReqLog("GetFavoriteVPAsync", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1);
103 992a98b4 KangIngu
                BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID);
104
            }
105
            else
106
            {
107
                DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning");
108
            }
109 787a4489 KangIngu
        }
110
111 9294fed6 humkyung
        /// <summary>
112
        /// Compare 결과를 받아 화면에 표시한다
113
        /// </summary>
114
        /// <param name="sender"></param>
115
        /// <param name="e"></param>
116 787a4489 KangIngu
        private void BaseClient_GetCompareRectCompleted(object sender, GetCompareRectCompletedEventArgs e)
117
        {
118
            if (e.Error != null || e.Result == null)
119
            {
120 9294fed6 humkyung
                if (e.Error != null)
121
                {
122
                    DialogMessage_Alert(e.Error.ToString(), "Error");
123
                }
124
                else
125
                {
126
                    DialogMessage_Alert("Compare 기능을 원활히 실행하기 위한 데이터가 부족합니다", "안내");
127
                }
128 787a4489 KangIngu
            }
129
            else
130
            {
131
                e.Result.ForEach(d =>
132
                {
133
                    d.Width = d.Width * 3;
134
                    d.Height = d.Height * 3;
135
                    var point = MarkupToPDF.Controls.Common.MathSet.getRectMiddlePoint(d);
136 a1142a6b taeseongkim
                    System.Windows.Shapes.Rectangle myEllipse = new System.Windows.Shapes.Rectangle();
137
                    myEllipse.Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(100,255,8,0));
138
                    myEllipse.Opacity = 0.8;
139 787a4489 KangIngu
                    myEllipse.Width = d.Width;
140
                    myEllipse.Height = d.Height;
141
                    Canvas.SetLeft(myEllipse, d.X - ((point.X - d.X) / 2.0));
142
                    Canvas.SetTop(myEllipse, d.Y - ((point.Y - d.Y) / 2.0));
143
                    myEllipse.RenderTransformOrigin = point;
144
                    canvas_compareBorder.Children.Add(myEllipse);
145
                });
146
147
                da.From = 0.8;
148 a1142a6b taeseongkim
                da.To = 0.1;
149 787a4489 KangIngu
                da.Duration = new Duration(TimeSpan.FromSeconds(1));
150
                da.AutoReverse = true;
151
                canvas_compareBorder.BeginAnimation(OpacityProperty, da);
152
            }
153
        }
154
155
        private void BaseClient_SetFinalPDFCompleted(object sender, SetFinalPDFCompletedEventArgs e)
156
        {
157 0f065e57 ljiyeon
            Logger.sendResLog("SetFinalPDFCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
158 84c48033 djkim
            string errormsg = CommonLib.Common.GetAlertMessageString("SetFinalPDFError", "MSG", "최종 파일을 만드는데 문제가 발생하였습니다");
159
            string successmsg = CommonLib.Common.GetAlertMessageString("SetFinalPDFSuccess", "MSG", "최종 파일 생성 중입니다. 문서관리시스템을 확인해주세요");
160 29010418 ljiyeon
            if (e.Error != null || e.Result.Status == FinalStatus.Error)
161 787a4489 KangIngu
            {
162 84c48033 djkim
                DialogMessage_Alert(errormsg, "안내");
163 787a4489 KangIngu
            }
164
            else
165
            {
166 84c48033 djkim
                DialogMessage_Alert(successmsg, "안내");
167 787a4489 KangIngu
            }
168
        }
169
170
        private void BaseClient_GetVPRevisionHistoryCompleted(object sender, GetVPRevisionHistoryCompletedEventArgs e)
171
        {
172 0f065e57 ljiyeon
            Logger.sendResLog("GetVPRevisionHistoryCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
173
174 787a4489 KangIngu
            if (e.Result != null && e.Error == null)
175
            {
176 90a0bfa9 djkim
                List<VPRevision> list = e.Result;
177
                foreach (var item in list)
178
                {
179 24ac2a04 taeseongkim
180
                    if (App.isExternal)
181
                    {
182 f35c95d8 taeseongkim
                        var sBaseServiceURL = CommonLib.Common.GetConfigString("ExternalOriginalFileUrl", "URL", "", App.isExternal);
183 24ac2a04 taeseongkim
184 db545833 taeseongkim
                        if (!string.IsNullOrWhiteSpace(item.TO_VENDOR))
185
                        {
186
                            var toUri = new Uri(HttpUtility.UrlDecode(item.TO_VENDOR));
187
                            item.TO_VENDOR = $"{sBaseServiceURL}{toUri.LocalPath}";
188
                        }
189
190
                        if (!string.IsNullOrWhiteSpace(item.FROM_VENDOR))
191
                        {
192
                            var fromUri = new Uri(HttpUtility.UrlDecode(item.FROM_VENDOR));
193
                            item.FROM_VENDOR = $"{sBaseServiceURL}{fromUri.LocalPath}";
194
                        }
195 24ac2a04 taeseongkim
                    }
196
                    else
197
                    {
198
199
                        item.FROM_VENDOR = HttpUtility.UrlDecode(item.FROM_VENDOR);
200
                    }
201 90a0bfa9 djkim
                }
202
                gridViewHistory.ItemsSource = list;
203 787a4489 KangIngu
            }
204 f9fb5500 ljiyeon
            //TempFile.TempLoad();
205 787a4489 KangIngu
        }
206
207
        private void BaseClient_DeleteMarkupCompleted(object sender, DeleteMarkupCompletedEventArgs e)
208
        {
209 0f065e57 ljiyeon
            Logger.sendResLog("DeleteMarkupCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
210
211 d128ceb2 humkyung
            foreach(var info in ViewerDataModel.Instance._markupInfoList)
212
            {
213
                if(info.UserID == App.ViewInfo.UserID)
214
                {
215
                    info.userDelete = true;
216
                    info.DisplayColor = "FFFF0000";
217
                }
218
                else
219
                {
220
                    info.userDelete = false;
221
                }
222
            }
223 787a4489 KangIngu
        }
224
225
        private void BaseClient_GetDeptDataCompleted(object sender, GetDeptDataCompletedEventArgs e)
226
        {
227 0f065e57 ljiyeon
            Logger.sendResLog("GetDeptDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
228
229 787a4489 KangIngu
            if (e.Result != null)
230
            {
231
                e.Result.Sort();
232
                //cbSymbolPublic.ItemsSource = e.Result.ToList();
233
            }
234
        }
235 29010418 ljiyeon
        public MarkupInfoItem PreviewUserMarkupInfoItem { get; set; }
236 787a4489 KangIngu
237 35a96e24 humkyung
        /// <summary>
238 d62c0439 humkyung
        /// 문서 정보를 가져온다
239
        /// </summary>
240
        /// <param name="sender"></param>
241
        /// <param name="e"></param>
242 eeb0a39c taeseongkim
        private async void BaseClient_GetDocInfoCompleted(object sender, GetDocInfoCompletedEventArgs e)
243 d62c0439 humkyung
        {
244 72424099 taeseongkim
            //Logger.sendResLog("GetDocInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
245 d62c0439 humkyung
246
            if (e.Error != null)
247
            {
248 503cb09e taeseongkim
                DialogMessage_Alert("The page cannot be displayed.", "Alert");
249 d62c0439 humkyung
                return;
250
            }
251
252 ff01c725 humkyung
            string sFolder = _ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToUInt32(_ViewInfo.DocumentItemID) / 100).ToString() : (_ViewInfo.DocumentItemID.Length >= 5 ? _ViewInfo.DocumentItemID.Substring(0, 5) : _ViewInfo.DocumentItemID);
253
            var MainUrl = string.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal).Replace("png","jpg"), _ViewInfo.ProjectNO, sFolder, _ViewInfo.DocumentItemID, "{PageNo}");
254 d62c0439 humkyung
            _DocInfo = e.Result;
255 90a0bfa9 djkim
            _DocInfo.ORIGINAL_FILE = HttpUtility.UrlDecode(_DocInfo.ORIGINAL_FILE);
256 d62c0439 humkyung
            foreach (var item in _DocInfo.DOCPAGE.OrderBy(order => order.PAGE_NUMBER))
257
            {
258
                ViewerDataModel.Instance.Document_Info.Add(item);
259
            }
260
            Logger.sendReqLog("GetMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
261
            BaseClient.GetMarkupInfoItemsAsync(_ViewInfo.ProjectNO, _DocInfo.ID);
262
            CurrentDoc = new Common.DocumentSet
263
            {
264
                docInfo = _DocInfo,
265
                Document_Id = _DocInfo.DOCUMENT_ID,
266
                Document_NO = _DocItem.DOCUMENT_NO,
267
                File_Original = _DocInfo.ORIGINAL_FILE,
268
                File_Result = _DocItem.RESULT_FILE,
269
                Group_No = _DocItem.GROUP_NO,
270
                ProjectNo = _DocItem.PROJECT_NO,
271
                Revision = _DocItem.REVISION,
272
            };
273
            var instanceMain = this.ParentOfType<MainWindow>();
274 944be2fa djkim
            string firstpage = "1";
275
            string lastpage = _DocInfo.PAGE_COUNT.ToString();
276
            instanceMain.dzTopMenu.tlcurrentPage.Text = firstpage;
277
            instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = lastpage;
278 d62c0439 humkyung
            string apptitle = string.Format("MARKUS(ver.{2}) - {0}(Rev.{1})", _DocItem.DOCUMENT_NO, _DocItem.REVISION, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
279
            instanceMain.TitleText.Text = apptitle;
280
            instanceMain.Title = apptitle;
281 eeb0a39c taeseongkim
282
            #region 페이지 이미지를 로컬에 저장
283
            string tempStoragePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(),"MARKUS", System.IO.Path.GetRandomFileName());
284
285
            //.Replace("jpg", "png")을 붙이는 이유는 MainUrl에 확장명이 jpg로 설정한 경우가 있기 때문
286
287
            #endregion
288
            App.PageStorage = new PageManager.PageStorage(MainUrl.Replace("jpg", "png"), tempStoragePath, _DocInfo.PAGE_COUNT);
289
290 d62c0439 humkyung
            this.pageNavigator.SetPageNavi(CurrentDoc.docInfo.DOCPAGE.ToList(), MainUrl);
291
292
            ViewerDataModel.Instance.MarkupControls_USER.Clear();
293
294
            //ViewerDataModel.Instance.SystemMain.dzMainMenu.TempLoad();
295
296 6af42ff0 taeseongkim
            #region 단어 검색용 파일 다운로드
297
298 eeb0a39c taeseongkim
            await DownloadOriginalFileAsync();
299
        
300 6af42ff0 taeseongkim
301
            #endregion
302
303 d62c0439 humkyung
            Logger.sendReqLog("GetVPRevisionHistoryAsync", CurrentDoc.ProjectNo + "," + CurrentDoc.Document_NO + "," + CurrentDoc.Document_Id, 1);
304 6af42ff0 taeseongkim
            BaseClient.GetVPRevisionHistoryAsync(CurrentDoc.ProjectNo, CurrentDoc.Document_NO, CurrentDoc.Document_Id);
305
306 d62c0439 humkyung
        }
307
308
        /// <summary>
309 35a96e24 humkyung
        /// get markupinfo and markupitem from database
310 a36a37c3 humkyung
        ///  - 1. called when document is loaded
311
        ///  - 2. called when user do consolidation
312 35a96e24 humkyung
        /// </summary>
313
        /// <param name="sender"></param>
314
        /// <param name="e"></param>
315 787a4489 KangIngu
        private void BaseClient_GetMarkupInfoItemsCompleted(object sender, GetMarkupInfoItemsCompletedEventArgs e)
316
        {
317 0f065e57 ljiyeon
            Logger.sendResLog("GetMarkupInfoItemsCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
318
319 787a4489 KangIngu
            ViewerDataModel.Instance.MarkupControls_USER.Clear();
320
            ViewerDataModel.Instance.MarkupControls.Clear();
321
            if (e.Result != null)
322
            {
323 d128ceb2 humkyung
                ViewerDataModel.Instance._markupInfoList.Clear();
324 3ffd4b2d humkyung
                if (e.Result.Count > 0) ViewerDataModel.Instance.MyMarkupList.Clear();
325 787a4489 KangIngu
326 d128ceb2 humkyung
                foreach(var info in e.Result)
327
                {
328
                    if (info.UserID == App.ViewInfo.UserID)
329
                    {
330
                        info.userDelete = true;
331
                        info.DisplayColor = "#FFFF0000";
332
                    }
333
                    else
334
                    {
335
                        info.userDelete = false;
336
                    }
337
                    ViewerDataModel.Instance._markupInfoList.Add(info);
338
                }
339
340 8e5a4a6a taeseongkim
                var userInfoList = ViewerDataModel.Instance._markupInfoList.GroupBy(f => f.UserID).Select(f=>new MarkupUserInfo { UserId = f.Key, UserName = f.First().UserName });
341
342
                userInfoList.ToList().ForEach(x => ViewerDataModel.Instance._markupUserList.Add(x));
343
344 a36a37c3 humkyung
                e.Result.ToList().ForEach(d => d.MarkupList.ForEach(p =>
345 787a4489 KangIngu
                {
346 29010418 ljiyeon
                    if (d.UserID == App.ViewInfo.UserID)
347 787a4489 KangIngu
                    {
348
                        d.userDelete = true;
349
                        d.DisplayColor = "#FFFF0000";
350
351 35a96e24 humkyung
                        MarkupItemEx markup = new MarkupItemEx
352 787a4489 KangIngu
                        {
353
                            Data = p.Data,
354
                            Data_Type = p.Data_Type,
355
                            ID = p.ID,
356
                            IsUpdate = false,
357
                            MarkupInfoID = d.MarkupInfoID,
358
                            PageNumber = p.PageNumber,
359 c8e9b3e4 ljiyeon
                            Symbol_ID = p.Symbol_ID,
360 c0977e97 djkim
                            //Group_ID = p.Group_ID
361 35a96e24 humkyung
                        };
362 d62c0439 humkyung
                        ViewerDataModel.Instance.MyMarkupList.Add(markup);
363 787a4489 KangIngu
                    }
364
                    else
365
                    {
366 35a96e24 humkyung
                        MarkupItemEx markup = new MarkupItemEx
367 787a4489 KangIngu
                        {
368
                            Data = p.Data,
369
                            Data_Type = p.Data_Type,
370
                            ID = p.ID,
371
                            IsUpdate = false,
372
                            MarkupInfoID = d.MarkupInfoID,
373
                            PageNumber = p.PageNumber,
374 c8e9b3e4 ljiyeon
                            Symbol_ID = p.Symbol_ID,
375 c0977e97 djkim
                            //Group_ID = p.Group_ID
376 35a96e24 humkyung
                        };
377
                        ViewerDataModel.Instance.MarkupList_Pre.Add(markup);
378 787a4489 KangIngu
                    }
379
                }));
380
381 a36a37c3 humkyung
                var currentUser = e.Result.Where(data => data.UserID == App.ViewInfo.UserID && data.AvoidConsolidate == 0).FirstOrDefault();
382 787a4489 KangIngu
                if (currentUser == null)
383
                {
384 a36a37c3 humkyung
                    /// create a new markupinfo to do comments
385 24678e06 humkyung
                    var infoId = Commons.shortGuid();
386 787a4489 KangIngu
                    PreviewUserMarkupInfoItem = new MarkupInfoItem
387
                    {
388
                        CreateTime = DateTime.Now,
389 073f6118 djkim
                        UpdateTime = DateTime.Now,
390 787a4489 KangIngu
                        Depatment = userData.DEPARTMENT,
391
                        DisplayColor = "#FFFF0000",
392
                        UserID = userData.ID,
393
                        UserName = userData.NAME,
394
                        PageCount = 1,
395
                        Description = "",
396
                        MarkupInfoID = infoId,
397
                        MarkupList = null,
398 24678e06 humkyung
                        MarkupVersionID = Commons.shortGuid(),
399 787a4489 KangIngu
                        Consolidate = 0,
400
                        PartConsolidate = 0,
401
                        userDelete = true,
402
                        AvoidConsolidate = 0,
403 8129f2a5 ljiyeon
                        IsPreviewUser = false
404 787a4489 KangIngu
                    };
405
406
                    App.Custom_ViewInfoId = infoId;
407 8129f2a5 ljiyeon
408
                    ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
409 787a4489 KangIngu
                }
410
                else
411
                {
412
                    App.Custom_ViewInfoId = currentUser.MarkupInfoID;
413
                }
414
415 a36a37c3 humkyung
                foreach(var info in e.Result)
416 d128ceb2 humkyung
                {
417
                    if (info.UserID == App.ViewInfo.UserID) info.DisplayColor = "#FFFF0000";
418
                }
419 787a4489 KangIngu
420 3ffd4b2d humkyung
                ViewerDataModel.Instance.PageNumber = 1;
421
422 a36a37c3 humkyung
                /// Consolidation 된 데이터가 최상단에 올 수 있도록 변경
423 35a96e24 humkyung
                var markupItem = ViewerDataModel.Instance._markupInfoList.OrderByDescending(p => p.Consolidate == Convert.ToInt32(true)).ToList();
424 787a4489 KangIngu
                markupItem.ForEach(data =>
425
                {
426 35a96e24 humkyung
                    if (data.Depatment == null) data.Depatment = "Unknown";
427 787a4489 KangIngu
                });
428
                gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
429 29010418 ljiyeon
                SetCommentPages();
430 992a98b4 KangIngu
431 a36a37c3 humkyung
                var SelectedItem = ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == App.ViewInfo.UserID).OrderByDescending(order => order.UpdateTime).FirstOrDefault();
432
                this.gridViewMarkup.SelectedItem = (PreviewUserMarkupInfoItem != null) ? PreviewUserMarkupInfoItem : SelectedItem;
433 073f6118 djkim
                
434 a36a37c3 humkyung
                /// create a group descriptor
435 fddb48f7 ljiyeon
                gridViewMarkup.GroupDescriptors.Clear();
436
                GroupDescriptor descriptor = new GroupDescriptor();
437
                descriptor.Member = "Depatment";
438
                descriptor.DisplayContent = "DEPT";
439 dd0f7089 djkim
                //descriptor.SortDirection = ListSortDirection.Ascending;
440 fddb48f7 ljiyeon
                gridViewMarkup.GroupDescriptors.Add(descriptor);
441 a36a37c3 humkyung
                /// up to here
442 787a4489 KangIngu
            }
443
        }
444
445 ac4f1e13 taeseongkim
        private async void gridViewRevMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
446 787a4489 KangIngu
        {
447
            List<MarkupInfoItem> gridSelectionItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
448
            //if (ViewerDataModel.Instance.PageBalanceNumber == 0)
449
            //{
450
            //    ViewerDataModel.Instance.PageBalanceNumber = 1;
451
            //}
452
453
            if (ViewerDataModel.Instance.PageNumber == 0)
454
            {
455
                ViewerDataModel.Instance.PageNumber = 1;
456
            }
457
            if (e.AddedItems.Count() > 0)
458
            {
459
                foreach (var item in gridSelectionItem)
460
                {
461
                    //item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageBalanceNumber).ToList().ForEach(delegate (MarkupItem markupitem)
462
                    //{
463
                    //    layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
464
                    //});
465 ac4f1e13 taeseongkim
466
                    var pageItems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList();
467
468
                    foreach (var markupitem in pageItems)
469 787a4489 KangIngu
                    {
470 ac4f1e13 taeseongkim
                       await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
471
                    }
472 787a4489 KangIngu
                }
473
            }
474
            else if (e.RemovedItems.Count > 0)
475
            {
476
                var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList();
477
478
                (from A in _infoItem
479
                 from B in Common.ViewerDataModel.Instance.MarkupControls_Sync
480
                 where A.MarkupInfoID == B.MarkupInfoID
481
                 select B).ToList().ForEach(data =>
482
                 {
483
                     Common.ViewerDataModel.Instance.MarkupControls_Sync.Remove(data);
484
                 });
485
            }
486
        }
487 e7dd7ae8 humkyung
488
        /// <summary>
489
        /// 선택한 항목은 Visibility = Visible, 해제한 항목은 Visibility = Hidden 처리한다.
490
        /// </summary>
491
        /// <param name="sender"></param>
492
        /// <param name="e"></param>
493 ac4f1e13 taeseongkim
        private async void gridViewMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
494 787a4489 KangIngu
        {
495 2089959a taeseongkim
            SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
496
497 787a4489 KangIngu
            var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID);
498
            var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID);
499
            var resultA = (from item_Select in dataSet
500
                           from item_Non in dataSet_User
501
                           where item_Select == item_Non
502
                           select item_Non).ToList();
503
504
            if (resultA.Count() >= 2)
505
            {
506 eeb0a39c taeseongkim
                // 동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요?
507 787a4489 KangIngu
                RadWindow.Confirm(new DialogParameters
508
                {
509 b9b01f8e ljiyeon
                    Owner = Application.Current.MainWindow,
510 eeb0a39c taeseongkim
                    Header = "Info",
511
                    Content = "Selected more than two identical user data. Do you want to select consolidation?",
512 787a4489 KangIngu
                    Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) =>
513
                    {
514
                        if (e.AddedItems.Count() == 1)
515
                        {
516
                            MarkupInfoItem instanceItem = e.AddedItems.FirstOrDefault() as MarkupInfoItem;
517 8ab0d0b1 송근호
                            gridViewMarkup.SelectedItem = null;
518 787a4489 KangIngu
519 8ab0d0b1 송근호
                        
520 787a4489 KangIngu
                            if (ea.DialogResult.Value)
521
                            {
522 8ab0d0b1 송근호
                                if (instanceItem.Consolidate == 1 || instanceItem.PartConsolidate == 1)
523
                                {
524
                                    gridViewMarkup.SelectedItem = instanceItem;
525
                                }
526
                                else
527
                                {
528
                                    //1. Consolidations이 있다면 하나 선택
529
                                    var Consolidations = resultA.Where(item => (item.Consolidate == 1 || item.PartConsolidate == 1));
530
531
                                    if (Consolidations.Count() > 0)
532
                                    {
533
                                        gridViewMarkup.SelectedItem = Consolidations.First();
534
                                    }
535
                                }
536
                              
537 787a4489 KangIngu
                            }
538 8ab0d0b1 송근호
                            else {
539
                                //1. Consolidations 아닌게 있다면 Change
540
                                var notConsolidations = resultA.Where(item => !(item.Consolidate == 1 || item.PartConsolidate == 1));
541
542
                                if(notConsolidations.Count() > 0) {
543
                                    gridViewMarkup.SelectedItem = notConsolidations.First();
544
                                }
545
                                else {//1. Consolidations 아닌게 없다면 그대로
546
                                    gridViewMarkup.SelectedItem = instanceItem;
547
                                }
548
                                
549 787a4489 KangIngu
                            }
550
                        }
551
                    }),
552
                    Theme = new Windows8Theme(),
553
                    ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 },
554
                });
555
            }
556
            else //파라미터로 넘어온 사용자가 걸리지 않은 경우
557
            {
558 6b5d33c6 djkim
                List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업
559
                List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
560
                List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업
561
                #region 코멘트 보기
562
                if (e.AddedItems.Count() > 0)
563
                {
564
                    foreach (var item in gridSelectionItem)
565
                    {
566 3ffd4b2d humkyung
                        if (item.UserID == App.ViewInfo.UserID)
567 6b5d33c6 djkim
                        {
568 101da246 humkyung
                            var controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
569
                            if (controls.Count == 0)
570 6b5d33c6 djkim
                            {
571 129ca191 humkyung
                                var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList();
572 ac4f1e13 taeseongkim
573 6b5d33c6 djkim
                                foreach (var markup in instance)
574
                                {
575 ac4f1e13 taeseongkim
                                    await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", 
576 661b7416 humkyung
                                        item.MarkupInfoID, markup.ID);
577 6b5d33c6 djkim
                                }
578
                            }
579 101da246 humkyung
580
                            controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
581
                            foreach (var control in controls)
582 6b5d33c6 djkim
                            {
583 d62c0439 humkyung
                                Logger.sendCheckLog(String.Format("=={0}", control), 1);
584 101da246 humkyung
                                control.Visibility = Visibility.Visible;
585 6b5d33c6 djkim
                            }
586
                        }
587 3ffd4b2d humkyung
                        else
588 6b5d33c6 djkim
                        {
589 101da246 humkyung
                            var controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
590
                            if (controls.Count == 0)
591
                            {
592 129ca191 humkyung
                                var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList();
593 101da246 humkyung
                                foreach (var markup in instance)
594
                                {
595 ac4f1e13 taeseongkim
                                    await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "",
596 101da246 humkyung
                                        item.MarkupInfoID, markup.ID);
597
                                }
598
                            }
599
600
                            controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
601
                            foreach (var control in controls)
602 6b5d33c6 djkim
                            {
603 e7dd7ae8 humkyung
                                control.Visibility = Visibility.Visible;
604 6b5d33c6 djkim
                            }
605
                        }
606
                    }
607
                }
608
                #endregion
609
                #region 코멘트 숨기기
610
                else if (e.RemovedItems.Count > 0)
611
                {
612
                    var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList();
613
614
                    (from A in _infoItem
615
                     from B in Common.ViewerDataModel.Instance.MarkupControls
616
                     where A.MarkupInfoID == B.MarkupInfoID
617
                     select B).ToList().ForEach(data =>
618
                     {
619 b5ac6d6e ljiyeon
                         data.Visibility = Visibility.Hidden;                         
620 6b5d33c6 djkim
                     });
621
622 b5ac6d6e ljiyeon
623 6b5d33c6 djkim
                    var myComment = _infoItem.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault();
624
                    if (myComment != null)
625
                    {
626
                        Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem)
627
                        {
628 e7dd7ae8 humkyung
                            markupitem.Visibility = Visibility.Hidden;
629 6b5d33c6 djkim
                        });
630
                    }
631
                }
632
                #endregion
633 787a4489 KangIngu
            }
634
        }
635
636
        private void BaseClient_GetDocumentItemInfoCompleted(object sender, GetDocumentItemInfoCompletedEventArgs e)
637
        {
638 0f065e57 ljiyeon
            Logger.sendResLog("GetDocumentItemInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
639
640 787a4489 KangIngu
            if (e.Result != null)
641
            {
642
                _DocItem = e.Result;
643
644
                if (e.Result.DOCUMENT_NO == "" && e.Result.DOCUMENT_NAME == "" && e.Result.GROUP_NO == "0")
645
                {
646
                    //장원
647
                    _ViewInfo.UserID = _ViewInfo.UserID.Replace(@"DAELIM\", "");
648
                }
649 29010418 ljiyeon
                Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1);
650 787a4489 KangIngu
                BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID });
651
            }
652
            else
653
            {
654
                BaseClient.GetCheckSystemAdminCompleted += (sen, ea) =>
655
                {
656 0f065e57 ljiyeon
                    Logger.sendResLog("GetCheckSystemAdminCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
657
658 787a4489 KangIngu
                    if (ea.Error == null)
659
                    {
660
                        if (ea.Result)
661
                        {
662
                            this._ViewInfo.isAdmin = true;
663 0f065e57 ljiyeon
                            Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1);
664 787a4489 KangIngu
                            BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID });
665
                        }
666
                        else
667
                        {
668
                            //System.Windows.Forms.MessageBox.Show("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내");
669 503cb09e taeseongkim
                            DialogMessage_Alert("You are not belong to this project. Please ask admin for an authority.", "Info");
670 787a4489 KangIngu
                            //this.ParentOfType<MainPage>().DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내");
671
                        }
672
673
                    }
674
                    else
675
                    {
676
                        //System.Windows.Browser.HtmlPage.Window.Invoke("close");
677
                    }
678
                };
679 0f065e57 ljiyeon
                Logger.sendReqLog("GetCheckSystemAdminAsync", _ViewInfo.UserID, 1);
680 787a4489 KangIngu
                BaseClient.GetCheckSystemAdminAsync(this._ViewInfo.UserID);
681
            }
682
        }
683
684
        private void BaseClient_GetSystemDataCompleted(object sender, GetSystemDataCompletedEventArgs e)
685
        {
686 0f065e57 ljiyeon
            Logger.sendResLog("GetSystemDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
687
688 787a4489 KangIngu
            if (e.Error == null && e.Result != null)
689
            {
690
                App.SystemInfo = e.Result;
691
692
                //App.urlPort_DB = App.SystemInfo.HostPort;
693
                //App.urlHost_DB = App.SystemInfo.HostName;
694 0f065e57 ljiyeon
                Logger.sendReqLog("GetConversionStateAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1);
695 787a4489 KangIngu
                BaseClient.GetConversionStateAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID });
696
697
                //if (App.urlHost.Contains("localhost"))
698
                //{
699
                //    App.urlHost = App.urlHost_DB;
700
                //}
701
            }
702
        }
703
704
        private void BaseClient_GetConversionStateCompleted(object sender, GetConversionStateCompletedEventArgs e)
705
        {
706 84c48033 djkim
            
707 0f065e57 ljiyeon
            Logger.sendResLog("GetConversionStateCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
708 84c48033 djkim
            string failedmsg = CommonLib.Common.GetAlertMessageString("GetConversionStateFailed", "MSG", "Too Many V/P Files are uploading instantaneously, This V/P file can not be open now. Please feel free to re-open wait a moment again!\n\n현재 일시적으로 많은 양의 V/P가 등록되고 있어 이 문서를 열람할 수 없습니다.\n잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다");
709 53880c83 ljiyeon
            if (e.Error == null && e.Result == true)
710 787a4489 KangIngu
            {
711 0f065e57 ljiyeon
                Logger.sendReqLog("GetDocumentItemInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + _ViewInfo.UserID, 1);
712
713 787a4489 KangIngu
                BaseClient.GetDocumentItemInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID, userID = _ViewInfo.UserID });
714
715 992a98b4 KangIngu
                if (App.ViewInfo != null && App.ViewInfo.ProjectNO != "")
716 787a4489 KangIngu
                {
717 0f065e57 ljiyeon
                    Logger.sendReqLog("GetMember", _ViewInfo.ProjectNO + "," + _ViewInfo.UserID, 1);
718 6c781c0c djkim
                    userData = BaseClient.GetMember(App.ViewInfo.ProjectNO, App.ViewInfo.UserID);
719
                    if (userData != null)
720 787a4489 KangIngu
                    {
721 0f065e57 ljiyeon
                        Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1);
722 6c781c0c djkim
                        BaseClient.GetDeptDataAsync(userData.DEPARTMENT);
723 787a4489 KangIngu
                    }
724 6c781c0c djkim
                    else
725
                    {
726
                        userData = new MEMBER();
727
                        userData.DEPARTMENT = "ALL";
728 0f065e57 ljiyeon
                        Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1);
729 6c781c0c djkim
                        BaseClient.GetDeptDataAsync(userData.DEPARTMENT);
730 29010418 ljiyeon
                    }
731 787a4489 KangIngu
                }
732
            }
733
            else
734
            {
735 84c48033 djkim
                
736
                DialogMessage_Alert(failedmsg, "Warning");
737 787a4489 KangIngu
            }
738
        }
739 29010418 ljiyeon
740 787a4489 KangIngu
        public void SetView(ViewInfo info)
741 5a6493ad humkyung
        { 
742 787a4489 KangIngu
            this._ViewInfo = info;
743 5a6493ad humkyung
            try
744 5ded1e5a djkim
            {
745 5a6493ad humkyung
                /// 대림의 경우 EnsembleID를 가지고 DocumentItemID를 구함
746
                /// 다른 Site를 대비하여 에러 처리함
747
                string docid = BaseClient.GetDocItemID(info.EnsembleID);
748
                if (!string.IsNullOrEmpty(docid))
749
                {
750
                    this._ViewInfo.DocumentItemID = docid;
751
                }
752 5ded1e5a djkim
            }
753 5a6493ad humkyung
            catch(Exception ex)
754
            {
755
                App.FileLogger.Fatal(ex);
756
            }
757
758 5ded1e5a djkim
            Logger.sendReqLog("GetSystemDataAsync", "", 1);
759 29010418 ljiyeon
            BaseClient.GetSystemDataAsync();
760 787a4489 KangIngu
        }
761
762 992a98b4 KangIngu
        public void HubSet()
763
        {
764
            // 허브 연결 구성
765 84c48033 djkim
            var hubConnection = new HubConnection(CommonLib.Common.GetConfigString("HubAddress", "URL", "", App.isExternal));
766 992a98b4 KangIngu
            IHubProxy MarkusLicenseProxy = hubConnection.CreateHubProxy("MarkusLicenseHub");
767
768
769
            // 허브 연결 
770
            hubConnection.Start().ContinueWith(task =>
771
            {
772
                if (task.IsFaulted)
773
                {
774
                    Console.WriteLine("There was an error opening the connection:{0}",
775
                                      task.Exception.GetBaseException());
776 53f96e00 송근호
                    //throw task.Exception.GetBaseException();
777 992a98b4 KangIngu
                }
778
                else
779
                {
780
                    Console.WriteLine("Connected :: " + task.Id);
781
                }
782
783
            }).Wait();
784
785
786
            // [ 프로그램 시작 ]
787
            // 클라이언트에서 서버를 호출 ( 접속 시 )  : 라이센스 체크
788
            //( "method name", arg1, arg2 )
789
            //MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", "H2009115", "고동균").ContinueWith(task =>
790
            //{
791
            //    if (task.IsFaulted)
792
            //    {
793
            //        Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException());
794
            //    }
795
            //    else
796
            //    {
797
            //        Console.WriteLine(task.Result);
798
            //    }
799
            //});
800 0af41bf0 djkim
            MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", App.ViewInfo.UserID,App.ViewInfo.ProjectNO).ContinueWith(task =>
801 992a98b4 KangIngu
            {
802
                if (task.IsFaulted)
803
                {
804
                    Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException());
805 53f96e00 송근호
                    //throw task.Exception.GetBaseException();
806 992a98b4 KangIngu
                }
807
                else
808
                {
809 29010418 ljiyeon
                    switch (task.Result)
810 992a98b4 KangIngu
                    {
811 53393bae KangIngu
                        case "2":
812
                            {
813 0af41bf0 djkim
                                var result = MessageBox.Show("권한이 없습니다.");
814
                                if (result == MessageBoxResult.OK)
815
                                    System.Diagnostics.Process.GetCurrentProcess().Kill();
816 53393bae KangIngu
                            }
817
                            break;
818
                        case "404":
819
                            {
820 0af41bf0 djkim
                                var result = MessageBox.Show("등록된 사용자가 아닙니다.");
821
                                if(result == MessageBoxResult.OK)
822
                                    System.Diagnostics.Process.GetCurrentProcess().Kill();
823 53393bae KangIngu
                            }
824
                            break;
825 992a98b4 KangIngu
                    }
826
                }
827 53f96e00 송근호
            });
828 992a98b4 KangIngu
829
            // 서버에서 클라이언트 호출 ( 프로그램 구동여부 ) : 라이센스 체크 후 응답 ( 반환값 : true, false ) 
830
            //MarkusLicenseProxy.On<bool>("IsConnection", status =>
831
            //{
832
833
            //    if (status)
834
            //    {
835
            //        // 프로그램 시작 
836
            //        Console.WriteLine("connection status : " + status);
837
            //    }
838
            //    else
839
            //    {
840
            //        // 프로그램 종료 ( signalr 접속 끊기 )  
841
            //        hubConnection.Stop();
842
            //    }
843
            //});
844
845
            // 공지 메세지 ( 서버에서 클라이언트 호출 ) 
846
            MarkusLicenseProxy.On<string>("MarkusNotification", msg =>
847
                Console.WriteLine("Noficiation Message : " + msg)
848
            );
849
850
851
            // 서버 메서드 호출 
852
            //MarkusLicenseProxy.Invoke<string>("DoSomething", "I'm doing something!!!").Wait();
853
854
            //Console.ReadKey();
855
856
            //hubConnection.Stop();
857
        }
858 787a4489 KangIngu
859 ac4f1e13 taeseongkim
        public async void MarkupUserListDisplay()
860 1f1c566e djkim
        {
861
            List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업
862
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
863
            List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업
864 29010418 ljiyeon
                                                                                                     //MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl();
865 1f1c566e djkim
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();  //전체 제거
866 29010418 ljiyeon
            Common.ViewerDataModel.Instance.MarkupControls.Clear();  //전체 제거
867 f714bef8 djkim
            //foreach (var item in gridSelectionItem)
868
            //{
869
            //    if (item.UserID == App.ViewInfo.UserID)
870
            //    {
871 d62c0439 humkyung
            //        ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
872 f714bef8 djkim
            //        {
873
            //            layerControl.markupParseEx(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markupitem.ID);
874
            //        });
875
            //    }
876
            //    else
877
            //    {
878
            //        ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
879
            //        {
880
            //            layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID);
881
            //        });
882
            //    }
883
            //}
884 29010418 ljiyeon
                (from A in gridSelectionItem
885
                 from B in Common.ViewerDataModel.Instance.MarkupControls_USER
886
                 where A.MarkupInfoID == B.MarkupInfoID
887
                 select B).ToList().ForEach(data =>
888
                 {
889
                     Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(data);
890
                 });
891 1f1c566e djkim
            (from A in gridSelectionItem
892
             from B in Common.ViewerDataModel.Instance.MarkupControls
893
             where A.MarkupInfoID == B.MarkupInfoID
894
             select B).ToList().ForEach(data =>
895
             {
896
                 Common.ViewerDataModel.Instance.MarkupControls.Remove(data);
897
             });
898
899
            foreach (var item in gridSelectionItem)
900
            {
901 ac4f1e13 taeseongkim
902 1f1c566e djkim
                if (item.UserID == App.ViewInfo.UserID)
903
                {
904 ac4f1e13 taeseongkim
                    var markupItems = ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList();
905
906
                    foreach (var markupitem in markupItems)
907 1f1c566e djkim
                    {
908 ac4f1e13 taeseongkim
                        await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", 
909
                                item.MarkupInfoID, markupitem.ID);
910
                    }
911 1f1c566e djkim
                }
912
                else
913
                {
914 ac4f1e13 taeseongkim
                    var markupItems = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList();
915
916
                    foreach (var markupitem in markupItems)
917 1f1c566e djkim
                    {
918 ac4f1e13 taeseongkim
                        await MarkupParser.ParseExAsync(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID);
919
                    }
920 1f1c566e djkim
                }
921
            }
922
        }
923 787a4489 KangIngu
    }
924
}
클립보드 이미지 추가 (최대 크기: 500 MB)