markus / KCOM / Services / BaseServices.cs @ f9d42594
이력 | 보기 | 이력해설 | 다운로드 (38.5 KB)
1 | 787a4489 | KangIngu | using Microsoft.AspNet.SignalR.Client; |
---|---|---|---|
2 | using IKCOM; |
||
3 | using KCOM.Common; |
||
4 | using KCOM.ServiceDeepView; |
||
5 | using KCOMDataModel.DataModel; |
||
6 | using Newtonsoft.Json; |
||
7 | using RestSharp; |
||
8 | using System; |
||
9 | using System.Collections.Generic; |
||
10 | using System.Collections.ObjectModel; |
||
11 | using System.ComponentModel; |
||
12 | using System.Linq; |
||
13 | using System.Runtime.CompilerServices; |
||
14 | using System.Text; |
||
15 | using System.Windows; |
||
16 | using System.Windows.Controls; |
||
17 | using Telerik.Windows.Controls; |
||
18 | |||
19 | namespace KCOM.Views |
||
20 | { |
||
21 | public partial class MainMenu : UserControl, INotifyPropertyChanged |
||
22 | 6c781c0c | djkim | { |
23 | 787a4489 | KangIngu | const string DeepZoomUrl = @"http://{baseUrl}/TileSource/{TileSourcePath}/{ItemsPath}/{SharepointItemID}/{PageNo}.jpg"; |
24 | public ServiceDeepViewClient BaseClient; |
||
25 | public ViewInfo _ViewInfo; |
||
26 | public DOCINFO _DocInfo; |
||
27 | public DOCUMENT_ITEM _DocItem; |
||
28 | public MEMBER userData; |
||
29 | |||
30 | public event PropertyChangedEventHandler PropertyChanged; |
||
31 | private void NotifyPropertyChanged([CallerMemberName] String propertyName = "") |
||
32 | { |
||
33 | if (PropertyChanged != null) |
||
34 | { |
||
35 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||
36 | } |
||
37 | } |
||
38 | |||
39 | private Common.DocumentSet _CurrentDoc { get; set; } |
||
40 | public Common.DocumentSet CurrentDoc |
||
41 | { |
||
42 | get |
||
43 | { |
||
44 | return _CurrentDoc; |
||
45 | } |
||
46 | set |
||
47 | { |
||
48 | if (value != CurrentDoc) |
||
49 | { |
||
50 | _CurrentDoc = value; |
||
51 | NotifyPropertyChanged(); |
||
52 | } |
||
53 | } |
||
54 | } |
||
55 | public void ServiceOn() |
||
56 | { |
||
57 | 6c781c0c | djkim | BaseClient = new ServiceDeepViewClient(App._binding, App._EndPoint); |
58 | |||
59 | 787a4489 | KangIngu | BaseClient.GetDocInfoCompleted += BaseClient_GetDocInfoCompleted; //문서 섬네일, 페이지크기, 마크업 정보 [3] |
60 | BaseClient.GetConversionStateCompleted += BaseClient_GetConversionStateCompleted; //컨버팅의 여부 [2] |
||
61 | BaseClient.GetSystemDataCompleted += BaseClient_GetSystemDataCompleted; //시스템 정보 [1] |
||
62 | BaseClient.GetDocumentItemInfoCompleted += BaseClient_GetDocumentItemInfoCompleted; // 문서 자체의 정보 [4] |
||
63 | BaseClient.GetMarkupInfoItemsCompleted += BaseClient_GetMarkupInfoItemsCompleted; |
||
64 | BaseClient.GetDeptDataCompleted += BaseClient_GetDeptDataCompleted; |
||
65 | BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted; |
||
66 | BaseClient.GetVPRevisionHistoryCompleted += BaseClient_GetVPRevisionHistoryCompleted; |
||
67 | BaseClient.SetFinalPDFCompleted += BaseClient_SetFinalPDFCompleted; |
||
68 | BaseClient.GetCompareRectCompleted += BaseClient_GetCompareRectCompleted; |
||
69 | 992a98b4 | KangIngu | BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted; |
70 | BaseClient.DelFavoriteVPCompleted += BaseClient_DelFavoriteVPCompleted; |
||
71 | 6c781c0c | djkim | BaseClient.EditFavoriteVPCompleted += BaseClient_EditFavoriteVPCompleted; |
72 | 992a98b4 | KangIngu | } |
73 | |||
74 | 6c781c0c | djkim | |
75 | 992a98b4 | KangIngu | |
76 | private void BaseClient_EditFavoriteVPCompleted(object sender, EditFavoriteVPCompletedEventArgs e) |
||
77 | { |
||
78 | if (e.Error == null && e.Result != null) |
||
79 | { |
||
80 | BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID); |
||
81 | } |
||
82 | else |
||
83 | { |
||
84 | DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning"); |
||
85 | } |
||
86 | } |
||
87 | |||
88 | private void BaseClient_DelFavoriteVPCompleted(object sender, DelFavoriteVPCompletedEventArgs e) |
||
89 | { |
||
90 | if (e.Error == null && e.Result != null) |
||
91 | { |
||
92 | BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID); |
||
93 | } |
||
94 | else |
||
95 | { |
||
96 | DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning"); |
||
97 | } |
||
98 | 787a4489 | KangIngu | } |
99 | |||
100 | 992a98b4 | KangIngu | |
101 | 787a4489 | KangIngu | private void BaseClient_GetCompareRectCompleted(object sender, GetCompareRectCompletedEventArgs e) |
102 | { |
||
103 | if (e.Error != null || e.Result == null) |
||
104 | { |
||
105 | DialogMessage_Alert("Compare 기능을 원활히 실행하기 위한 데이터가 부족합니다", "안내"); |
||
106 | } |
||
107 | else |
||
108 | { |
||
109 | e.Result.ForEach(d => |
||
110 | { |
||
111 | d.Width = d.Width * 3; |
||
112 | d.Height = d.Height * 3; |
||
113 | var point = MarkupToPDF.Controls.Common.MathSet.getRectMiddlePoint(d); |
||
114 | System.Windows.Shapes.Ellipse myEllipse = new System.Windows.Shapes.Ellipse(); |
||
115 | myEllipse.Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red); |
||
116 | myEllipse.Opacity = 1; |
||
117 | myEllipse.Width = d.Width; |
||
118 | myEllipse.Height = d.Height; |
||
119 | Canvas.SetLeft(myEllipse, d.X - ((point.X - d.X) / 2.0)); |
||
120 | Canvas.SetTop(myEllipse, d.Y - ((point.Y - d.Y) / 2.0)); |
||
121 | myEllipse.RenderTransformOrigin = point; |
||
122 | canvas_compareBorder.Children.Add(myEllipse); |
||
123 | }); |
||
124 | |||
125 | da.From = 0.8; |
||
126 | da.To = 0; |
||
127 | da.Duration = new Duration(TimeSpan.FromSeconds(1)); |
||
128 | da.AutoReverse = true; |
||
129 | canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
||
130 | } |
||
131 | } |
||
132 | |||
133 | private void BaseClient_SetFinalPDFCompleted(object sender, SetFinalPDFCompletedEventArgs e) |
||
134 | { |
||
135 | |||
136 | if (e.Error !=null || e.Result.Status == FinalStatus.Error) |
||
137 | { |
||
138 | DialogMessage_Alert("최종 파일을 만드는데 문제가 발생하였습니다", "안내"); |
||
139 | } |
||
140 | else |
||
141 | { |
||
142 | 992a98b4 | KangIngu | DialogMessage_Alert("최종 파일 생성 중입니다. 문서관리시스템을 확인해주세요", "안내"); |
143 | 787a4489 | KangIngu | } |
144 | } |
||
145 | |||
146 | private void BaseClient_GetVPRevisionHistoryCompleted(object sender, GetVPRevisionHistoryCompletedEventArgs e) |
||
147 | { |
||
148 | if (e.Result != null && e.Error == null) |
||
149 | { |
||
150 | gridViewHistory.ItemsSource = e.Result; |
||
151 | } |
||
152 | 6707a5c7 | ljiyeon | ViewerDataModel.Instance.SystemMain.dzMainMenu.TempLoad(); |
153 | 787a4489 | KangIngu | } |
154 | |||
155 | private void BaseClient_DeleteMarkupCompleted(object sender, DeleteMarkupCompletedEventArgs e) |
||
156 | { |
||
157 | SetDisplayColor(ViewerDataModel.Instance._markupInfoList.ToList(), App.ViewInfo.UserID); |
||
158 | } |
||
159 | |||
160 | private void BaseClient_GetDeptDataCompleted(object sender, GetDeptDataCompletedEventArgs e) |
||
161 | { |
||
162 | if (e.Result != null) |
||
163 | { |
||
164 | e.Result.Sort(); |
||
165 | //cbSymbolPublic.ItemsSource = e.Result.ToList(); |
||
166 | } |
||
167 | } |
||
168 | 992a98b4 | KangIngu | public MarkupInfoItem PreviewUserMarkupInfoItem { get; set; } |
169 | 787a4489 | KangIngu | |
170 | private void BaseClient_GetMarkupInfoItemsCompleted(object sender, GetMarkupInfoItemsCompletedEventArgs e) |
||
171 | { |
||
172 | ViewerDataModel.Instance.MarkupControls_USER.Clear(); |
||
173 | ViewerDataModel.Instance.MarkupControls.Clear(); |
||
174 | if (e.Result != null) |
||
175 | { |
||
176 | var pureItem = e.Result; |
||
177 | if(pureItem.Count > 0) |
||
178 | { |
||
179 | ViewerDataModel.Instance.MarkupList_USER.Clear(); |
||
180 | } |
||
181 | |||
182 | pureItem.ToList().ForEach(d => d.MarkupList.ForEach(p => |
||
183 | { |
||
184 | |||
185 | if (d.UserID == App.ViewInfo.UserID) |
||
186 | { |
||
187 | d.userDelete = true; |
||
188 | d.DisplayColor = "#FFFF0000"; |
||
189 | |||
190 | ViewerDataModel.Instance.MarkupList_USER.Add(new MarkupItemEx |
||
191 | { |
||
192 | Data = p.Data, |
||
193 | Data_Type = p.Data_Type, |
||
194 | ID = p.ID, |
||
195 | IsUpdate = false, |
||
196 | MarkupInfoID = d.MarkupInfoID, |
||
197 | PageNumber = p.PageNumber, |
||
198 | }); |
||
199 | } |
||
200 | else |
||
201 | { |
||
202 | ViewerDataModel.Instance.MarkupList_Pre.Add(new MarkupItemEx |
||
203 | { |
||
204 | Data = p.Data, |
||
205 | Data_Type = p.Data_Type, |
||
206 | ID = p.ID, |
||
207 | IsUpdate = false, |
||
208 | MarkupInfoID = d.MarkupInfoID, |
||
209 | PageNumber = p.PageNumber, |
||
210 | }); |
||
211 | } |
||
212 | //if (p.ID ==App.ViewInfo.UserID) |
||
213 | //{ |
||
214 | // d.userDelete = true; |
||
215 | // d.DisplayColor = "#FFFF0000"; |
||
216 | //} |
||
217 | })); |
||
218 | |||
219 | var currentUser = e.Result.Where(data => data.UserID == userData.ID).FirstOrDefault(); |
||
220 | //var currentUser = e.Result.Where(data => data.UserID == "H2014410").FirstOrDefault(); |
||
221 | if (currentUser == null) |
||
222 | { |
||
223 | var infoId = Events.Save.shortGuid(); |
||
224 | PreviewUserMarkupInfoItem = new MarkupInfoItem |
||
225 | { |
||
226 | CreateTime = DateTime.Now, |
||
227 | Depatment = userData.DEPARTMENT, |
||
228 | DisplayColor = "#FFFF0000", |
||
229 | UserID = userData.ID, |
||
230 | UserName = userData.NAME, |
||
231 | PageCount = 1, |
||
232 | Description = "", |
||
233 | MarkupInfoID = infoId, |
||
234 | MarkupList = null, |
||
235 | MarkupVersionID = Events.Save.shortGuid(), |
||
236 | Consolidate = 0, |
||
237 | PartConsolidate = 0, |
||
238 | userDelete = true, |
||
239 | AvoidConsolidate = 0, |
||
240 | IsPreviewUser = true |
||
241 | }; |
||
242 | |||
243 | App.Custom_ViewInfoId = infoId; |
||
244 | //pureItem.Insert(0,PreviewUserMarkupInfoItem); |
||
245 | } |
||
246 | else |
||
247 | { |
||
248 | App.Custom_ViewInfoId = currentUser.MarkupInfoID; |
||
249 | } |
||
250 | |||
251 | //pureItem.ForEach(d => d.MarkupList = null); |
||
252 | //ViewerDataModel.Instance._markupInfoList = new ObservableCollection<MarkupInfoItem>(pureItem); |
||
253 | ViewerDataModel.Instance._markupInfoList = SetDisplayColor(pureItem, _ViewInfo.UserID); |
||
254 | //ViewerDataModel.Instance._markupInfoList = SetDisplayColor(e.Result, _ViewInfo.UserID); |
||
255 | |||
256 | |||
257 | |||
258 | //if (e.Result.Where(data => data.UserID == userData.ID).FirstOrDefault() == null) |
||
259 | //{ |
||
260 | |||
261 | // PreviewUserMarkupInfoItem = new MarkupInfoItem |
||
262 | // { |
||
263 | // CreateTime = DateTime.Now, |
||
264 | // Depatment = userData.DEPARTMENT, |
||
265 | // DisplayColor = "#FFFF0000", |
||
266 | // UserID = userData.ID, |
||
267 | // UserName = userData.NAME + "(임시저장)", |
||
268 | // PageCount = 1, |
||
269 | // Description = "", |
||
270 | // MarkupInfoID = Events.Save.shortGuid(), |
||
271 | // MarkupList = null, |
||
272 | // MarkupVersionID = Events.Save.shortGuid(), |
||
273 | // Consolidate = 0, |
||
274 | // PartConsolidate = 0, |
||
275 | // userDelete = true, |
||
276 | // AvoidConsolidate = 0, |
||
277 | // IsPreviewUser = true |
||
278 | // }; |
||
279 | // ViewerDataModel.Instance._markupInfoList.Add(PreviewUserMarkupInfoItem); |
||
280 | //} |
||
281 | |||
282 | |||
283 | |||
284 | var markupItem = ViewerDataModel.Instance._markupInfoList.OrderByDescending(p => p.Consolidate == Convert.ToInt32(true)).ToList(); //Consolidation 된 데이터가 최상단에 올 수 있도록 변경 |
||
285 | |||
286 | markupItem.ForEach(data => |
||
287 | { |
||
288 | if (data.Depatment == null) |
||
289 | { |
||
290 | data.Depatment = "Unknown"; |
||
291 | //BaseClient.NoticeAccountErrorAsync(_ViewInfo.ProjectNO, data.UserID); |
||
292 | } |
||
293 | }); |
||
294 | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
||
295 | SetCommentPages(); |
||
296 | 992a98b4 | KangIngu | |
297 | //this.gridViewMarkup.SelectedItem = this.gridViewMarkup.Items[0]; |
||
298 | var select_item = ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == App.ViewInfo.UserID).OrderByDescending(order => order.Consolidate == Convert.ToInt32(true)).FirstOrDefault(); |
||
299 | this.gridViewMarkup.SelectedItem = select_item; |
||
300 | |||
301 | |||
302 | 787a4489 | KangIngu | |
303 | //var markupItem = ViewerDataModel.Instance._markupInfoList.OrderByDescending(p => p.Consolidate == Convert.ToInt32(true)).ToList(); //Consolidation 된 데이터가 최상단에 올 수 있도록 변경 |
||
304 | |||
305 | //markupItem.ForEach(data => |
||
306 | //{ |
||
307 | // if (data.Depatment == null) |
||
308 | // { |
||
309 | // data.Depatment = "Unknown"; |
||
310 | // //BaseClient.NoticeAccountErrorAsync(_ViewInfo.ProjectNO, data.UserID); |
||
311 | // } |
||
312 | //}); |
||
313 | |||
314 | //markupItem.Where(data => Convert.ToBoolean(data.Consolidate) && !Convert.ToBoolean(data.PartConsolidate)).ToList().ForEach(data => data.Depatment = "Consolidation"); |
||
315 | |||
316 | //var root = markupItem.Where(data => data.Depatment.Contains("SUB_")).ToList(); |
||
317 | |||
318 | //foreach (var item in root) |
||
319 | //{ |
||
320 | // item.Depatment = item.Depatment.Replace("SUB_", ""); |
||
321 | //} |
||
322 | //gridViewMarkup.ItemsSource = markupItem; |
||
323 | |||
324 | //SetCommentPages(); //색상을 불러오는 내용 |
||
325 | |||
326 | |||
327 | //if (ViewerDataModel.Instance._markupInfoList.Count() > 0) |
||
328 | //{ |
||
329 | // var com = (from kkk in ViewerDataModel.Instance._markupInfoList where kkk.Consolidate == Convert.ToInt32(true) select kkk).FirstOrDefault(); |
||
330 | |||
331 | // if (com != null) //콘솔리데이션이 있는 경우 |
||
332 | // { |
||
333 | // if (com.UserID == _ViewInfo.UserID) |
||
334 | // { |
||
335 | // gridViewMarkup.SelectedItems.Add(com); |
||
336 | // } |
||
337 | // else |
||
338 | // { |
||
339 | // if (ViewerDataModel.Instance._markupInfoList.Where(p => p.UserID == _ViewInfo.UserID).FirstOrDefault() != null) |
||
340 | // { |
||
341 | // gridViewMarkup.SelectedItems.Add(ViewerDataModel.Instance._markupInfoList.Where(p => p.UserID == _ViewInfo.UserID).FirstOrDefault()); |
||
342 | // } |
||
343 | |||
344 | // else |
||
345 | // { |
||
346 | // var data = ViewerDataModel.Instance._markupInfoList.Where(p => p.Consolidate == Convert.ToInt32(true)).FirstOrDefault(); |
||
347 | // //DicUserListOpacity.Add(data.UserID, 1); |
||
348 | // gridViewMarkup.SelectedItems.Add(ViewerDataModel.Instance._markupInfoList.Where(p => p.Consolidate == Convert.ToInt32(true)).FirstOrDefault()); |
||
349 | // } |
||
350 | // } |
||
351 | |||
352 | // } |
||
353 | // else |
||
354 | // { |
||
355 | // //아무것도 체크 안함 |
||
356 | // //foreach (var item in _markupInfoList) |
||
357 | // //{ |
||
358 | // // gridViewMarkup.SelectedItems.Add(item); |
||
359 | // //} |
||
360 | |||
361 | |||
362 | // if (ViewerDataModel.Instance._markupInfoList.Where(p => p.UserID == _ViewInfo.UserID).FirstOrDefault() != null) //본인것만 체크 |
||
363 | // { |
||
364 | // gridViewMarkup.SelectedItems.Add(ViewerDataModel.Instance._markupInfoList.Where(p => p.UserID == _ViewInfo.UserID).FirstOrDefault()); |
||
365 | // } |
||
366 | // } |
||
367 | //} |
||
368 | //else |
||
369 | //{ |
||
370 | |||
371 | //} |
||
372 | } |
||
373 | } |
||
374 | |||
375 | private void gridViewRevMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
||
376 | { |
||
377 | List<MarkupInfoItem> gridSelectionItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
378 | //if (ViewerDataModel.Instance.PageBalanceNumber == 0) |
||
379 | //{ |
||
380 | // ViewerDataModel.Instance.PageBalanceNumber = 1; |
||
381 | //} |
||
382 | |||
383 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
384 | { |
||
385 | ViewerDataModel.Instance.PageNumber = 1; |
||
386 | } |
||
387 | if (e.AddedItems.Count() > 0) |
||
388 | { |
||
389 | foreach (var item in gridSelectionItem) |
||
390 | { |
||
391 | //item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageBalanceNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
392 | //{ |
||
393 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
||
394 | //}); |
||
395 | item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
396 | { |
||
397 | layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
||
398 | }); |
||
399 | } |
||
400 | } |
||
401 | else if (e.RemovedItems.Count > 0) |
||
402 | { |
||
403 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
404 | |||
405 | (from A in _infoItem |
||
406 | from B in Common.ViewerDataModel.Instance.MarkupControls_Sync |
||
407 | where A.MarkupInfoID == B.MarkupInfoID |
||
408 | select B).ToList().ForEach(data => |
||
409 | { |
||
410 | Common.ViewerDataModel.Instance.MarkupControls_Sync.Remove(data); |
||
411 | }); |
||
412 | } |
||
413 | } |
||
414 | private void gridViewMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
||
415 | { |
||
416 | //this.ParentOfType<MainPage>().ReleaseAdorner(); |
||
417 | |||
418 | var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
419 | var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
420 | var resultA = (from item_Select in dataSet |
||
421 | from item_Non in dataSet_User |
||
422 | where item_Select == item_Non |
||
423 | select item_Non).ToList(); |
||
424 | |||
425 | if (resultA.Count() >= 2) |
||
426 | { |
||
427 | RadWindow.Confirm(new DialogParameters |
||
428 | { |
||
429 | Header = "안내", |
||
430 | Content = "동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요?", |
||
431 | Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) => |
||
432 | { |
||
433 | if (e.AddedItems.Count() == 1) |
||
434 | { |
||
435 | MarkupInfoItem instanceItem = e.AddedItems.FirstOrDefault() as MarkupInfoItem; |
||
436 | var result = instanceItem.Consolidate; |
||
437 | |||
438 | //dataSet.Where(data => data.UserID == "H2011357").ToList().ForEach(data => lstbox.SelectedItems.Remove(data)); |
||
439 | if (ea.DialogResult.Value) |
||
440 | { |
||
441 | ConsolidationMethod(); |
||
442 | } |
||
443 | else |
||
444 | { |
||
445 | ((RadGridView)sender).SelectedItem = null; |
||
446 | } |
||
447 | } |
||
448 | }), |
||
449 | Theme = new Windows8Theme(), |
||
450 | ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 }, |
||
451 | }); |
||
452 | } |
||
453 | else //파라미터로 넘어온 사용자가 걸리지 않은 경우 |
||
454 | { |
||
455 | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
||
456 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
457 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
458 | MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl(); |
||
459 | layerControl.ProjectNo = App.ViewInfo.ProjectNO; |
||
460 | #region 코멘트 보기 |
||
461 | if (e.AddedItems.Count() > 0) |
||
462 | { |
||
463 | foreach (var item in gridSelectionItem) |
||
464 | { |
||
465 | 64f6713a | humkyung | if ((item.UserID == App.ViewInfo.UserID) && (this.pageNavigator.CurrentPage != null)) |
466 | 787a4489 | KangIngu | { |
467 | 6c781c0c | djkim | |
468 | 787a4489 | KangIngu | var instance = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.PageNumber == pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
469 | var my_item = Common.ViewerDataModel.Instance.MarkupControls_USER.FirstOrDefault(); |
||
470 | 6707a5c7 | ljiyeon | Common.ViewerDataModel.Instance.current_page_commentcnt = Common.ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().Count; |
471 | if (my_item == null) |
||
472 | 787a4489 | KangIngu | { |
473 | foreach (var markup in instance) |
||
474 | { |
||
475 | layerControl.markupParseEx(markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markup.ID); |
||
476 | } |
||
477 | } |
||
478 | else |
||
479 | { |
||
480 | var test = instance.Where(data => data.MarkupInfoID == my_item.MarkupInfoID).FirstOrDefault(); |
||
481 | |||
482 | if (test == null) |
||
483 | { |
||
484 | foreach (var markup in instance) |
||
485 | { |
||
486 | layerControl.markupParseEx(markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markup.ID); |
||
487 | } |
||
488 | } |
||
489 | } |
||
490 | } |
||
491 | 64f6713a | humkyung | else if(this.pageNavigator.CurrentPage != null) |
492 | 787a4489 | KangIngu | { |
493 | var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
494 | foreach (var markup in instance) |
||
495 | { |
||
496 | layerControl.markupParse(markup.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
||
497 | } |
||
498 | } |
||
499 | } |
||
500 | //} |
||
501 | } |
||
502 | #endregion |
||
503 | #region 코멘트 숨기기 |
||
504 | else if (e.RemovedItems.Count > 0) |
||
505 | { |
||
506 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
507 | |||
508 | (from A in _infoItem |
||
509 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
510 | where A.MarkupInfoID == B.MarkupInfoID |
||
511 | select B).ToList().ForEach(data => |
||
512 | { |
||
513 | Common.ViewerDataModel.Instance.MarkupControls.Remove(data); |
||
514 | }); |
||
515 | |||
516 | //var myComment = _infoItem.Where(d => d.MarkupInfoID == App.Custom_ViewInfoId).FirstOrDefault(); |
||
517 | var myComment = _infoItem.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault(); |
||
518 | if (myComment != null) |
||
519 | { |
||
520 | ChangeCommentReact(); |
||
521 | Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem) |
||
522 | { |
||
523 | if (markupitem.IsNew) |
||
524 | { |
||
525 | var root = layerControl.MarkupToString(markupitem, App.ViewInfo.UserID); |
||
526 | ViewerDataModel.Instance.MarkupList_USER.Add(new MarkupItemEx |
||
527 | { |
||
528 | ID = markupitem.CommentID, |
||
529 | Data = root.ConvertData, |
||
530 | Data_Type = root.DATA_TYPE, |
||
531 | MarkupInfoID = markupitem.MarkupInfoID, |
||
532 | PageNumber = this.pageNavigator.CurrentPage.PageNumber, |
||
533 | }); |
||
534 | } |
||
535 | Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(markupitem); |
||
536 | }); |
||
537 | } |
||
538 | } |
||
539 | #endregion |
||
540 | } |
||
541 | } |
||
542 | |||
543 | private static ObservableCollection<MarkupInfoItem> SetDisplayColor(List<MarkupInfoItem> MarkupInfoList, string userID) |
||
544 | { |
||
545 | //var random = new Random(); |
||
546 | ObservableCollection<MarkupInfoItem> _result = new ObservableCollection<MarkupInfoItem>(); |
||
547 | |||
548 | MarkupInfoList.ForEach(delegate (MarkupInfoItem infoitem) |
||
549 | { |
||
550 | if (userID == infoitem.UserID) |
||
551 | { |
||
552 | infoitem.userDelete = true; |
||
553 | infoitem.DisplayColor = "#FFFF0000"; |
||
554 | } |
||
555 | else |
||
556 | { |
||
557 | infoitem.userDelete = false; |
||
558 | |||
559 | #region sample code |
||
560 | |||
561 | //string _ColorStr = "#FF"; |
||
562 | |||
563 | //for (int i = 0; i < infoitem.Depatment.Count(); i++) |
||
564 | //{ |
||
565 | // _ColorStr += Convert.ToByte(infoitem.Depatment[i]); |
||
566 | //} |
||
567 | |||
568 | //if (_ColorStr.Length < 9) |
||
569 | //{ |
||
570 | // for (int i = 0; i < 9 - _ColorStr.Length; i++) |
||
571 | // { |
||
572 | // _ColorStr += "F"; |
||
573 | // } |
||
574 | //} |
||
575 | //else |
||
576 | //{ |
||
577 | // _ColorStr = _ColorStr.Substring(0,9); |
||
578 | //} |
||
579 | //System.Diagnostics.Debug.WriteLine(_ColorStr); |
||
580 | //infoitem.DisplayColor = _ColorStr;// String.Format("#FF{0:X6}", random.Next(0x1000000)); |
||
581 | #endregion |
||
582 | } |
||
583 | |||
584 | _result.Add(infoitem); |
||
585 | }); |
||
586 | |||
587 | return _result; |
||
588 | } |
||
589 | |||
590 | private void BaseClient_GetDocumentItemInfoCompleted(object sender, GetDocumentItemInfoCompletedEventArgs e) |
||
591 | { |
||
592 | if (e.Result != null) |
||
593 | { |
||
594 | _DocItem = e.Result; |
||
595 | |||
596 | if (e.Result.DOCUMENT_NO == "" && e.Result.DOCUMENT_NAME == "" && e.Result.GROUP_NO == "0") |
||
597 | { |
||
598 | //장원 |
||
599 | _ViewInfo.UserID = _ViewInfo.UserID.Replace(@"DAELIM\", ""); |
||
600 | } |
||
601 | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
||
602 | } |
||
603 | else |
||
604 | { |
||
605 | BaseClient.GetCheckSystemAdminCompleted += (sen, ea) => |
||
606 | { |
||
607 | if (ea.Error == null) |
||
608 | { |
||
609 | if (ea.Result) |
||
610 | { |
||
611 | this._ViewInfo.isAdmin = true; |
||
612 | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
||
613 | } |
||
614 | else |
||
615 | { |
||
616 | //System.Windows.Forms.MessageBox.Show("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
617 | DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
618 | //this.ParentOfType<MainPage>().DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
619 | } |
||
620 | |||
621 | } |
||
622 | else |
||
623 | { |
||
624 | //System.Windows.Browser.HtmlPage.Window.Invoke("close"); |
||
625 | } |
||
626 | }; |
||
627 | BaseClient.GetCheckSystemAdminAsync(this._ViewInfo.UserID); |
||
628 | } |
||
629 | } |
||
630 | |||
631 | private void BaseClient_GetSystemDataCompleted(object sender, GetSystemDataCompletedEventArgs e) |
||
632 | { |
||
633 | if (e.Error == null && e.Result != null) |
||
634 | { |
||
635 | App.SystemInfo = e.Result; |
||
636 | |||
637 | //App.urlPort_DB = App.SystemInfo.HostPort; |
||
638 | //App.urlHost_DB = App.SystemInfo.HostName; |
||
639 | |||
640 | BaseClient.GetConversionStateAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
||
641 | |||
642 | //if (App.urlHost.Contains("localhost")) |
||
643 | //{ |
||
644 | // App.urlHost = App.urlHost_DB; |
||
645 | //} |
||
646 | } |
||
647 | } |
||
648 | |||
649 | private void BaseClient_GetConversionStateCompleted(object sender, GetConversionStateCompletedEventArgs e) |
||
650 | { |
||
651 | if (e.Error == null && e.Result != null && e.Result) |
||
652 | { |
||
653 | BaseClient.GetDocumentItemInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID, userID = _ViewInfo.UserID }); |
||
654 | |||
655 | 992a98b4 | KangIngu | if (App.ViewInfo != null && App.ViewInfo.ProjectNO != "") |
656 | 787a4489 | KangIngu | { |
657 | |||
658 | 6c781c0c | djkim | userData = BaseClient.GetMember(App.ViewInfo.ProjectNO, App.ViewInfo.UserID); |
659 | if (userData != null) |
||
660 | 787a4489 | KangIngu | { |
661 | 6c781c0c | djkim | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
662 | 787a4489 | KangIngu | } |
663 | 6c781c0c | djkim | else |
664 | { |
||
665 | userData = new MEMBER(); |
||
666 | userData.DEPARTMENT = "ALL"; |
||
667 | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
||
668 | } |
||
669 | 787a4489 | KangIngu | } |
670 | } |
||
671 | else |
||
672 | { |
||
673 | DialogMessage_Alert("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!" |
||
674 | + "\n\n" + "현재 일시적으로 많은 양의 V/P가 등록되고 있어 이 문서를 열람할 수 없습니다." + "\n" + "잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다", "Warning"); |
||
675 | //System.Windows.Forms.MessageBox.Show("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!" |
||
676 | // + "\n\n" + "현재 일시적으로 많은 양의 V/P가 등록되고 있어 이 문서를 열람할 수 없습니다." + "\n" + "잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다", "Warning"); |
||
677 | //this.ParentOfType<MainPage>().DialogMessage_Alert("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!" |
||
678 | // + "\n\n" + "현재 일시적으로 많은 양의 V/P가 등록되고 있어 이 문서를 열람할 수 없습니다." + "\n" + "잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다", "Warning"); |
||
679 | //System.Windows.Browser.HtmlPage.Window.Invoke("close"); |
||
680 | } |
||
681 | } |
||
682 | 6c781c0c | djkim | |
683 | 787a4489 | KangIngu | |
684 | private void BaseClient_GetDocInfoCompleted(object sender, GetDocInfoCompletedEventArgs e) |
||
685 | { |
||
686 | if (e.Error != null) |
||
687 | { |
||
688 | DialogMessage_Alert("페이지정보를 가져올 수 없습니다.", "Alert"); |
||
689 | return; |
||
690 | } |
||
691 | |||
692 | var MainUrl = DeepZoomUrl.Replace("{baseUrl}", App.SystemInfo.HostName); |
||
693 | MainUrl = MainUrl.Replace("{TileSourcePath}", _ViewInfo.ProjectNO + "_Tile"); |
||
694 | MainUrl = MainUrl.Replace("{ItemsPath}", (Convert.ToInt64(_ViewInfo.DocumentItemID) / 100).ToString()); |
||
695 | MainUrl = MainUrl.Replace("{SharepointItemID}", _ViewInfo.DocumentItemID); |
||
696 | MainUrl = MainUrl.Replace(@"http://http://", @"http://"); |
||
697 | |||
698 | _DocInfo = e.Result; |
||
699 | f38fed51 | KangIngu | foreach (var item in _DocInfo.DOCPAGE.OrderBy(order => order.PAGE_NUMBER)) |
700 | 787a4489 | KangIngu | { |
701 | ViewerDataModel.Instance.Document_Info.Add(item); |
||
702 | } |
||
703 | BaseClient.GetMarkupInfoItemsAsync(_ViewInfo.ProjectNO, _DocInfo.ID); |
||
704 | CurrentDoc = new Common.DocumentSet |
||
705 | { |
||
706 | docInfo = _DocInfo, |
||
707 | Document_Id = _DocInfo.DOCUMENT_ID, |
||
708 | Document_NO = _DocItem.DOCUMENT_NO, |
||
709 | File_Original = _DocInfo.ORIGINAL_FILE, |
||
710 | File_Result = _DocItem.RESULT_FILE, |
||
711 | Group_No = _DocItem.GROUP_NO, |
||
712 | ProjectNo = _DocItem.PROJECT_NO, |
||
713 | Revision = _DocItem.REVISION, |
||
714 | }; |
||
715 | var instanceMain = this.ParentOfType<MainWindow>(); |
||
716 | instanceMain.dzTopMenu.tlcurrentPage.Text = _DocInfo.PAGE_COUNT.ToString(); |
||
717 | 992a98b4 | KangIngu | instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = _DocInfo.PAGE_COUNT.ToString(); |
718 | 4590804a | djkim | string apptitle = string.Format("MARKUS(ver.{2}) - {0}(Rev.{1})", _DocItem.DOCUMENT_NO, _DocItem.REVISION, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); |
719 | d2cd1e16 | djkim | instanceMain.TitleText.Text = apptitle; |
720 | instanceMain.Title = apptitle; |
||
721 | 787a4489 | KangIngu | this.pageNavigator.SetPageNavi(CurrentDoc.docInfo.DOCPAGE.ToList(), MainUrl); |
722 | |||
723 | ViewerDataModel.Instance.MarkupControls_USER.Clear(); |
||
724 | 6707a5c7 | ljiyeon | |
725 | //ViewerDataModel.Instance.SystemMain.dzMainMenu.TempLoad(); |
||
726 | |||
727 | 6c781c0c | djkim | BaseClient.GetVPRevisionHistoryAsync(CurrentDoc.ProjectNo, CurrentDoc.Document_NO, CurrentDoc.Document_Id); |
728 | 787a4489 | KangIngu | } |
729 | |||
730 | |||
731 | public void SetView(ViewInfo info) |
||
732 | { |
||
733 | this._ViewInfo = info; |
||
734 | if (!(App.ViewInfo.ProjectNO == "000000" || App.ViewInfo.ProjectNO == "000001")) |
||
735 | { |
||
736 | ViewerDataModel.Instance.SystemMain.dzTopMenu.btnTopStamp.Visibility = Visibility.Collapsed; |
||
737 | } |
||
738 | BaseClient.GetSystemDataAsync(); |
||
739 | } |
||
740 | |||
741 | 992a98b4 | KangIngu | public void HubSet() |
742 | { |
||
743 | |||
744 | // 허브 연결 구성 |
||
745 | 9a1ce1db | KangIngu | var hubConnection = new HubConnection(global::KCOM.Properties.Settings.Default.HubAddress); |
746 | 992a98b4 | KangIngu | IHubProxy MarkusLicenseProxy = hubConnection.CreateHubProxy("MarkusLicenseHub"); |
747 | |||
748 | |||
749 | // 허브 연결 |
||
750 | hubConnection.Start().ContinueWith(task => |
||
751 | { |
||
752 | if (task.IsFaulted) |
||
753 | { |
||
754 | Console.WriteLine("There was an error opening the connection:{0}", |
||
755 | task.Exception.GetBaseException()); |
||
756 | } |
||
757 | else |
||
758 | { |
||
759 | Console.WriteLine("Connected :: " + task.Id); |
||
760 | } |
||
761 | |||
762 | }).Wait(); |
||
763 | |||
764 | |||
765 | // [ 프로그램 시작 ] |
||
766 | // 클라이언트에서 서버를 호출 ( 접속 시 ) : 라이센스 체크 |
||
767 | //( "method name", arg1, arg2 ) |
||
768 | //MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", "H2009115", "고동균").ContinueWith(task => |
||
769 | //{ |
||
770 | // if (task.IsFaulted) |
||
771 | // { |
||
772 | // Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
773 | // } |
||
774 | // else |
||
775 | // { |
||
776 | // Console.WriteLine(task.Result); |
||
777 | // } |
||
778 | //}); |
||
779 | MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", App.ViewInfo.UserID).ContinueWith(task => |
||
780 | { |
||
781 | if (task.IsFaulted) |
||
782 | { |
||
783 | Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
784 | } |
||
785 | else |
||
786 | { |
||
787 | 53393bae | KangIngu | switch(task.Result) |
788 | 992a98b4 | KangIngu | { |
789 | 53393bae | KangIngu | case "2": |
790 | { |
||
791 | MessageBox.Show("권한이 없습니다."); |
||
792 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
793 | } |
||
794 | break; |
||
795 | case "404": |
||
796 | { |
||
797 | MessageBox.Show("등록된 사용자가 아닙니다."); |
||
798 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
799 | } |
||
800 | break; |
||
801 | 992a98b4 | KangIngu | } |
802 | } |
||
803 | }); |
||
804 | |||
805 | // 서버에서 클라이언트 호출 ( 프로그램 구동여부 ) : 라이센스 체크 후 응답 ( 반환값 : true, false ) |
||
806 | //MarkusLicenseProxy.On<bool>("IsConnection", status => |
||
807 | //{ |
||
808 | |||
809 | // if (status) |
||
810 | // { |
||
811 | // // 프로그램 시작 |
||
812 | // Console.WriteLine("connection status : " + status); |
||
813 | // } |
||
814 | // else |
||
815 | // { |
||
816 | // // 프로그램 종료 ( signalr 접속 끊기 ) |
||
817 | // hubConnection.Stop(); |
||
818 | // } |
||
819 | //}); |
||
820 | |||
821 | // 공지 메세지 ( 서버에서 클라이언트 호출 ) |
||
822 | MarkusLicenseProxy.On<string>("MarkusNotification", msg => |
||
823 | Console.WriteLine("Noficiation Message : " + msg) |
||
824 | ); |
||
825 | |||
826 | |||
827 | // 서버 메서드 호출 |
||
828 | //MarkusLicenseProxy.Invoke<string>("DoSomething", "I'm doing something!!!").Wait(); |
||
829 | |||
830 | //Console.ReadKey(); |
||
831 | |||
832 | //hubConnection.Stop(); |
||
833 | } |
||
834 | 787a4489 | KangIngu | |
835 | } |
||
836 | } |