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