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