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