markus / KCOM / Services / BaseServices.cs @ db545833
이력 | 보기 | 이력해설 | 다운로드 (43.1 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 | 036650a0 | humkyung | using MarkupToPDF.Controls.Parsing; |
19 | fddb48f7 | ljiyeon | using Telerik.Windows.Data; |
20 | 90a0bfa9 | djkim | using System.Web; |
21 | 787a4489 | KangIngu | |
22 | namespace KCOM.Views |
||
23 | { |
||
24 | public partial class MainMenu : UserControl, INotifyPropertyChanged |
||
25 | 29010418 | ljiyeon | { |
26 | eb5cdefc | djkim | //const string DeepZoomUrl = @"http://{baseUrl}/TileSource/{TileSourcePath}/{ItemsPath}/{SharepointItemID}/{PageNo}.jpg"; |
27 | 787a4489 | KangIngu | public ServiceDeepViewClient BaseClient; |
28 | public ViewInfo _ViewInfo; |
||
29 | public DOCINFO _DocInfo; |
||
30 | public DOCUMENT_ITEM _DocItem; |
||
31 | public MEMBER userData; |
||
32 | |||
33 | public event PropertyChangedEventHandler PropertyChanged; |
||
34 | private void NotifyPropertyChanged([CallerMemberName] String propertyName = "") |
||
35 | { |
||
36 | if (PropertyChanged != null) |
||
37 | { |
||
38 | PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||
39 | } |
||
40 | } |
||
41 | |||
42 | private Common.DocumentSet _CurrentDoc { get; set; } |
||
43 | public Common.DocumentSet CurrentDoc |
||
44 | { |
||
45 | get |
||
46 | { |
||
47 | return _CurrentDoc; |
||
48 | } |
||
49 | set |
||
50 | { |
||
51 | if (value != CurrentDoc) |
||
52 | { |
||
53 | _CurrentDoc = value; |
||
54 | NotifyPropertyChanged(); |
||
55 | } |
||
56 | } |
||
57 | } |
||
58 | public void ServiceOn() |
||
59 | { |
||
60 | 29010418 | ljiyeon | BaseClient = new ServiceDeepViewClient(App._binding, App._EndPoint); |
61 | |||
62 | 787a4489 | KangIngu | BaseClient.GetDocInfoCompleted += BaseClient_GetDocInfoCompleted; //문서 섬네일, 페이지크기, 마크업 정보 [3] |
63 | 0f065e57 | ljiyeon | BaseClient.GetConversionStateCompleted += BaseClient_GetConversionStateCompleted; //컨버팅의 여부 [2] |
64 | BaseClient.GetSystemDataCompleted += BaseClient_GetSystemDataCompleted; //시스템 정보 [1] |
||
65 | 787a4489 | KangIngu | BaseClient.GetDocumentItemInfoCompleted += BaseClient_GetDocumentItemInfoCompleted; // 문서 자체의 정보 [4] |
66 | 29010418 | ljiyeon | BaseClient.GetMarkupInfoItemsCompleted += BaseClient_GetMarkupInfoItemsCompleted; |
67 | BaseClient.GetDeptDataCompleted += BaseClient_GetDeptDataCompleted; |
||
68 | BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted; |
||
69 | 787a4489 | KangIngu | BaseClient.GetVPRevisionHistoryCompleted += BaseClient_GetVPRevisionHistoryCompleted; |
70 | 29010418 | ljiyeon | BaseClient.SetFinalPDFCompleted += BaseClient_SetFinalPDFCompleted; |
71 | BaseClient.GetCompareRectCompleted += BaseClient_GetCompareRectCompleted; |
||
72 | BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted; |
||
73 | BaseClient.DelFavoriteVPCompleted += BaseClient_DelFavoriteVPCompleted; |
||
74 | BaseClient.EditFavoriteVPCompleted += BaseClient_EditFavoriteVPCompleted; |
||
75 | 992a98b4 | KangIngu | } |
76 | |||
77 | 29010418 | ljiyeon | |
78 | 992a98b4 | KangIngu | |
79 | private void BaseClient_EditFavoriteVPCompleted(object sender, EditFavoriteVPCompletedEventArgs e) |
||
80 | { |
||
81 | 0f065e57 | ljiyeon | Logger.sendResLog("EditFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
82 | |||
83 | 53880c83 | ljiyeon | if (e.Error == null && e.Result != false) |
84 | 992a98b4 | KangIngu | { |
85 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetFavoriteVPAsync", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1); |
86 | 992a98b4 | KangIngu | BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID); |
87 | } |
||
88 | else |
||
89 | { |
||
90 | DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning"); |
||
91 | } |
||
92 | } |
||
93 | |||
94 | private void BaseClient_DelFavoriteVPCompleted(object sender, DelFavoriteVPCompletedEventArgs e) |
||
95 | { |
||
96 | 0f065e57 | ljiyeon | Logger.sendResLog("DelFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
97 | |||
98 | 53880c83 | ljiyeon | if (e.Error == null && e.Result != false) |
99 | 992a98b4 | KangIngu | { |
100 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetFavoriteVPAsync", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1); |
101 | 992a98b4 | KangIngu | BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID); |
102 | } |
||
103 | else |
||
104 | { |
||
105 | DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning"); |
||
106 | } |
||
107 | 787a4489 | KangIngu | } |
108 | |||
109 | 9294fed6 | humkyung | /// <summary> |
110 | /// Compare 결과를 받아 화면에 표시한다 |
||
111 | /// </summary> |
||
112 | /// <param name="sender"></param> |
||
113 | /// <param name="e"></param> |
||
114 | 787a4489 | KangIngu | private void BaseClient_GetCompareRectCompleted(object sender, GetCompareRectCompletedEventArgs e) |
115 | { |
||
116 | if (e.Error != null || e.Result == null) |
||
117 | { |
||
118 | 9294fed6 | humkyung | if (e.Error != null) |
119 | { |
||
120 | DialogMessage_Alert(e.Error.ToString(), "Error"); |
||
121 | } |
||
122 | else |
||
123 | { |
||
124 | DialogMessage_Alert("Compare 기능을 원활히 실행하기 위한 데이터가 부족합니다", "안내"); |
||
125 | } |
||
126 | 787a4489 | KangIngu | } |
127 | else |
||
128 | { |
||
129 | e.Result.ForEach(d => |
||
130 | { |
||
131 | d.Width = d.Width * 3; |
||
132 | d.Height = d.Height * 3; |
||
133 | var point = MarkupToPDF.Controls.Common.MathSet.getRectMiddlePoint(d); |
||
134 | System.Windows.Shapes.Ellipse myEllipse = new System.Windows.Shapes.Ellipse(); |
||
135 | myEllipse.Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red); |
||
136 | myEllipse.Opacity = 1; |
||
137 | myEllipse.Width = d.Width; |
||
138 | myEllipse.Height = d.Height; |
||
139 | Canvas.SetLeft(myEllipse, d.X - ((point.X - d.X) / 2.0)); |
||
140 | Canvas.SetTop(myEllipse, d.Y - ((point.Y - d.Y) / 2.0)); |
||
141 | myEllipse.RenderTransformOrigin = point; |
||
142 | canvas_compareBorder.Children.Add(myEllipse); |
||
143 | }); |
||
144 | |||
145 | da.From = 0.8; |
||
146 | da.To = 0; |
||
147 | da.Duration = new Duration(TimeSpan.FromSeconds(1)); |
||
148 | da.AutoReverse = true; |
||
149 | canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
||
150 | } |
||
151 | } |
||
152 | |||
153 | private void BaseClient_SetFinalPDFCompleted(object sender, SetFinalPDFCompletedEventArgs e) |
||
154 | { |
||
155 | 0f065e57 | ljiyeon | Logger.sendResLog("SetFinalPDFCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
156 | 84c48033 | djkim | string errormsg = CommonLib.Common.GetAlertMessageString("SetFinalPDFError", "MSG", "최종 파일을 만드는데 문제가 발생하였습니다"); |
157 | string successmsg = CommonLib.Common.GetAlertMessageString("SetFinalPDFSuccess", "MSG", "최종 파일 생성 중입니다. 문서관리시스템을 확인해주세요"); |
||
158 | 29010418 | ljiyeon | if (e.Error != null || e.Result.Status == FinalStatus.Error) |
159 | 787a4489 | KangIngu | { |
160 | 84c48033 | djkim | DialogMessage_Alert(errormsg, "안내"); |
161 | 787a4489 | KangIngu | } |
162 | else |
||
163 | { |
||
164 | 84c48033 | djkim | DialogMessage_Alert(successmsg, "안내"); |
165 | 787a4489 | KangIngu | } |
166 | } |
||
167 | |||
168 | private void BaseClient_GetVPRevisionHistoryCompleted(object sender, GetVPRevisionHistoryCompletedEventArgs e) |
||
169 | { |
||
170 | 0f065e57 | ljiyeon | Logger.sendResLog("GetVPRevisionHistoryCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
171 | |||
172 | 787a4489 | KangIngu | if (e.Result != null && e.Error == null) |
173 | { |
||
174 | 90a0bfa9 | djkim | List<VPRevision> list = e.Result; |
175 | foreach (var item in list) |
||
176 | { |
||
177 | 24ac2a04 | taeseongkim | |
178 | if (App.isExternal) |
||
179 | { |
||
180 | var sBaseServiceURL = CommonLib.Common.GetConfigString("BaseClientAddress", "URL", "", App.isExternal); |
||
181 | |||
182 | db545833 | taeseongkim | if (!string.IsNullOrWhiteSpace(item.TO_VENDOR)) |
183 | { |
||
184 | var toUri = new Uri(HttpUtility.UrlDecode(item.TO_VENDOR)); |
||
185 | item.TO_VENDOR = $"{sBaseServiceURL}{toUri.LocalPath}"; |
||
186 | } |
||
187 | |||
188 | if (!string.IsNullOrWhiteSpace(item.FROM_VENDOR)) |
||
189 | { |
||
190 | var fromUri = new Uri(HttpUtility.UrlDecode(item.FROM_VENDOR)); |
||
191 | item.FROM_VENDOR = $"{sBaseServiceURL}{fromUri.LocalPath}"; |
||
192 | } |
||
193 | 24ac2a04 | taeseongkim | } |
194 | else |
||
195 | { |
||
196 | |||
197 | item.FROM_VENDOR = HttpUtility.UrlDecode(item.FROM_VENDOR); |
||
198 | } |
||
199 | 90a0bfa9 | djkim | } |
200 | gridViewHistory.ItemsSource = list; |
||
201 | 787a4489 | KangIngu | } |
202 | f9fb5500 | ljiyeon | //TempFile.TempLoad(); |
203 | 787a4489 | KangIngu | } |
204 | |||
205 | private void BaseClient_DeleteMarkupCompleted(object sender, DeleteMarkupCompletedEventArgs e) |
||
206 | { |
||
207 | 0f065e57 | ljiyeon | Logger.sendResLog("DeleteMarkupCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
208 | |||
209 | d128ceb2 | humkyung | foreach(var info in ViewerDataModel.Instance._markupInfoList) |
210 | { |
||
211 | if(info.UserID == App.ViewInfo.UserID) |
||
212 | { |
||
213 | info.userDelete = true; |
||
214 | info.DisplayColor = "FFFF0000"; |
||
215 | } |
||
216 | else |
||
217 | { |
||
218 | info.userDelete = false; |
||
219 | } |
||
220 | } |
||
221 | 787a4489 | KangIngu | } |
222 | |||
223 | private void BaseClient_GetDeptDataCompleted(object sender, GetDeptDataCompletedEventArgs e) |
||
224 | { |
||
225 | 0f065e57 | ljiyeon | Logger.sendResLog("GetDeptDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
226 | |||
227 | 787a4489 | KangIngu | if (e.Result != null) |
228 | { |
||
229 | e.Result.Sort(); |
||
230 | //cbSymbolPublic.ItemsSource = e.Result.ToList(); |
||
231 | } |
||
232 | } |
||
233 | 29010418 | ljiyeon | public MarkupInfoItem PreviewUserMarkupInfoItem { get; set; } |
234 | 787a4489 | KangIngu | |
235 | 35a96e24 | humkyung | /// <summary> |
236 | d62c0439 | humkyung | /// 문서 정보를 가져온다 |
237 | /// </summary> |
||
238 | /// <param name="sender"></param> |
||
239 | /// <param name="e"></param> |
||
240 | private void BaseClient_GetDocInfoCompleted(object sender, GetDocInfoCompletedEventArgs e) |
||
241 | { |
||
242 | Logger.sendResLog("GetDocInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
243 | |||
244 | if (e.Error != null) |
||
245 | { |
||
246 | DialogMessage_Alert("페이지정보를 가져올 수 없습니다.", "Alert"); |
||
247 | return; |
||
248 | } |
||
249 | |||
250 | ff01c725 | humkyung | string sFolder = _ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToUInt32(_ViewInfo.DocumentItemID) / 100).ToString() : (_ViewInfo.DocumentItemID.Length >= 5 ? _ViewInfo.DocumentItemID.Substring(0, 5) : _ViewInfo.DocumentItemID); |
251 | var MainUrl = string.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal).Replace("png","jpg"), _ViewInfo.ProjectNO, sFolder, _ViewInfo.DocumentItemID, "{PageNo}"); |
||
252 | d62c0439 | humkyung | _DocInfo = e.Result; |
253 | 90a0bfa9 | djkim | _DocInfo.ORIGINAL_FILE = HttpUtility.UrlDecode(_DocInfo.ORIGINAL_FILE); |
254 | d62c0439 | humkyung | foreach (var item in _DocInfo.DOCPAGE.OrderBy(order => order.PAGE_NUMBER)) |
255 | { |
||
256 | ViewerDataModel.Instance.Document_Info.Add(item); |
||
257 | } |
||
258 | Logger.sendReqLog("GetMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID, 1); |
||
259 | BaseClient.GetMarkupInfoItemsAsync(_ViewInfo.ProjectNO, _DocInfo.ID); |
||
260 | CurrentDoc = new Common.DocumentSet |
||
261 | { |
||
262 | docInfo = _DocInfo, |
||
263 | Document_Id = _DocInfo.DOCUMENT_ID, |
||
264 | Document_NO = _DocItem.DOCUMENT_NO, |
||
265 | File_Original = _DocInfo.ORIGINAL_FILE, |
||
266 | File_Result = _DocItem.RESULT_FILE, |
||
267 | Group_No = _DocItem.GROUP_NO, |
||
268 | ProjectNo = _DocItem.PROJECT_NO, |
||
269 | Revision = _DocItem.REVISION, |
||
270 | }; |
||
271 | var instanceMain = this.ParentOfType<MainWindow>(); |
||
272 | 944be2fa | djkim | string firstpage = "1"; |
273 | string lastpage = _DocInfo.PAGE_COUNT.ToString(); |
||
274 | instanceMain.dzTopMenu.tlcurrentPage.Text = firstpage; |
||
275 | instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = lastpage; |
||
276 | d62c0439 | humkyung | string apptitle = string.Format("MARKUS(ver.{2}) - {0}(Rev.{1})", _DocItem.DOCUMENT_NO, _DocItem.REVISION, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); |
277 | instanceMain.TitleText.Text = apptitle; |
||
278 | instanceMain.Title = apptitle; |
||
279 | this.pageNavigator.SetPageNavi(CurrentDoc.docInfo.DOCPAGE.ToList(), MainUrl); |
||
280 | |||
281 | ViewerDataModel.Instance.MarkupControls_USER.Clear(); |
||
282 | |||
283 | //ViewerDataModel.Instance.SystemMain.dzMainMenu.TempLoad(); |
||
284 | |||
285 | 6af42ff0 | taeseongkim | #region 단어 검색용 파일 다운로드 |
286 | |||
287 | var task = DownloadOriginalFileAsync(); |
||
288 | task.ConfigureAwait(false); |
||
289 | |||
290 | #endregion |
||
291 | |||
292 | d62c0439 | humkyung | Logger.sendReqLog("GetVPRevisionHistoryAsync", CurrentDoc.ProjectNo + "," + CurrentDoc.Document_NO + "," + CurrentDoc.Document_Id, 1); |
293 | 6af42ff0 | taeseongkim | BaseClient.GetVPRevisionHistoryAsync(CurrentDoc.ProjectNo, CurrentDoc.Document_NO, CurrentDoc.Document_Id); |
294 | |||
295 | d62c0439 | humkyung | } |
296 | |||
297 | /// <summary> |
||
298 | 35a96e24 | humkyung | /// get markupinfo and markupitem from database |
299 | a36a37c3 | humkyung | /// - 1. called when document is loaded |
300 | /// - 2. called when user do consolidation |
||
301 | 35a96e24 | humkyung | /// </summary> |
302 | /// <param name="sender"></param> |
||
303 | /// <param name="e"></param> |
||
304 | 787a4489 | KangIngu | private void BaseClient_GetMarkupInfoItemsCompleted(object sender, GetMarkupInfoItemsCompletedEventArgs e) |
305 | { |
||
306 | 0f065e57 | ljiyeon | Logger.sendResLog("GetMarkupInfoItemsCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
307 | |||
308 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Clear(); |
309 | ViewerDataModel.Instance.MarkupControls.Clear(); |
||
310 | if (e.Result != null) |
||
311 | { |
||
312 | d128ceb2 | humkyung | ViewerDataModel.Instance._markupInfoList.Clear(); |
313 | 3ffd4b2d | humkyung | if (e.Result.Count > 0) ViewerDataModel.Instance.MyMarkupList.Clear(); |
314 | 787a4489 | KangIngu | |
315 | d128ceb2 | humkyung | foreach(var info in e.Result) |
316 | { |
||
317 | if (info.UserID == App.ViewInfo.UserID) |
||
318 | { |
||
319 | info.userDelete = true; |
||
320 | info.DisplayColor = "#FFFF0000"; |
||
321 | } |
||
322 | else |
||
323 | { |
||
324 | info.userDelete = false; |
||
325 | } |
||
326 | ViewerDataModel.Instance._markupInfoList.Add(info); |
||
327 | } |
||
328 | |||
329 | a36a37c3 | humkyung | e.Result.ToList().ForEach(d => d.MarkupList.ForEach(p => |
330 | 787a4489 | KangIngu | { |
331 | 29010418 | ljiyeon | if (d.UserID == App.ViewInfo.UserID) |
332 | 787a4489 | KangIngu | { |
333 | d.userDelete = true; |
||
334 | d.DisplayColor = "#FFFF0000"; |
||
335 | |||
336 | 35a96e24 | humkyung | MarkupItemEx markup = new MarkupItemEx |
337 | 787a4489 | KangIngu | { |
338 | Data = p.Data, |
||
339 | Data_Type = p.Data_Type, |
||
340 | ID = p.ID, |
||
341 | IsUpdate = false, |
||
342 | MarkupInfoID = d.MarkupInfoID, |
||
343 | PageNumber = p.PageNumber, |
||
344 | c8e9b3e4 | ljiyeon | Symbol_ID = p.Symbol_ID, |
345 | c0977e97 | djkim | //Group_ID = p.Group_ID |
346 | 35a96e24 | humkyung | }; |
347 | d62c0439 | humkyung | ViewerDataModel.Instance.MyMarkupList.Add(markup); |
348 | 787a4489 | KangIngu | } |
349 | else |
||
350 | { |
||
351 | 35a96e24 | humkyung | MarkupItemEx markup = new MarkupItemEx |
352 | 787a4489 | KangIngu | { |
353 | Data = p.Data, |
||
354 | Data_Type = p.Data_Type, |
||
355 | ID = p.ID, |
||
356 | IsUpdate = false, |
||
357 | MarkupInfoID = d.MarkupInfoID, |
||
358 | PageNumber = p.PageNumber, |
||
359 | c8e9b3e4 | ljiyeon | Symbol_ID = p.Symbol_ID, |
360 | c0977e97 | djkim | //Group_ID = p.Group_ID |
361 | 35a96e24 | humkyung | }; |
362 | ViewerDataModel.Instance.MarkupList_Pre.Add(markup); |
||
363 | 787a4489 | KangIngu | } |
364 | })); |
||
365 | |||
366 | a36a37c3 | humkyung | var currentUser = e.Result.Where(data => data.UserID == App.ViewInfo.UserID && data.AvoidConsolidate == 0).FirstOrDefault(); |
367 | 787a4489 | KangIngu | if (currentUser == null) |
368 | { |
||
369 | a36a37c3 | humkyung | /// create a new markupinfo to do comments |
370 | 24678e06 | humkyung | var infoId = Commons.shortGuid(); |
371 | 787a4489 | KangIngu | PreviewUserMarkupInfoItem = new MarkupInfoItem |
372 | { |
||
373 | CreateTime = DateTime.Now, |
||
374 | 073f6118 | djkim | UpdateTime = DateTime.Now, |
375 | 787a4489 | KangIngu | Depatment = userData.DEPARTMENT, |
376 | DisplayColor = "#FFFF0000", |
||
377 | UserID = userData.ID, |
||
378 | UserName = userData.NAME, |
||
379 | PageCount = 1, |
||
380 | Description = "", |
||
381 | MarkupInfoID = infoId, |
||
382 | MarkupList = null, |
||
383 | 24678e06 | humkyung | MarkupVersionID = Commons.shortGuid(), |
384 | 787a4489 | KangIngu | Consolidate = 0, |
385 | PartConsolidate = 0, |
||
386 | userDelete = true, |
||
387 | AvoidConsolidate = 0, |
||
388 | 8129f2a5 | ljiyeon | IsPreviewUser = false |
389 | 787a4489 | KangIngu | }; |
390 | |||
391 | App.Custom_ViewInfoId = infoId; |
||
392 | 8129f2a5 | ljiyeon | |
393 | ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem); |
||
394 | 787a4489 | KangIngu | } |
395 | else |
||
396 | { |
||
397 | App.Custom_ViewInfoId = currentUser.MarkupInfoID; |
||
398 | } |
||
399 | |||
400 | a36a37c3 | humkyung | foreach(var info in e.Result) |
401 | d128ceb2 | humkyung | { |
402 | if (info.UserID == App.ViewInfo.UserID) info.DisplayColor = "#FFFF0000"; |
||
403 | } |
||
404 | 787a4489 | KangIngu | |
405 | 3ffd4b2d | humkyung | ViewerDataModel.Instance.PageNumber = 1; |
406 | |||
407 | a36a37c3 | humkyung | /// Consolidation 된 데이터가 최상단에 올 수 있도록 변경 |
408 | 35a96e24 | humkyung | var markupItem = ViewerDataModel.Instance._markupInfoList.OrderByDescending(p => p.Consolidate == Convert.ToInt32(true)).ToList(); |
409 | 787a4489 | KangIngu | markupItem.ForEach(data => |
410 | { |
||
411 | 35a96e24 | humkyung | if (data.Depatment == null) data.Depatment = "Unknown"; |
412 | 787a4489 | KangIngu | }); |
413 | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
||
414 | 29010418 | ljiyeon | SetCommentPages(); |
415 | 992a98b4 | KangIngu | |
416 | a36a37c3 | humkyung | var SelectedItem = ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == App.ViewInfo.UserID).OrderByDescending(order => order.UpdateTime).FirstOrDefault(); |
417 | this.gridViewMarkup.SelectedItem = (PreviewUserMarkupInfoItem != null) ? PreviewUserMarkupInfoItem : SelectedItem; |
||
418 | 073f6118 | djkim | |
419 | a36a37c3 | humkyung | /// create a group descriptor |
420 | fddb48f7 | ljiyeon | gridViewMarkup.GroupDescriptors.Clear(); |
421 | GroupDescriptor descriptor = new GroupDescriptor(); |
||
422 | descriptor.Member = "Depatment"; |
||
423 | descriptor.DisplayContent = "DEPT"; |
||
424 | dd0f7089 | djkim | //descriptor.SortDirection = ListSortDirection.Ascending; |
425 | fddb48f7 | ljiyeon | gridViewMarkup.GroupDescriptors.Add(descriptor); |
426 | a36a37c3 | humkyung | /// up to here |
427 | 787a4489 | KangIngu | } |
428 | } |
||
429 | |||
430 | private void gridViewRevMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
||
431 | { |
||
432 | List<MarkupInfoItem> gridSelectionItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
433 | //if (ViewerDataModel.Instance.PageBalanceNumber == 0) |
||
434 | //{ |
||
435 | // ViewerDataModel.Instance.PageBalanceNumber = 1; |
||
436 | //} |
||
437 | |||
438 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
439 | { |
||
440 | ViewerDataModel.Instance.PageNumber = 1; |
||
441 | } |
||
442 | if (e.AddedItems.Count() > 0) |
||
443 | { |
||
444 | foreach (var item in gridSelectionItem) |
||
445 | { |
||
446 | //item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageBalanceNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
447 | //{ |
||
448 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
||
449 | //}); |
||
450 | item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
451 | { |
||
452 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
453 | 787a4489 | KangIngu | }); |
454 | } |
||
455 | } |
||
456 | else if (e.RemovedItems.Count > 0) |
||
457 | { |
||
458 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
459 | |||
460 | (from A in _infoItem |
||
461 | from B in Common.ViewerDataModel.Instance.MarkupControls_Sync |
||
462 | where A.MarkupInfoID == B.MarkupInfoID |
||
463 | select B).ToList().ForEach(data => |
||
464 | { |
||
465 | Common.ViewerDataModel.Instance.MarkupControls_Sync.Remove(data); |
||
466 | }); |
||
467 | } |
||
468 | } |
||
469 | e7dd7ae8 | humkyung | |
470 | /// <summary> |
||
471 | /// 선택한 항목은 Visibility = Visible, 해제한 항목은 Visibility = Hidden 처리한다. |
||
472 | /// </summary> |
||
473 | /// <param name="sender"></param> |
||
474 | /// <param name="e"></param> |
||
475 | 787a4489 | KangIngu | private void gridViewMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) |
476 | { |
||
477 | 2089959a | taeseongkim | SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu); |
478 | |||
479 | 787a4489 | KangIngu | var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
480 | var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID); |
||
481 | var resultA = (from item_Select in dataSet |
||
482 | from item_Non in dataSet_User |
||
483 | where item_Select == item_Non |
||
484 | select item_Non).ToList(); |
||
485 | |||
486 | if (resultA.Count() >= 2) |
||
487 | { |
||
488 | RadWindow.Confirm(new DialogParameters |
||
489 | { |
||
490 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
491 | 787a4489 | KangIngu | Header = "안내", |
492 | Content = "동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요?", |
||
493 | Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) => |
||
494 | { |
||
495 | if (e.AddedItems.Count() == 1) |
||
496 | { |
||
497 | MarkupInfoItem instanceItem = e.AddedItems.FirstOrDefault() as MarkupInfoItem; |
||
498 | 8ab0d0b1 | 송근호 | gridViewMarkup.SelectedItem = null; |
499 | 787a4489 | KangIngu | |
500 | 8ab0d0b1 | 송근호 | |
501 | 787a4489 | KangIngu | if (ea.DialogResult.Value) |
502 | { |
||
503 | 8ab0d0b1 | 송근호 | if (instanceItem.Consolidate == 1 || instanceItem.PartConsolidate == 1) |
504 | { |
||
505 | gridViewMarkup.SelectedItem = instanceItem; |
||
506 | } |
||
507 | else |
||
508 | { |
||
509 | //1. Consolidations이 있다면 하나 선택 |
||
510 | var Consolidations = resultA.Where(item => (item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
511 | |||
512 | if (Consolidations.Count() > 0) |
||
513 | { |
||
514 | gridViewMarkup.SelectedItem = Consolidations.First(); |
||
515 | } |
||
516 | } |
||
517 | |||
518 | 787a4489 | KangIngu | } |
519 | 8ab0d0b1 | 송근호 | else { |
520 | //1. Consolidations 아닌게 있다면 Change |
||
521 | var notConsolidations = resultA.Where(item => !(item.Consolidate == 1 || item.PartConsolidate == 1)); |
||
522 | |||
523 | if(notConsolidations.Count() > 0) { |
||
524 | gridViewMarkup.SelectedItem = notConsolidations.First(); |
||
525 | } |
||
526 | else {//1. Consolidations 아닌게 없다면 그대로 |
||
527 | gridViewMarkup.SelectedItem = instanceItem; |
||
528 | } |
||
529 | |||
530 | 787a4489 | KangIngu | } |
531 | } |
||
532 | }), |
||
533 | Theme = new Windows8Theme(), |
||
534 | ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 }, |
||
535 | }); |
||
536 | } |
||
537 | else //파라미터로 넘어온 사용자가 걸리지 않은 경우 |
||
538 | { |
||
539 | 6b5d33c6 | djkim | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
540 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
541 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
542 | #region 코멘트 보기 |
||
543 | if (e.AddedItems.Count() > 0) |
||
544 | { |
||
545 | foreach (var item in gridSelectionItem) |
||
546 | { |
||
547 | 3ffd4b2d | humkyung | if (item.UserID == App.ViewInfo.UserID) |
548 | 6b5d33c6 | djkim | { |
549 | 101da246 | humkyung | var controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
550 | if (controls.Count == 0) |
||
551 | 6b5d33c6 | djkim | { |
552 | 129ca191 | humkyung | var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
553 | 6b5d33c6 | djkim | foreach (var markup in instance) |
554 | { |
||
555 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", |
556 | item.MarkupInfoID, markup.ID); |
||
557 | 6b5d33c6 | djkim | } |
558 | } |
||
559 | 101da246 | humkyung | |
560 | controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
561 | foreach (var control in controls) |
||
562 | 6b5d33c6 | djkim | { |
563 | d62c0439 | humkyung | Logger.sendCheckLog(String.Format("=={0}", control), 1); |
564 | 101da246 | humkyung | control.Visibility = Visibility.Visible; |
565 | 6b5d33c6 | djkim | } |
566 | } |
||
567 | 3ffd4b2d | humkyung | else |
568 | 6b5d33c6 | djkim | { |
569 | 101da246 | humkyung | var controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
570 | if (controls.Count == 0) |
||
571 | { |
||
572 | 129ca191 | humkyung | var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList(); |
573 | 101da246 | humkyung | foreach (var markup in instance) |
574 | { |
||
575 | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", |
||
576 | item.MarkupInfoID, markup.ID); |
||
577 | } |
||
578 | } |
||
579 | |||
580 | controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList(); |
||
581 | foreach (var control in controls) |
||
582 | 6b5d33c6 | djkim | { |
583 | e7dd7ae8 | humkyung | control.Visibility = Visibility.Visible; |
584 | 6b5d33c6 | djkim | } |
585 | } |
||
586 | } |
||
587 | } |
||
588 | #endregion |
||
589 | #region 코멘트 숨기기 |
||
590 | else if (e.RemovedItems.Count > 0) |
||
591 | { |
||
592 | var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList(); |
||
593 | |||
594 | (from A in _infoItem |
||
595 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
596 | where A.MarkupInfoID == B.MarkupInfoID |
||
597 | select B).ToList().ForEach(data => |
||
598 | { |
||
599 | b5ac6d6e | ljiyeon | data.Visibility = Visibility.Hidden; |
600 | 6b5d33c6 | djkim | }); |
601 | |||
602 | b5ac6d6e | ljiyeon | |
603 | 6b5d33c6 | djkim | var myComment = _infoItem.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault(); |
604 | if (myComment != null) |
||
605 | { |
||
606 | Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem) |
||
607 | { |
||
608 | e7dd7ae8 | humkyung | markupitem.Visibility = Visibility.Hidden; |
609 | 6b5d33c6 | djkim | }); |
610 | } |
||
611 | } |
||
612 | #endregion |
||
613 | 787a4489 | KangIngu | } |
614 | } |
||
615 | |||
616 | private void BaseClient_GetDocumentItemInfoCompleted(object sender, GetDocumentItemInfoCompletedEventArgs e) |
||
617 | { |
||
618 | 0f065e57 | ljiyeon | Logger.sendResLog("GetDocumentItemInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
619 | |||
620 | 787a4489 | KangIngu | if (e.Result != null) |
621 | { |
||
622 | _DocItem = e.Result; |
||
623 | |||
624 | if (e.Result.DOCUMENT_NO == "" && e.Result.DOCUMENT_NAME == "" && e.Result.GROUP_NO == "0") |
||
625 | { |
||
626 | //장원 |
||
627 | _ViewInfo.UserID = _ViewInfo.UserID.Replace(@"DAELIM\", ""); |
||
628 | } |
||
629 | 29010418 | ljiyeon | Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
630 | 787a4489 | KangIngu | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
631 | } |
||
632 | else |
||
633 | { |
||
634 | BaseClient.GetCheckSystemAdminCompleted += (sen, ea) => |
||
635 | { |
||
636 | 0f065e57 | ljiyeon | Logger.sendResLog("GetCheckSystemAdminCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
637 | |||
638 | 787a4489 | KangIngu | if (ea.Error == null) |
639 | { |
||
640 | if (ea.Result) |
||
641 | { |
||
642 | this._ViewInfo.isAdmin = true; |
||
643 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
644 | 787a4489 | KangIngu | BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
645 | } |
||
646 | else |
||
647 | { |
||
648 | //System.Windows.Forms.MessageBox.Show("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
649 | DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
650 | //this.ParentOfType<MainPage>().DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내"); |
||
651 | } |
||
652 | |||
653 | } |
||
654 | else |
||
655 | { |
||
656 | //System.Windows.Browser.HtmlPage.Window.Invoke("close"); |
||
657 | } |
||
658 | }; |
||
659 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetCheckSystemAdminAsync", _ViewInfo.UserID, 1); |
660 | 787a4489 | KangIngu | BaseClient.GetCheckSystemAdminAsync(this._ViewInfo.UserID); |
661 | } |
||
662 | } |
||
663 | |||
664 | private void BaseClient_GetSystemDataCompleted(object sender, GetSystemDataCompletedEventArgs e) |
||
665 | { |
||
666 | 0f065e57 | ljiyeon | Logger.sendResLog("GetSystemDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
667 | |||
668 | 787a4489 | KangIngu | if (e.Error == null && e.Result != null) |
669 | { |
||
670 | App.SystemInfo = e.Result; |
||
671 | |||
672 | //App.urlPort_DB = App.SystemInfo.HostPort; |
||
673 | //App.urlHost_DB = App.SystemInfo.HostName; |
||
674 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetConversionStateAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1); |
675 | 787a4489 | KangIngu | BaseClient.GetConversionStateAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID }); |
676 | |||
677 | //if (App.urlHost.Contains("localhost")) |
||
678 | //{ |
||
679 | // App.urlHost = App.urlHost_DB; |
||
680 | //} |
||
681 | } |
||
682 | } |
||
683 | |||
684 | private void BaseClient_GetConversionStateCompleted(object sender, GetConversionStateCompletedEventArgs e) |
||
685 | { |
||
686 | 84c48033 | djkim | |
687 | 0f065e57 | ljiyeon | Logger.sendResLog("GetConversionStateCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
688 | 84c48033 | djkim | 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잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다"); |
689 | 53880c83 | ljiyeon | if (e.Error == null && e.Result == true) |
690 | 787a4489 | KangIngu | { |
691 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetDocumentItemInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + _ViewInfo.UserID, 1); |
692 | |||
693 | 787a4489 | KangIngu | BaseClient.GetDocumentItemInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID, userID = _ViewInfo.UserID }); |
694 | |||
695 | 992a98b4 | KangIngu | if (App.ViewInfo != null && App.ViewInfo.ProjectNO != "") |
696 | 787a4489 | KangIngu | { |
697 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetMember", _ViewInfo.ProjectNO + "," + _ViewInfo.UserID, 1); |
698 | 6c781c0c | djkim | userData = BaseClient.GetMember(App.ViewInfo.ProjectNO, App.ViewInfo.UserID); |
699 | if (userData != null) |
||
700 | 787a4489 | KangIngu | { |
701 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1); |
702 | 6c781c0c | djkim | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
703 | 787a4489 | KangIngu | } |
704 | 6c781c0c | djkim | else |
705 | { |
||
706 | userData = new MEMBER(); |
||
707 | userData.DEPARTMENT = "ALL"; |
||
708 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1); |
709 | 6c781c0c | djkim | BaseClient.GetDeptDataAsync(userData.DEPARTMENT); |
710 | 29010418 | ljiyeon | } |
711 | 787a4489 | KangIngu | } |
712 | } |
||
713 | else |
||
714 | { |
||
715 | 84c48033 | djkim | |
716 | DialogMessage_Alert(failedmsg, "Warning"); |
||
717 | 787a4489 | KangIngu | } |
718 | } |
||
719 | 29010418 | ljiyeon | |
720 | 787a4489 | KangIngu | public void SetView(ViewInfo info) |
721 | 5a6493ad | humkyung | { |
722 | 787a4489 | KangIngu | this._ViewInfo = info; |
723 | 5a6493ad | humkyung | try |
724 | 5ded1e5a | djkim | { |
725 | 5a6493ad | humkyung | /// 대림의 경우 EnsembleID를 가지고 DocumentItemID를 구함 |
726 | /// 다른 Site를 대비하여 에러 처리함 |
||
727 | string docid = BaseClient.GetDocItemID(info.EnsembleID); |
||
728 | if (!string.IsNullOrEmpty(docid)) |
||
729 | { |
||
730 | this._ViewInfo.DocumentItemID = docid; |
||
731 | } |
||
732 | 5ded1e5a | djkim | } |
733 | 5a6493ad | humkyung | catch(Exception ex) |
734 | { |
||
735 | App.FileLogger.Fatal(ex); |
||
736 | } |
||
737 | |||
738 | 5ded1e5a | djkim | Logger.sendReqLog("GetSystemDataAsync", "", 1); |
739 | 29010418 | ljiyeon | BaseClient.GetSystemDataAsync(); |
740 | 787a4489 | KangIngu | } |
741 | |||
742 | 992a98b4 | KangIngu | public void HubSet() |
743 | { |
||
744 | // 허브 연결 구성 |
||
745 | 84c48033 | djkim | var hubConnection = new HubConnection(CommonLib.Common.GetConfigString("HubAddress", "URL", "", App.isExternal)); |
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 | 53f96e00 | 송근호 | //throw task.Exception.GetBaseException(); |
757 | 992a98b4 | KangIngu | } |
758 | else |
||
759 | { |
||
760 | Console.WriteLine("Connected :: " + task.Id); |
||
761 | } |
||
762 | |||
763 | }).Wait(); |
||
764 | |||
765 | |||
766 | // [ 프로그램 시작 ] |
||
767 | // 클라이언트에서 서버를 호출 ( 접속 시 ) : 라이센스 체크 |
||
768 | //( "method name", arg1, arg2 ) |
||
769 | //MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", "H2009115", "고동균").ContinueWith(task => |
||
770 | //{ |
||
771 | // if (task.IsFaulted) |
||
772 | // { |
||
773 | // Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
774 | // } |
||
775 | // else |
||
776 | // { |
||
777 | // Console.WriteLine(task.Result); |
||
778 | // } |
||
779 | //}); |
||
780 | 0af41bf0 | djkim | MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", App.ViewInfo.UserID,App.ViewInfo.ProjectNO).ContinueWith(task => |
781 | 992a98b4 | KangIngu | { |
782 | if (task.IsFaulted) |
||
783 | { |
||
784 | Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException()); |
||
785 | 53f96e00 | 송근호 | //throw task.Exception.GetBaseException(); |
786 | 992a98b4 | KangIngu | } |
787 | else |
||
788 | { |
||
789 | 29010418 | ljiyeon | switch (task.Result) |
790 | 992a98b4 | KangIngu | { |
791 | 53393bae | KangIngu | case "2": |
792 | { |
||
793 | 0af41bf0 | djkim | var result = MessageBox.Show("권한이 없습니다."); |
794 | if (result == MessageBoxResult.OK) |
||
795 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
796 | 53393bae | KangIngu | } |
797 | break; |
||
798 | case "404": |
||
799 | { |
||
800 | 0af41bf0 | djkim | var result = MessageBox.Show("등록된 사용자가 아닙니다."); |
801 | if(result == MessageBoxResult.OK) |
||
802 | System.Diagnostics.Process.GetCurrentProcess().Kill(); |
||
803 | 53393bae | KangIngu | } |
804 | break; |
||
805 | 992a98b4 | KangIngu | } |
806 | } |
||
807 | 53f96e00 | 송근호 | }); |
808 | 992a98b4 | KangIngu | |
809 | // 서버에서 클라이언트 호출 ( 프로그램 구동여부 ) : 라이센스 체크 후 응답 ( 반환값 : true, false ) |
||
810 | //MarkusLicenseProxy.On<bool>("IsConnection", status => |
||
811 | //{ |
||
812 | |||
813 | // if (status) |
||
814 | // { |
||
815 | // // 프로그램 시작 |
||
816 | // Console.WriteLine("connection status : " + status); |
||
817 | // } |
||
818 | // else |
||
819 | // { |
||
820 | // // 프로그램 종료 ( signalr 접속 끊기 ) |
||
821 | // hubConnection.Stop(); |
||
822 | // } |
||
823 | //}); |
||
824 | |||
825 | // 공지 메세지 ( 서버에서 클라이언트 호출 ) |
||
826 | MarkusLicenseProxy.On<string>("MarkusNotification", msg => |
||
827 | Console.WriteLine("Noficiation Message : " + msg) |
||
828 | ); |
||
829 | |||
830 | |||
831 | // 서버 메서드 호출 |
||
832 | //MarkusLicenseProxy.Invoke<string>("DoSomething", "I'm doing something!!!").Wait(); |
||
833 | |||
834 | //Console.ReadKey(); |
||
835 | |||
836 | //hubConnection.Stop(); |
||
837 | } |
||
838 | 787a4489 | KangIngu | |
839 | 1f1c566e | djkim | public void MarkupUserListDisplay() |
840 | { |
||
841 | List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업 |
||
842 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
843 | List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업 |
||
844 | 29010418 | ljiyeon | //MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl(); |
845 | 1f1c566e | djkim | Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
846 | 29010418 | ljiyeon | Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
847 | f714bef8 | djkim | //foreach (var item in gridSelectionItem) |
848 | //{ |
||
849 | // if (item.UserID == App.ViewInfo.UserID) |
||
850 | // { |
||
851 | d62c0439 | humkyung | // ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
852 | f714bef8 | djkim | // { |
853 | // layerControl.markupParseEx(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markupitem.ID); |
||
854 | // }); |
||
855 | // } |
||
856 | // else |
||
857 | // { |
||
858 | // ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
||
859 | // { |
||
860 | // layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
||
861 | // }); |
||
862 | // } |
||
863 | //} |
||
864 | 29010418 | ljiyeon | (from A in gridSelectionItem |
865 | from B in Common.ViewerDataModel.Instance.MarkupControls_USER |
||
866 | where A.MarkupInfoID == B.MarkupInfoID |
||
867 | select B).ToList().ForEach(data => |
||
868 | { |
||
869 | Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(data); |
||
870 | }); |
||
871 | 1f1c566e | djkim | (from A in gridSelectionItem |
872 | from B in Common.ViewerDataModel.Instance.MarkupControls |
||
873 | where A.MarkupInfoID == B.MarkupInfoID |
||
874 | select B).ToList().ForEach(data => |
||
875 | { |
||
876 | Common.ViewerDataModel.Instance.MarkupControls.Remove(data); |
||
877 | }); |
||
878 | |||
879 | foreach (var item in gridSelectionItem) |
||
880 | { |
||
881 | if (item.UserID == App.ViewInfo.UserID) |
||
882 | { |
||
883 | d62c0439 | humkyung | ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
884 | 1f1c566e | djkim | { |
885 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", |
886 | item.MarkupInfoID, markupitem.ID); |
||
887 | 1f1c566e | djkim | }); |
888 | } |
||
889 | else |
||
890 | { |
||
891 | ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
||
892 | { |
||
893 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
894 | 1f1c566e | djkim | }); |
895 | } |
||
896 | } |
||
897 | } |
||
898 | 787a4489 | KangIngu | } |
899 | } |