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