markus / KCOM / Controls / Symbol.xaml.cs @ 38d69491
이력 | 보기 | 이력해설 | 다운로드 (44.7 KB)
1 | 53880c83 | ljiyeon | using IKCOM; |
---|---|---|---|
2 | using KCOM.Common; |
||
3 | 787a4489 | KangIngu | using KCOM.Events; |
4 | 5ce56a3a | KangIngu | using KCOMDataModel.Common; |
5 | using KCOMDataModel.DataModel; |
||
6 | 34c8d43a | ljiyeon | using MarkupToPDF.Common; |
7 | 036650a0 | humkyung | using MarkupToPDF.Controls.Parsing; |
8 | 787a4489 | KangIngu | using System; |
9 | using System.Collections.Generic; |
||
10 | 53880c83 | ljiyeon | using System.ComponentModel; |
11 | 787a4489 | KangIngu | using System.Linq; |
12 | using System.Text; |
||
13 | f65e6c02 | taeseongkim | using System.Threading.Tasks; |
14 | 787a4489 | KangIngu | using System.Windows; |
15 | using System.Windows.Controls; |
||
16 | using System.Windows.Data; |
||
17 | using System.Windows.Documents; |
||
18 | using System.Windows.Input; |
||
19 | using System.Windows.Media; |
||
20 | using System.Windows.Media.Imaging; |
||
21 | using System.Windows.Navigation; |
||
22 | using System.Windows.Shapes; |
||
23 | using Telerik.Windows.Controls; |
||
24 | 5ce56a3a | KangIngu | using Telerik.Windows.Controls.DragDrop; |
25 | 787a4489 | KangIngu | |
26 | namespace KCOM.Controls |
||
27 | { |
||
28 | public class Symbol_Custom |
||
29 | { |
||
30 | 5ce56a3a | KangIngu | public string ID { get; set; } |
31 | 787a4489 | KangIngu | public string Name { get; set; } |
32 | public string ImageUri { get; set; } |
||
33 | } |
||
34 | |||
35 | /// <summary> |
||
36 | /// Symbol.xaml에 대한 상호 작용 논리 |
||
37 | /// </summary> |
||
38 | public partial class Symbol : UserControl |
||
39 | { |
||
40 | AdornerFinal finalItem; |
||
41 | 5ce56a3a | KangIngu | bool IsMouseDown = false; |
42 | string moveItem_id = ""; |
||
43 | 787a4489 | KangIngu | public string filename { get; set; } |
44 | f65e6c02 | taeseongkim | bool _Initialize = false; |
45 | 787a4489 | KangIngu | |
46 | public Symbol() |
||
47 | { |
||
48 | f65e6c02 | taeseongkim | //App.splashString(ISplashMessage.SYMBOL); |
49 | 787a4489 | KangIngu | InitializeComponent(); |
50 | 53880c83 | ljiyeon | |
51 | //RadDragAndDropManager.AddDragInfoHandler(lstSymbolPrivate, OnDragPrivateInfo); |
||
52 | //RadDragAndDropManager.AddDragQueryHandler(lstSymbolPrivate, OnDragPrivateQuery); |
||
53 | //RadDragAndDropManager.SetAllowDrag(lstSymbolPrivate, true); |
||
54 | f65e6c02 | taeseongkim | this.Loaded += Symbol_Loaded; |
55 | |||
56 | } |
||
57 | |||
58 | |||
59 | 787a4489 | KangIngu | |
60 | f65e6c02 | taeseongkim | private async void Symbol_Loaded(object sender, RoutedEventArgs e) |
61 | { |
||
62 | 8fb54282 | taeseongkim | if (!App.IsDesignMode) |
63 | f65e6c02 | taeseongkim | { |
64 | 8fb54282 | taeseongkim | if (!_Initialize) |
65 | { |
||
66 | _Initialize = true; |
||
67 | await DataBindAsync(); |
||
68 | f65e6c02 | taeseongkim | |
69 | 8fb54282 | taeseongkim | } |
70 | f65e6c02 | taeseongkim | } |
71 | 787a4489 | KangIngu | } |
72 | |||
73 | 5ce56a3a | KangIngu | private void OnDragPrivateInfo(object sender, DragDropEventArgs e) |
74 | { |
||
75 | } |
||
76 | |||
77 | private void OnDragPrivateQuery(object sender, DragDropQueryEventArgs e) |
||
78 | { |
||
79 | if (e.Options.Status == DragStatus.DragQuery) |
||
80 | { |
||
81 | //var draggedListBoxItem = (e.Options.Source as System.Windows.Controls.ListBox).SelectedItem; |
||
82 | //BitmapImage im = new BitmapImage(new Uri((draggedListBoxItem as DeepView.ServiceDeepView_Symbol.SymbolPrivate).ImageUri)); |
||
83 | //ImageSource _source = im; |
||
84 | //Image img = new Image(); |
||
85 | //img.Source = _source; |
||
86 | |||
87 | //e.Options.Payload = im; |
||
88 | //var dragCue = new Image(); |
||
89 | //dragCue.Source = img.Source; |
||
90 | //dragCue.Width = 0; |
||
91 | //dragCue.Height = 0; |
||
92 | //e.Options.DragCue = dragCue; |
||
93 | |||
94 | |||
95 | //PayLoadAdorner = new AdornerFinal(); |
||
96 | //DeepView.ServiceDeepView_Symbol.SymbolPrivate tempDragableControl = (e.Options.Source as System.Windows.Controls.ListBox).SelectedItem as DeepView.ServiceDeepView_Symbol.SymbolPrivate; |
||
97 | //var xamldata = tempDragableControl.Data; |
||
98 | ////this.DeepLayer.markupParse(xamldata, this.DeepLayer._TempLayer, "복사된 데이터_이름으로 수정해야함"); |
||
99 | //PayLoadAdorner = this.DeepLayer.markupParseToAdorner(xamldata, this.DeepLayer._SelectLayer, ""); |
||
100 | //this.DeepLayer._SelectLayer.Children.Add(PayLoadAdorner); |
||
101 | } |
||
102 | |||
103 | e.QueryResult = true; |
||
104 | e.Handled = true; |
||
105 | } |
||
106 | |||
107 | f65e6c02 | taeseongkim | private async Task DataBindAsync() |
108 | 787a4489 | KangIngu | { |
109 | 5ce56a3a | KangIngu | //lstSymbolPrivate.ItemsSource = null; |
110 | //lstSymbolPublic.ItemsSource = null; |
||
111 | 787a4489 | KangIngu | |
112 | Symbol_Custom Custom = new Symbol_Custom(); |
||
113 | ff01c725 | humkyung | List<Symbol_Custom> Custom_List = new List<Symbol_Custom>(); |
114 | |||
115 | try |
||
116 | { |
||
117 | |||
118 | f65e6c02 | taeseongkim | var symbol_Private = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetSymbolListAsync(App.ViewInfo.UserID); |
119 | ff01c725 | humkyung | |
120 | foreach (var item in symbol_Private) |
||
121 | { |
||
122 | Custom.Name = item.NAME; |
||
123 | Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL, App.isExternal); |
||
124 | Custom.ID = item.ID; |
||
125 | Custom_List.Add(Custom); |
||
126 | Custom = new Symbol_Custom(); |
||
127 | } |
||
128 | lstSymbolPrivate.ItemsSource = Custom_List; |
||
129 | } |
||
130 | catch (Exception ex) |
||
131 | 5ce56a3a | KangIngu | { |
132 | ff01c725 | humkyung | System.Diagnostics.Debug.WriteLine(ex.ToString()); |
133 | 6c781c0c | djkim | } |
134 | 5ce56a3a | KangIngu | |
135 | 6c781c0c | djkim | Custom = new Symbol_Custom(); |
136 | Custom_List = new List<Symbol_Custom>(); |
||
137 | 5ce56a3a | KangIngu | |
138 | f65e6c02 | taeseongkim | deptlist.ItemsSource = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetPublicSymbolDeptListAsync(); |
139 | 5ce56a3a | KangIngu | |
140 | 6c781c0c | djkim | List<SYMBOL_PUBLIC> symbol_Public; |
141 | 5ce56a3a | KangIngu | |
142 | 53880c83 | ljiyeon | |
143 | 6c781c0c | djkim | if (deptlist.SelectedValue != null) |
144 | { |
||
145 | f65e6c02 | taeseongkim | symbol_Public = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetPublicSymbolListAsync(deptlist.SelectedValue.ToString()); |
146 | 6c781c0c | djkim | } |
147 | else |
||
148 | { |
||
149 | f65e6c02 | taeseongkim | symbol_Public = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetPublicSymbolListAsync(null); |
150 | 5ce56a3a | KangIngu | } |
151 | e77fc685 | taeseongkim | |
152 | if (symbol_Public != null) |
||
153 | 6c781c0c | djkim | { |
154 | e77fc685 | taeseongkim | foreach (var item in symbol_Public) |
155 | { |
||
156 | Custom.Name = item.NAME; |
||
157 | Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL, App.isExternal); |
||
158 | Custom.ID = item.ID; |
||
159 | Custom_List.Add(Custom); |
||
160 | Custom = new Symbol_Custom(); |
||
161 | } |
||
162 | f65e6c02 | taeseongkim | |
163 | e77fc685 | taeseongkim | lstSymbolPublic.ItemsSource = Custom_List; |
164 | } |
||
165 | 5ce56a3a | KangIngu | } |
166 | |||
167 | 4f017ed3 | taeseongkim | public async Task<PngBitmapEncoder> symImageAsync(string data,double PageAngle) |
168 | 5ce56a3a | KangIngu | { |
169 | |||
170 | Canvas _canvas = new Canvas(); |
||
171 | _canvas.Background = Brushes.White; |
||
172 | _canvas.Width = finalItem.BorderSize.Width; |
||
173 | _canvas.Height = finalItem.BorderSize.Height; |
||
174 | d2050059 | taeseongkim | await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas, PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.NewMarkupCancelToken()); |
175 | 5ce56a3a | KangIngu | |
176 | BitmapEncoder encoder = new PngBitmapEncoder(); |
||
177 | |||
178 | |||
179 | RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32); |
||
180 | |||
181 | DrawingVisual dv = new DrawingVisual(); |
||
182 | |||
183 | _canvas.Measure(new System.Windows.Size(finalItem.BorderSize.Width + 50, finalItem.BorderSize.Height + 50)); |
||
184 | //_canvas.Arrange(new Rect(new System.Windows.Point { X = -finalItem.BorderSize.X - 50, Y = -finalItem.BorderSize.Y - 50 }, new Point(finalItem.BorderSize.Width + 20, finalItem.BorderSize.Height + 20))); |
||
185 | _canvas.Arrange(new Rect(new System.Windows.Point { X = -finalItem.BorderSize.X - 20, Y = -finalItem.BorderSize.Y - 20 }, new Point(finalItem.BorderSize.Width + 20, finalItem.BorderSize.Height + 20))); |
||
186 | |||
187 | using (DrawingContext ctx = dv.RenderOpen()) |
||
188 | { |
||
189 | VisualBrush vb = new VisualBrush(_canvas); |
||
190 | //ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point { X = -finalItem.BorderSize.X - 20, Y = -finalItem.BorderSize.Y - 20 }, new Point(finalItem.BorderSize.Width + 20, finalItem.BorderSize.Height + 20))); |
||
191 | ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point { X = -finalItem.BorderSize.X, Y = -finalItem.BorderSize.Y }, new Point(finalItem.BorderSize.Width + 20, finalItem.BorderSize.Height + 20))); |
||
192 | } |
||
193 | |||
194 | try |
||
195 | { |
||
196 | renderBitmap.Render(dv); |
||
197 | |||
198 | GC.Collect(); |
||
199 | GC.WaitForPendingFinalizers(); |
||
200 | GC.Collect(); |
||
201 | //bitmap.Render(controlToConvert); |
||
202 | // encode png data |
||
203 | PngBitmapEncoder pngEncoder = new PngBitmapEncoder(); |
||
204 | // puch rendered bitmap into it |
||
205 | pngEncoder.Interlace = PngInterlaceOption.Off; |
||
206 | pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap)); |
||
207 | return pngEncoder; |
||
208 | |||
209 | } |
||
210 | 53880c83 | ljiyeon | catch //(Exception ex) |
211 | 5ce56a3a | KangIngu | { |
212 | return null; |
||
213 | } |
||
214 | 787a4489 | KangIngu | |
215 | } |
||
216 | |||
217 | 5ce56a3a | KangIngu | public void DialogMessage_Alert(string content, string header) |
218 | { |
||
219 | 68e3cd94 | taeseongkim | App.splashScreen.Close(); |
220 | |||
221 | 5ce56a3a | KangIngu | DialogParameters parameters = new DialogParameters() |
222 | { |
||
223 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
224 | 0d32593b | ljiyeon | Content = new TextBlock() |
225 | { |
||
226 | MinWidth = 400, |
||
227 | FontSize = 11, |
||
228 | Text = content, |
||
229 | TextWrapping = System.Windows.TextWrapping.Wrap |
||
230 | }, |
||
231 | 5ce56a3a | KangIngu | Header = header, |
232 | Theme = new VisualStudio2013Theme(), |
||
233 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
234 | }; |
||
235 | RadWindow.Alert(parameters); |
||
236 | } |
||
237 | |||
238 | #region Event |
||
239 | |||
240 | 498f0fc9 | ljiyeon | #region Private Symbol Add Event |
241 | 787a4489 | KangIngu | private void Create_Symbol(object sender, RoutedEventArgs e) |
242 | { |
||
243 | 5529d2a2 | humkyung | MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn(); |
244 | 787a4489 | KangIngu | |
245 | if (Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면 |
||
246 | { |
||
247 | DialogMessage_Alert("Please Select Controls", "Alert"); |
||
248 | } |
||
249 | else //선택된 것이 있으면 |
||
250 | { |
||
251 | string MarkupData = ""; |
||
252 | finalItem = new AdornerFinal(); |
||
253 | |||
254 | foreach (var item in Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children) |
||
255 | { |
||
256 | if (item.GetType().Name == "AdornerFinal") |
||
257 | { |
||
258 | finalItem = (item as Controls.AdornerFinal); |
||
259 | 4913851c | humkyung | foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>()) |
260 | 787a4489 | KangIngu | { |
261 | if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
||
262 | { |
||
263 | 5529d2a2 | humkyung | markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
264 | 787a4489 | KangIngu | MarkupData += markupReturn.ConvertData; |
265 | } |
||
266 | } |
||
267 | } |
||
268 | } |
||
269 | DialogParameters parameters = new DialogParameters() |
||
270 | { |
||
271 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
272 | 53880c83 | ljiyeon | Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args), |
273 | 787a4489 | KangIngu | DefaultPromptResultValue = "Custom State", |
274 | Content = "Name :", |
||
275 | Header = "Insert Custom Symbol Name", |
||
276 | Theme = new VisualStudio2013Theme(), |
||
277 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
278 | }; |
||
279 | RadWindow.Prompt(parameters); |
||
280 | } |
||
281 | |||
282 | } |
||
283 | 5ce56a3a | KangIngu | #endregion |
284 | 787a4489 | KangIngu | |
285 | 5ce56a3a | KangIngu | #region Symbol Add Close Event |
286 | f65e6c02 | taeseongkim | private async void MarkupNamePromptClose(string data, WindowClosedEventArgs args) |
287 | 787a4489 | KangIngu | { |
288 | c73426a9 | ljiyeon | try |
289 | 787a4489 | KangIngu | { |
290 | c73426a9 | ljiyeon | if (args.PromptResult != null) |
291 | 53880c83 | ljiyeon | { |
292 | c73426a9 | ljiyeon | if (args.DialogResult.Value) |
293 | { |
||
294 | 4f017ed3 | taeseongkim | PngBitmapEncoder _Encoder = await symImageAsync(data,ViewerDataModel.Instance.MarkupAngle); |
295 | 787a4489 | KangIngu | |
296 | c73426a9 | ljiyeon | System.IO.MemoryStream fs = new System.IO.MemoryStream(); |
297 | _Encoder.Save(fs); |
||
298 | System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs); |
||
299 | 787a4489 | KangIngu | |
300 | c73426a9 | ljiyeon | byte[] Img_byte = fs.ToArray(); |
301 | 787a4489 | KangIngu | |
302 | 76dc223b | taeseongkim | kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader; |
303 | f1f822e9 | taeseongkim | filename = fileUploader.RunSymbol(App.ViewInfo.ProjectNO, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte); |
304 | c73426a9 | ljiyeon | Check_Uri.UriCheck(filename); |
305 | if (RadTab.SelectedIndex == 0) |
||
306 | { |
||
307 | SymbolSave(args.PromptResult, filename, data); |
||
308 | } |
||
309 | else |
||
310 | { |
||
311 | SymbolSave_Public(args.PromptResult, filename, data, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
||
312 | } |
||
313 | 53880c83 | ljiyeon | |
314 | f65e6c02 | taeseongkim | await DataBindAsync(); |
315 | 53880c83 | ljiyeon | } |
316 | 498f0fc9 | ljiyeon | } |
317 | 53880c83 | ljiyeon | } |
318 | c73426a9 | ljiyeon | catch(Exception ex) |
319 | { |
||
320 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert"); |
||
321 | } |
||
322 | 53880c83 | ljiyeon | } |
323 | #endregion |
||
324 | |||
325 | public void SymbolSave(string Name, string Url, string Data) |
||
326 | { |
||
327 | try |
||
328 | { |
||
329 | SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE |
||
330 | 498f0fc9 | ljiyeon | { |
331 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
332 | 53880c83 | ljiyeon | MEMBER_USER_ID = App.ViewInfo.UserID, |
333 | NAME = Name, |
||
334 | IMAGE_URL = Url, |
||
335 | DATA = Data |
||
336 | }; |
||
337 | 5ce56a3a | KangIngu | |
338 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted; |
339 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1); |
340 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
341 | } |
||
342 | catch (Exception) |
||
343 | { |
||
344 | throw; |
||
345 | 787a4489 | KangIngu | } |
346 | } |
||
347 | 53880c83 | ljiyeon | |
348 | public void SymbolSave_Public(string Name, string Url, string Data, string Department) |
||
349 | { |
||
350 | try |
||
351 | { |
||
352 | SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC |
||
353 | { |
||
354 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
355 | 53880c83 | ljiyeon | DEPARTMENT = Department, |
356 | NAME = Name, |
||
357 | IMAGE_URL = Url, |
||
358 | DATA = Data |
||
359 | }; |
||
360 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted; |
||
361 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1); |
362 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public); |
363 | } |
||
364 | catch (Exception) |
||
365 | { |
||
366 | throw; |
||
367 | } |
||
368 | } |
||
369 | |||
370 | f65e6c02 | taeseongkim | private async void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e) |
371 | 53880c83 | ljiyeon | { |
372 | 664ea2e1 | taeseongkim | //Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
373 | f65e6c02 | taeseongkim | await DataBindAsync(); |
374 | 53880c83 | ljiyeon | } |
375 | |||
376 | f65e6c02 | taeseongkim | private async void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e) |
377 | 53880c83 | ljiyeon | { |
378 | 664ea2e1 | taeseongkim | //Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
379 | f65e6c02 | taeseongkim | await DataBindAsync(); |
380 | 53880c83 | ljiyeon | } |
381 | 787a4489 | KangIngu | |
382 | 498f0fc9 | ljiyeon | #region Private Symbol Delete Event |
383 | 5ce56a3a | KangIngu | private void Remove_Symbol(object sender, RoutedEventArgs e) |
384 | 787a4489 | KangIngu | { |
385 | 5ce56a3a | KangIngu | if (lstSymbolPrivate.SelectedItem == null) |
386 | { |
||
387 | DialogMessage_Alert("Please Select Symbol", "Alert"); |
||
388 | return; |
||
389 | } |
||
390 | 6c781c0c | djkim | string delItem_ID = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
391 | 0f065e57 | ljiyeon | |
392 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted; |
393 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1); |
394 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex); |
395 | 498f0fc9 | ljiyeon | } |
396 | #endregion |
||
397 | #region Public Symbol Delete Event |
||
398 | private void Remove_Symbol_Public(object sender, RoutedEventArgs e) |
||
399 | { |
||
400 | if (lstSymbolPublic.SelectedItem == null) |
||
401 | { |
||
402 | DialogMessage_Alert("Please Select Symbol", "Alert"); |
||
403 | return; |
||
404 | } |
||
405 | string delItem_ID = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
||
406 | |||
407 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted; |
||
408 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1); |
409 | 498f0fc9 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex); |
410 | 6c781c0c | djkim | } |
411 | 787a4489 | KangIngu | |
412 | f65e6c02 | taeseongkim | private async void BaseClient_DeleteSymbolCompleted(object sender, ServiceDeepView.DeleteSymbolCompletedEventArgs e) |
413 | 6c781c0c | djkim | { |
414 | 664ea2e1 | taeseongkim | //Logger.sendResLog("DeleteSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
415 | f65e6c02 | taeseongkim | await DataBindAsync(); |
416 | 5ce56a3a | KangIngu | } |
417 | #endregion |
||
418 | 787a4489 | KangIngu | |
419 | 34c8d43a | ljiyeon | public Undo_data UndoData { get; set; } |
420 | 702abd98 | humkyung | /// <summary> |
421 | /// place symbol which has given id to original position which is created |
||
422 | /// </summary> |
||
423 | /// <date>2018.06.14</date> |
||
424 | /// <param name="id"></param> |
||
425 | ac4f1e13 | taeseongkim | private async void PlaceSymbol(string id,Point CurrentMousePoint) |
426 | 5ce56a3a | KangIngu | { |
427 | 702abd98 | humkyung | string Data_ = ""; |
428 | 787a4489 | KangIngu | |
429 | c7fde400 | taeseongkim | var systemMain = Common.ViewerDataModel.Instance.SystemMain; |
430 | var mainMenu = systemMain.dzMainMenu; |
||
431 | |||
432 | SelectionSet.Instance.UnSelect(mainMenu); /// unselect alreay selected items |
||
433 | |||
434 | 702abd98 | humkyung | try |
435 | 5ce56a3a | KangIngu | { |
436 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetSymbolData: ", id + "," + RadTab.SelectedIndex, 1); |
437 | c7fde400 | taeseongkim | Data_ = mainMenu.BaseClient.GetSymbolData(id, RadTab.SelectedIndex); |
438 | |||
439 | 0f065e57 | ljiyeon | if (Data_ != null || Data_ != "") |
440 | { |
||
441 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetSymbolData", "TRUE", 1); |
442 | 0f065e57 | ljiyeon | } |
443 | else |
||
444 | { |
||
445 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetSymbolData", "FALSE", 1); |
446 | 0f065e57 | ljiyeon | } |
447 | 787a4489 | KangIngu | |
448 | 53880c83 | ljiyeon | //MARKUP_DATA_GROUP INSERT |
449 | c0977e97 | djkim | //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP |
450 | //{ |
||
451 | // SYMBOL_ID = id,//InnerItem.Symbol_ID |
||
452 | // STATE = 0, |
||
453 | //}; |
||
454 | //long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO); |
||
455 | 664ea2e1 | taeseongkim | ////Logger.sendReqLog("AddMarkupDataGroup: ", "", 1); |
456 | 53880c83 | ljiyeon | |
457 | 5ce56a3a | KangIngu | if (Data_.Contains("|DZ|")) |
458 | { |
||
459 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
460 | |||
461 | string[] delimiterChars = { "|DZ|" }; |
||
462 | string[] data = Data_.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
||
463 | |||
464 | 34c8d43a | ljiyeon | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
465 | UndoData = new Undo_data() |
||
466 | { |
||
467 | IsUndo = false, |
||
468 | Event = Event_Type.Create, |
||
469 | EventTime = DateTime.Now, |
||
470 | Markup_List = new List<Multi_Undo_data>() |
||
471 | }; |
||
472 | ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
||
473 | { |
||
474 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
475 | }); |
||
476 | |||
477 | foreach (string parse in data) |
||
478 | 5ce56a3a | KangIngu | { |
479 | if (parse != "") |
||
480 | { |
||
481 | d2050059 | taeseongkim | System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, string.Empty, string.Empty); |
482 | 24678e06 | humkyung | (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid(); |
483 | c8e9b3e4 | ljiyeon | (item as MarkupToPDF.Common.CommentUserInfo).SymbolID = id; |
484 | c0977e97 | djkim | //(item as MarkupToPDF.Common.CommentUserInfo).GroupID = group_id; |
485 | c7fde400 | taeseongkim | |
486 | 5ce56a3a | KangIngu | ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
487 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
||
488 | 53880c83 | ljiyeon | |
489 | 5ce56a3a | KangIngu | adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
490 | 34c8d43a | ljiyeon | |
491 | multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
||
492 | |||
493 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
494 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
495 | 5ce56a3a | KangIngu | } |
496 | } |
||
497 | c7fde400 | taeseongkim | |
498 | 5ce56a3a | KangIngu | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
499 | |||
500 | c7fde400 | taeseongkim | // 마우스 클릭된 페이지 위치 |
501 | |||
502 | 315ae55e | taeseongkim | var pageWidth = ViewerDataModel.Instance.ImageViewWidth; |
503 | var pageHeight = ViewerDataModel.Instance.ImageViewHeight; |
||
504 | 4f017ed3 | taeseongkim | var angle = Common.ViewerDataModel.Instance.MarkupAngle; |
505 | c7fde400 | taeseongkim | |
506 | Point pagePoint = new Point(pageWidth/2, pageHeight/2); |
||
507 | |||
508 | var rotatePoint = Rotate(mainMenu.CanvasDrawingMouseDownPoint,pagePoint,angle); |
||
509 | |||
510 | var diff = Point.Subtract(rotatePoint, final.Centeroid); |
||
511 | 6b6e937c | taeseongkim | final.TranslateItems(diff.X, diff.Y); |
512 | c7fde400 | taeseongkim | |
513 | mainMenu.SelectLayer.Children.Add(final); |
||
514 | //var finalPosition = new Point(Canvas.GetLeft(final), Canvas.GetTop(final)); |
||
515 | //Rect rect = new Rect(finalPosition, Point.Add(finalPosition,new Vector(final.Width,final.Height))); |
||
516 | |||
517 | //SelectionSet.Instance.SelectItemByRect(final.getAdornerSize(), mainMenu); |
||
518 | |||
519 | 5ce56a3a | KangIngu | } |
520 | 53880c83 | ljiyeon | else |
521 | { |
||
522 | c0977e97 | djkim | PlaceImageSymbol(id, 0); |
523 | 53880c83 | ljiyeon | } |
524 | } |
||
525 | catch (Exception ex) |
||
526 | { |
||
527 | this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error"); |
||
528 | } |
||
529 | } |
||
530 | |||
531 | c7fde400 | taeseongkim | |
532 | //출처: https://icodebroker.tistory.com/3189 [ICODEBROKER] |
||
533 | public Point Rotate(Point sourcePoint, Point centerPoint, double rotateAngle) |
||
534 | { |
||
535 | Point targetPoint = new Point(); |
||
536 | |||
537 | double radian = rotateAngle / 180 * Math.PI; |
||
538 | |||
539 | targetPoint.X = Math.Cos(radian) * (sourcePoint.X - centerPoint.X) - Math.Sin(radian) * (sourcePoint.Y - centerPoint.Y) + centerPoint.X; |
||
540 | targetPoint.Y = Math.Sin(radian) * (sourcePoint.X - centerPoint.X) + Math.Cos(radian) * (sourcePoint.Y - centerPoint.Y) + centerPoint.Y; |
||
541 | |||
542 | return targetPoint; |
||
543 | } |
||
544 | |||
545 | |||
546 | |||
547 | 53880c83 | ljiyeon | private void PlaceImageSymbol(string id, long group_id) |
548 | { |
||
549 | |||
550 | //canvasZoommovingMouseDownPoint |
||
551 | string Data_ = ""; |
||
552 | |||
553 | try |
||
554 | { |
||
555 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("GetSymbolImageURL: ", id + "," + RadTab.SelectedIndex, 1); |
556 | 53880c83 | ljiyeon | Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, RadTab.SelectedIndex); |
557 | if (Data_ != null || Data_ != "") |
||
558 | { |
||
559 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetSymbolImageURL", "TRUE", 1); |
560 | 53880c83 | ljiyeon | } |
561 | else |
||
562 | { |
||
563 | 664ea2e1 | taeseongkim | //Logger.sendResLog("GetSymbolImageURL", "FALSE", 1); |
564 | 53880c83 | ljiyeon | } |
565 | |||
566 | //MARKUP_DATA_GROUP INSERT |
||
567 | c0977e97 | djkim | //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP |
568 | //{ |
||
569 | // SYMBOL_ID = id,//InnerItem.Symbol_ID |
||
570 | // STATE = 0, |
||
571 | //}; |
||
572 | 53880c83 | ljiyeon | //long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO); |
573 | 664ea2e1 | taeseongkim | ////Logger.sendReqLog("AddMarkupDataGroup: ", "", 1); |
574 | 53880c83 | ljiyeon | |
575 | if (Data_ != null) |
||
576 | { |
||
577 | Image img = new Image(); |
||
578 | //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_)); |
||
579 | if (Data_.Contains(".svg")) |
||
580 | { |
||
581 | f1f822e9 | taeseongkim | SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(Data_); |
582 | img.Source = (DrawingImage)svgImage.ProvideValue(null); |
||
583 | 53880c83 | ljiyeon | } |
584 | else |
||
585 | { |
||
586 | img.Source = new BitmapImage(new Uri(Data_)); |
||
587 | } |
||
588 | |||
589 | var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
||
590 | { |
||
591 | PointSet = new List<Point>(), |
||
592 | FilePath = Data_, |
||
593 | ImageData = img.Source, |
||
594 | StartPoint = new Point(0, 0), |
||
595 | EndPoint = new Point(img.Source.Width, img.Source.Height), |
||
596 | TopRightPoint = new Point(img.Source.Width, 0), |
||
597 | LeftBottomPoint = new Point(0, img.Source.Height) |
||
598 | }; |
||
599 | |||
600 | currentControl.PointSet = new List<Point> |
||
601 | { |
||
602 | currentControl.StartPoint, |
||
603 | currentControl.LeftBottomPoint, |
||
604 | currentControl.EndPoint, |
||
605 | currentControl.TopRightPoint, |
||
606 | }; |
||
607 | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
||
608 | UndoData = new Undo_data() |
||
609 | { |
||
610 | IsUndo = false, |
||
611 | Event = Event_Type.Create, |
||
612 | EventTime = DateTime.Now, |
||
613 | Markup_List = new List<Multi_Undo_data>() |
||
614 | }; |
||
615 | ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
||
616 | { |
||
617 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
618 | }); |
||
619 | |||
620 | //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
621 | multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
622 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
623 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
624 | |||
625 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
626 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
627 | 53880c83 | ljiyeon | currentControl.SymbolID = id; |
628 | currentControl.GroupID = group_id; |
||
629 | currentControl.ApplyTemplate(); |
||
630 | currentControl.SetImage(); |
||
631 | |||
632 | ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
633 | Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
634 | this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final); |
||
635 | |||
636 | 7211e0c2 | ljiyeon | /* |
637 | 53880c83 | ljiyeon | // this.ParentOfType<MainWindow>().dzMainMenu.isLeftMouseButtonDownOnWindow = true; |
638 | // final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
||
639 | double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
||
640 | double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
||
641 | 0d00f9c8 | humkyung | final.TranslateItems(realPointX, realPointY); |
642 | 53880c83 | ljiyeon | // move.control_Select(item, dragRect); |
643 | ApplyDragSelectionRect(); |
||
644 | 7211e0c2 | ljiyeon | //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = MouseHandlingMode.DragSymbol; |
645 | e6a9ddaf | humkyung | ///this.ParentOfType<MainWindow>().dzMainMenu.mouseButtonDown = MouseButton.Left; |
646 | 7211e0c2 | ljiyeon | //this.ParentOfType<MainWindow>().dzMainMenu.symboldata(id, group_id, RadTab.SelectedIndex, Data_, img.Source);*/ |
647 | 53880c83 | ljiyeon | |
648 | } |
||
649 | 5ce56a3a | KangIngu | } |
650 | 702abd98 | humkyung | catch(Exception ex) |
651 | { |
||
652 | 53880c83 | ljiyeon | this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error"); |
653 | } |
||
654 | } |
||
655 | |||
656 | public Multi_Undo_data multi_Undo_Data; |
||
657 | private void ApplyDragSelectionRect() |
||
658 | { |
||
659 | multi_Undo_Data = new Multi_Undo_data(); |
||
660 | |||
661 | UndoData = new Undo_data() |
||
662 | { |
||
663 | IsUndo = false, |
||
664 | Event = Event_Type.Select, |
||
665 | EventTime = DateTime.Now, |
||
666 | Markup_List = new List<Multi_Undo_data>() |
||
667 | }; |
||
668 | |||
669 | this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Visibility = Visibility.Collapsed; |
||
670 | |||
671 | double x = Canvas.GetLeft(this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder); |
||
672 | double y = Canvas.GetTop(this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder); |
||
673 | double width = this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Width; |
||
674 | double height = this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Height; |
||
675 | Rect dragRect = new Rect(x, y, width, height); |
||
676 | Boolean Flag = false; |
||
677 | dragRect.Inflate(width / 10, height / 10); |
||
678 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
679 | var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList(); |
||
680 | |||
681 | dragRect = new Rect(x, y, width, height); |
||
682 | dragRect.Inflate(width / 10, height / 10); |
||
683 | |||
684 | //move.mousemode = MarkupToPDF.Controls.Common.MouseMode.Selecting; |
||
685 | //move. |
||
686 | foreach (var item in Items) |
||
687 | { |
||
688 | 91efe37a | humkyung | Flag = SelectionSet.Instance.SelectControl(item, dragRect); |
689 | 53880c83 | ljiyeon | |
690 | if (Flag) |
||
691 | { |
||
692 | adornerSet.Add(item); |
||
693 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
||
694 | |||
695 | this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item); |
||
696 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
697 | multi_Undo_Data = new Multi_Undo_data(); |
||
698 | if (item.GroupID > 0) |
||
699 | { |
||
700 | |||
701 | } |
||
702 | } |
||
703 | } |
||
704 | if (adornerSet.Count > 0) |
||
705 | { |
||
706 | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
||
707 | { |
||
708 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
709 | }); |
||
710 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
711 | |||
712 | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
713 | this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final); |
||
714 | 702abd98 | humkyung | } |
715 | } |
||
716 | |||
717 | f816dd63 | humkyung | ///private Move move; |
718 | 702abd98 | humkyung | #region Symbol DoubleClick Event |
719 | private void Move_Symbol(object sender, MouseButtonEventArgs e) |
||
720 | { |
||
721 | 16d13764 | djkim | try |
722 | 702abd98 | humkyung | { |
723 | 16d13764 | djkim | Type type = e.OriginalSource.GetType(); |
724 | string id = string.Empty; |
||
725 | 664ea2e1 | taeseongkim | //Logger.sendResLog("Move_Symbol", type.Name, 0); |
726 | 16d13764 | djkim | if (type.Name == "Image") |
727 | { |
||
728 | id = ((e.OriginalSource as Image).DataContext as Symbol_Custom).ID; |
||
729 | } |
||
730 | else if (type.Name == "Border") |
||
731 | { |
||
732 | id = ((e.OriginalSource as Border).DataContext as Symbol_Custom).ID; |
||
733 | } |
||
734 | 53880c83 | ljiyeon | else if (type.Name == "TextBox") |
735 | be31927d | djkim | { |
736 | 53880c83 | ljiyeon | id = ((e.OriginalSource as TextBox).DataContext as Symbol_Custom).ID; |
737 | be31927d | djkim | } |
738 | 16d13764 | djkim | |
739 | IsMouseDown = true; |
||
740 | 53880c83 | ljiyeon | |
741 | 16d13764 | djkim | if (e.ClickCount > 1) |
742 | { |
||
743 | c7fde400 | taeseongkim | this.PlaceSymbol(id,ViewerDataModel.Instance.SystemMain.dzMainMenu.CanvasDrawingMouseDownPoint); |
744 | 16d13764 | djkim | } |
745 | 702abd98 | humkyung | } |
746 | 16d13764 | djkim | catch(Exception ex) |
747 | { |
||
748 | 664ea2e1 | taeseongkim | //Logger.sendResLog("Move_Symbol", ex.Message, 0); |
749 | 53880c83 | ljiyeon | } |
750 | 5ce56a3a | KangIngu | } |
751 | #endregion |
||
752 | |||
753 | 498f0fc9 | ljiyeon | #region Private Symbol Rename Event |
754 | 5ce56a3a | KangIngu | private void Rename_Symbol(object sender, RoutedEventArgs e) |
755 | { |
||
756 | if (lstSymbolPrivate.SelectedItem == null) |
||
757 | 787a4489 | KangIngu | { |
758 | 5ce56a3a | KangIngu | DialogMessage_Alert("Please Select Symbol", "Alert"); |
759 | return; |
||
760 | 787a4489 | KangIngu | } |
761 | |||
762 | 5ce56a3a | KangIngu | DialogParameters parameters = new DialogParameters() |
763 | 787a4489 | KangIngu | { |
764 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
765 | 5ce56a3a | KangIngu | Closed = (obj, args) => this.MarkupReNamePromptClose("", args), |
766 | //DefaultPromptResultValue = "Custom State", |
||
767 | DefaultPromptResultValue = (lstSymbolPrivate.SelectedItem as Symbol_Custom).Name, |
||
768 | Content = "Name :", |
||
769 | Header = "Update Custom Symbol Name", |
||
770 | Theme = new VisualStudio2013Theme(), |
||
771 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
772 | }; |
||
773 | RadWindow.Prompt(parameters); |
||
774 | 787a4489 | KangIngu | |
775 | 5ce56a3a | KangIngu | } |
776 | #endregion |
||
777 | 787a4489 | KangIngu | |
778 | 498f0fc9 | ljiyeon | #region Public Symbol Rename Event |
779 | private void Rename_Symbol_Public(object sender, RoutedEventArgs e) |
||
780 | { |
||
781 | if (lstSymbolPublic.SelectedItem == null) |
||
782 | { |
||
783 | DialogMessage_Alert("Please Select Symbol", "Alert"); |
||
784 | return; |
||
785 | } |
||
786 | |||
787 | DialogParameters parameters = new DialogParameters() |
||
788 | { |
||
789 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
790 | 498f0fc9 | ljiyeon | Closed = (obj, args) => this.MarkupReNamePromptClose("", args), |
791 | //DefaultPromptResultValue = "Custom State", |
||
792 | DefaultPromptResultValue = (lstSymbolPublic.SelectedItem as Symbol_Custom).Name, |
||
793 | Content = "Name :", |
||
794 | Header = "Update Custom Symbol Name", |
||
795 | Theme = new VisualStudio2013Theme(), |
||
796 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
797 | }; |
||
798 | RadWindow.Prompt(parameters); |
||
799 | |||
800 | } |
||
801 | #endregion |
||
802 | 5ce56a3a | KangIngu | #region Symbol Rename Close Event |
803 | private void MarkupReNamePromptClose(string data, WindowClosedEventArgs args) |
||
804 | { |
||
805 | if (args.DialogResult != null && args.DialogResult.Value) |
||
806 | { |
||
807 | 498f0fc9 | ljiyeon | if(RadTab.SelectedIndex == 0) |
808 | { |
||
809 | string _id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
||
810 | string _name = args.PromptResult; |
||
811 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
||
812 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1); |
813 | 498f0fc9 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex); |
814 | } |
||
815 | else |
||
816 | { |
||
817 | string _id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
||
818 | string _name = args.PromptResult; |
||
819 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
||
820 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1); |
821 | 498f0fc9 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex); |
822 | 53880c83 | ljiyeon | } |
823 | 787a4489 | KangIngu | } |
824 | 5ce56a3a | KangIngu | } |
825 | 6c781c0c | djkim | |
826 | f65e6c02 | taeseongkim | private async void BaseClient_RenameSymbolCompleted(object sender, ServiceDeepView.RenameSymbolCompletedEventArgs e) |
827 | 6c781c0c | djkim | { |
828 | 664ea2e1 | taeseongkim | //Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
829 | f65e6c02 | taeseongkim | await DataBindAsync(); |
830 | 6c781c0c | djkim | } |
831 | 5ce56a3a | KangIngu | #endregion |
832 | |||
833 | #region Wheel Event |
||
834 | private void lstSymbolPrivate_PreviewMouseWheel(object sender, MouseWheelEventArgs e) |
||
835 | { |
||
836 | ScView.ScrollToVerticalOffset(ScView.ContentVerticalOffset - (e.Delta / 2)); |
||
837 | } |
||
838 | private void lstSymbolPublic_PreviewMouseWheel(object sender, MouseWheelEventArgs e) |
||
839 | { |
||
840 | ScView_Public.ScrollToVerticalOffset(ScView_Public.ContentVerticalOffset - (e.Delta / 2)); |
||
841 | } |
||
842 | #endregion |
||
843 | |||
844 | #region Tab Selection Event |
||
845 | private void RadTabControl_PreviewSelectionChanged(object sender, RadSelectionChangedEventArgs e) |
||
846 | { |
||
847 | foreach (var item in (e.OriginalSource as RadTabControl).Items) |
||
848 | 787a4489 | KangIngu | { |
849 | 5ce56a3a | KangIngu | (item as RadTabItem).FontWeight = FontWeights.Normal; |
850 | 787a4489 | KangIngu | } |
851 | 5ce56a3a | KangIngu | ((e.OriginalSource as RadTabControl).SelectedItem as RadTabItem).FontWeight = FontWeights.Bold; |
852 | } |
||
853 | #endregion |
||
854 | 787a4489 | KangIngu | |
855 | 5ce56a3a | KangIngu | #region Department Selection Event |
856 | f65e6c02 | taeseongkim | private async void deptlist_SelectionChanged(object sender, SelectionChangedEventArgs e) |
857 | 5ce56a3a | KangIngu | { |
858 | f65e6c02 | taeseongkim | await DataBindAsync(); |
859 | 787a4489 | KangIngu | } |
860 | 5ce56a3a | KangIngu | #endregion |
861 | 787a4489 | KangIngu | |
862 | 5ce56a3a | KangIngu | #endregion |
863 | 29010418 | ljiyeon | |
864 | 5ce56a3a | KangIngu | private void lstSymbolPrivate_PreviewMouseUp(object sender, MouseButtonEventArgs e) |
865 | { |
||
866 | |||
867 | } |
||
868 | |||
869 | private void lstSymbolPrivate_MouseLeave(object sender, MouseEventArgs e) |
||
870 | { |
||
871 | |||
872 | } |
||
873 | |||
874 | private void lstSymbolPrivate_MouseDown(object sender, MouseButtonEventArgs e) |
||
875 | 787a4489 | KangIngu | { |
876 | |||
877 | } |
||
878 | 29010418 | ljiyeon | |
879 | 5ce56a3a | KangIngu | private void StackPanel_MouseLeave(object sender, MouseEventArgs e) |
880 | 787a4489 | KangIngu | { |
881 | 5ce56a3a | KangIngu | if(IsMouseDown && e.LeftButton == MouseButtonState.Pressed) |
882 | { |
||
883 | ViewerDataModel.Instance.SystemMain.dzMainMenu.Symbol_ID = moveItem_id; |
||
884 | } |
||
885 | else |
||
886 | { |
||
887 | IsMouseDown = false; |
||
888 | } |
||
889 | } |
||
890 | 787a4489 | KangIngu | |
891 | 5ce56a3a | KangIngu | private void StackPanel_MouseUp(object sender, MouseButtonEventArgs e) |
892 | { |
||
893 | IsMouseDown = false; |
||
894 | 787a4489 | KangIngu | } |
895 | 702abd98 | humkyung | |
896 | /// <summary> |
||
897 | /// place symbol which user select |
||
898 | /// </summary> |
||
899 | /// <author>humkyung</author> |
||
900 | /// <date>2018.06.14</date> |
||
901 | /// <param name="sender"></param> |
||
902 | /// <param name="e"></param> |
||
903 | private void Place_Symbol(object sender, RoutedEventArgs e) |
||
904 | { |
||
905 | if (lstSymbolPrivate.SelectedItem == null) |
||
906 | { |
||
907 | DialogMessage_Alert("Please Select Symbol", "Alert"); |
||
908 | return; |
||
909 | } |
||
910 | |||
911 | string id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
||
912 | c7fde400 | taeseongkim | this.PlaceSymbol(id, ViewerDataModel.Instance.SystemMain.dzMainMenu.CanvasDrawingMouseDownPoint); |
913 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
914 | 702abd98 | humkyung | } |
915 | ffcc8124 | ljiyeon | |
916 | private void Place_Symbol_Public(object sender, RoutedEventArgs e) |
||
917 | { |
||
918 | if (lstSymbolPublic.SelectedItem == null) |
||
919 | { |
||
920 | DialogMessage_Alert("Please Select Symbol", "Alert"); |
||
921 | return; |
||
922 | } |
||
923 | |||
924 | string id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
||
925 | c7fde400 | taeseongkim | this.PlaceSymbol(id, ViewerDataModel.Instance.SystemMain.dzMainMenu.CanvasDrawingMouseDownPoint); |
926 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
927 | } |
||
928 | |||
929 | private void Image_Place_Register(object sender, RoutedEventArgs e) |
||
930 | { |
||
931 | SyncInit(); |
||
932 | ViewerDataModel.Instance.SystemMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl; |
||
933 | //캡쳐 하기 전에 코멘트 저장 |
||
934 | if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0) |
||
935 | { |
||
936 | var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu; |
||
937 | 077896be | humkyung | SelectionSet.Instance.UnSelect(menu); |
938 | 53880c83 | ljiyeon | if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true) |
939 | { |
||
940 | cb5c7f06 | humkyung | (Application.Current.MainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null); |
941 | 53880c83 | ljiyeon | } |
942 | else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID) |
||
943 | { |
||
944 | |||
945 | } |
||
946 | else |
||
947 | { |
||
948 | cb5c7f06 | humkyung | (Application.Current.MainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null); |
949 | 53880c83 | ljiyeon | } |
950 | } |
||
951 | Application.Current.MainWindow.Focus(); |
||
952 | Common.ViewerDataModel.Instance.Capture_Opacity = 0.49; |
||
953 | (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture; |
||
954 | } |
||
955 | |||
956 | |||
957 | private void SyncInit() |
||
958 | { |
||
959 | try |
||
960 | { |
||
961 | if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden) |
||
962 | { |
||
963 | ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true; |
||
964 | ViewerDataModel.Instance.PageBalanceMode = false; |
||
965 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
966 | 752b18ef | taeseongkim | ViewerDataModel.Instance.SyncPageNumber = 0; |
967 | 53880c83 | ljiyeon | ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
968 | ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
||
969 | ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false; |
||
970 | ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false; |
||
971 | } |
||
972 | } |
||
973 | catch (Exception ex) |
||
974 | { |
||
975 | 664ea2e1 | taeseongkim | //Logger.sendResLog("SyncInit", ex.Message, 0); |
976 | 53880c83 | ljiyeon | } |
977 | } |
||
978 | |||
979 | private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
||
980 | { |
||
981 | var block = sender as TextBox; |
||
982 | block.Focusable = true; |
||
983 | |||
984 | } |
||
985 | |||
986 | private void TextBlock_MouseEnter(object sender, MouseEventArgs e) |
||
987 | { |
||
988 | var block = sender as TextBox; |
||
989 | if (block != null) |
||
990 | { |
||
991 | //block.Text = "Enter"; |
||
992 | |||
993 | } |
||
994 | } |
||
995 | |||
996 | private void OnKeyDownHandler(object sender, KeyEventArgs e) |
||
997 | { |
||
998 | if (e.Key == Key.Return) |
||
999 | { |
||
1000 | Type type = e.OriginalSource.GetType(); |
||
1001 | string id = string.Empty; |
||
1002 | 664ea2e1 | taeseongkim | //Logger.sendResLog("Move_Symbol", type.Name, 0); |
1003 | 53880c83 | ljiyeon | if (type.Name == "Image") |
1004 | { |
||
1005 | id = ((e.OriginalSource as Image).DataContext as Symbol_Custom).ID; |
||
1006 | } |
||
1007 | else if (type.Name == "Border") |
||
1008 | { |
||
1009 | id = ((e.OriginalSource as Border).DataContext as Symbol_Custom).ID; |
||
1010 | } |
||
1011 | else if (type.Name == "TextBox") |
||
1012 | { |
||
1013 | id = ((e.OriginalSource as TextBox).DataContext as Symbol_Custom).ID; |
||
1014 | } |
||
1015 | |||
1016 | //((System.Windows.Controls.TextBox)sender).Text; |
||
1017 | |||
1018 | if (RadTab.SelectedIndex == 0) |
||
1019 | { |
||
1020 | //string _id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
||
1021 | string _name = ((System.Windows.Controls.TextBox)sender).Text; |
||
1022 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
||
1023 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("RenameSymbolAsync: ", id + "," + _name, 1); |
1024 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(id, _name, RadTab.SelectedIndex); |
1025 | } |
||
1026 | else |
||
1027 | { |
||
1028 | //string _id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
||
1029 | string _name = ((System.Windows.Controls.TextBox)sender).Text; |
||
1030 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted; |
||
1031 | 664ea2e1 | taeseongkim | //Logger.sendReqLog("RenameSymbolAsync: ", id + "," + _name, 1); |
1032 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(id, _name, RadTab.SelectedIndex); |
1033 | } |
||
1034 | |||
1035 | } |
||
1036 | ffcc8124 | ljiyeon | } |
1037 | 8e5a4a6a | taeseongkim | |
1038 | 787a4489 | KangIngu | } |
1039 | } |