markus / KCOM / Controls / Symbol.xaml.cs @ 20ef6ffe
이력 | 보기 | 이력해설 | 다운로드 (44.5 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 | 53880c83 | ljiyeon | using Svg2Xaml; |
9 | 787a4489 | KangIngu | using System; |
10 | using System.Collections.Generic; |
||
11 | 53880c83 | ljiyeon | using System.ComponentModel; |
12 | 787a4489 | KangIngu | using System.Linq; |
13 | using System.Text; |
||
14 | f65e6c02 | taeseongkim | using System.Threading.Tasks; |
15 | 787a4489 | KangIngu | using System.Windows; |
16 | using System.Windows.Controls; |
||
17 | using System.Windows.Data; |
||
18 | using System.Windows.Documents; |
||
19 | using System.Windows.Input; |
||
20 | using System.Windows.Media; |
||
21 | using System.Windows.Media.Imaging; |
||
22 | using System.Windows.Navigation; |
||
23 | using System.Windows.Shapes; |
||
24 | using Telerik.Windows.Controls; |
||
25 | 5ce56a3a | KangIngu | using Telerik.Windows.Controls.DragDrop; |
26 | 787a4489 | KangIngu | |
27 | namespace KCOM.Controls |
||
28 | { |
||
29 | public class Symbol_Custom |
||
30 | { |
||
31 | 5ce56a3a | KangIngu | public string ID { get; set; } |
32 | 787a4489 | KangIngu | public string Name { get; set; } |
33 | public string ImageUri { get; set; } |
||
34 | } |
||
35 | |||
36 | /// <summary> |
||
37 | /// Symbol.xaml에 대한 상호 작용 논리 |
||
38 | /// </summary> |
||
39 | public partial class Symbol : UserControl |
||
40 | { |
||
41 | AdornerFinal finalItem; |
||
42 | 5ce56a3a | KangIngu | bool IsMouseDown = false; |
43 | string moveItem_id = ""; |
||
44 | 787a4489 | KangIngu | public string filename { get; set; } |
45 | f65e6c02 | taeseongkim | bool _Initialize = false; |
46 | 787a4489 | KangIngu | |
47 | public Symbol() |
||
48 | { |
||
49 | f65e6c02 | taeseongkim | //App.splashString(ISplashMessage.SYMBOL); |
50 | 787a4489 | KangIngu | InitializeComponent(); |
51 | 53880c83 | ljiyeon | |
52 | //RadDragAndDropManager.AddDragInfoHandler(lstSymbolPrivate, OnDragPrivateInfo); |
||
53 | //RadDragAndDropManager.AddDragQueryHandler(lstSymbolPrivate, OnDragPrivateQuery); |
||
54 | //RadDragAndDropManager.SetAllowDrag(lstSymbolPrivate, true); |
||
55 | f65e6c02 | taeseongkim | this.Loaded += Symbol_Loaded; |
56 | |||
57 | } |
||
58 | |||
59 | |||
60 | 787a4489 | KangIngu | |
61 | f65e6c02 | taeseongkim | private async void Symbol_Loaded(object sender, RoutedEventArgs e) |
62 | { |
||
63 | if (!_Initialize) |
||
64 | { |
||
65 | _Initialize = true; |
||
66 | await DataBindAsync(); |
||
67 | |||
68 | } |
||
69 | 787a4489 | KangIngu | } |
70 | |||
71 | 5ce56a3a | KangIngu | private void OnDragPrivateInfo(object sender, DragDropEventArgs e) |
72 | { |
||
73 | } |
||
74 | |||
75 | private void OnDragPrivateQuery(object sender, DragDropQueryEventArgs e) |
||
76 | { |
||
77 | if (e.Options.Status == DragStatus.DragQuery) |
||
78 | { |
||
79 | //var draggedListBoxItem = (e.Options.Source as System.Windows.Controls.ListBox).SelectedItem; |
||
80 | //BitmapImage im = new BitmapImage(new Uri((draggedListBoxItem as DeepView.ServiceDeepView_Symbol.SymbolPrivate).ImageUri)); |
||
81 | //ImageSource _source = im; |
||
82 | //Image img = new Image(); |
||
83 | //img.Source = _source; |
||
84 | |||
85 | //e.Options.Payload = im; |
||
86 | //var dragCue = new Image(); |
||
87 | //dragCue.Source = img.Source; |
||
88 | //dragCue.Width = 0; |
||
89 | //dragCue.Height = 0; |
||
90 | //e.Options.DragCue = dragCue; |
||
91 | |||
92 | |||
93 | //PayLoadAdorner = new AdornerFinal(); |
||
94 | //DeepView.ServiceDeepView_Symbol.SymbolPrivate tempDragableControl = (e.Options.Source as System.Windows.Controls.ListBox).SelectedItem as DeepView.ServiceDeepView_Symbol.SymbolPrivate; |
||
95 | //var xamldata = tempDragableControl.Data; |
||
96 | ////this.DeepLayer.markupParse(xamldata, this.DeepLayer._TempLayer, "복사된 데이터_이름으로 수정해야함"); |
||
97 | //PayLoadAdorner = this.DeepLayer.markupParseToAdorner(xamldata, this.DeepLayer._SelectLayer, ""); |
||
98 | //this.DeepLayer._SelectLayer.Children.Add(PayLoadAdorner); |
||
99 | } |
||
100 | |||
101 | e.QueryResult = true; |
||
102 | e.Handled = true; |
||
103 | } |
||
104 | |||
105 | f65e6c02 | taeseongkim | private async Task DataBindAsync() |
106 | 787a4489 | KangIngu | { |
107 | 5ce56a3a | KangIngu | //lstSymbolPrivate.ItemsSource = null; |
108 | //lstSymbolPublic.ItemsSource = null; |
||
109 | 787a4489 | KangIngu | |
110 | Symbol_Custom Custom = new Symbol_Custom(); |
||
111 | ff01c725 | humkyung | List<Symbol_Custom> Custom_List = new List<Symbol_Custom>(); |
112 | |||
113 | try |
||
114 | { |
||
115 | |||
116 | f65e6c02 | taeseongkim | var symbol_Private = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetSymbolListAsync(App.ViewInfo.UserID); |
117 | ff01c725 | humkyung | |
118 | foreach (var item in symbol_Private) |
||
119 | { |
||
120 | Custom.Name = item.NAME; |
||
121 | Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL, App.isExternal); |
||
122 | Custom.ID = item.ID; |
||
123 | Custom_List.Add(Custom); |
||
124 | Custom = new Symbol_Custom(); |
||
125 | } |
||
126 | lstSymbolPrivate.ItemsSource = Custom_List; |
||
127 | } |
||
128 | catch (Exception ex) |
||
129 | 5ce56a3a | KangIngu | { |
130 | ff01c725 | humkyung | System.Diagnostics.Debug.WriteLine(ex.ToString()); |
131 | 6c781c0c | djkim | } |
132 | 5ce56a3a | KangIngu | |
133 | 6c781c0c | djkim | Custom = new Symbol_Custom(); |
134 | Custom_List = new List<Symbol_Custom>(); |
||
135 | 5ce56a3a | KangIngu | |
136 | f65e6c02 | taeseongkim | deptlist.ItemsSource = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetPublicSymbolDeptListAsync(); |
137 | 5ce56a3a | KangIngu | |
138 | 6c781c0c | djkim | List<SYMBOL_PUBLIC> symbol_Public; |
139 | 5ce56a3a | KangIngu | |
140 | 53880c83 | ljiyeon | |
141 | 6c781c0c | djkim | if (deptlist.SelectedValue != null) |
142 | { |
||
143 | f65e6c02 | taeseongkim | symbol_Public = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetPublicSymbolListAsync(deptlist.SelectedValue.ToString()); |
144 | 6c781c0c | djkim | } |
145 | else |
||
146 | { |
||
147 | f65e6c02 | taeseongkim | symbol_Public = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetPublicSymbolListAsync(null); |
148 | 5ce56a3a | KangIngu | } |
149 | 223975f7 | taeseongkim | |
150 | 6c781c0c | djkim | foreach (var item in symbol_Public) |
151 | { |
||
152 | Custom.Name = item.NAME; |
||
153 | 19391ad3 | djkim | Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL, App.isExternal); |
154 | 6c781c0c | djkim | Custom.ID = item.ID; |
155 | Custom_List.Add(Custom); |
||
156 | Custom = new Symbol_Custom(); |
||
157 | } |
||
158 | f65e6c02 | taeseongkim | |
159 | 223975f7 | taeseongkim | lstSymbolPublic.ItemsSource = Custom_List; |
160 | 5ce56a3a | KangIngu | } |
161 | |||
162 | public PngBitmapEncoder symImage(string data) |
||
163 | { |
||
164 | |||
165 | Canvas _canvas = new Canvas(); |
||
166 | _canvas.Background = Brushes.White; |
||
167 | _canvas.Width = finalItem.BorderSize.Width; |
||
168 | _canvas.Height = finalItem.BorderSize.Height; |
||
169 | 5529d2a2 | humkyung | MarkupParser.Parse(App.ViewInfo.ProjectNO, data, _canvas, "#FFFF0000", ""); |
170 | 5ce56a3a | KangIngu | |
171 | BitmapEncoder encoder = new PngBitmapEncoder(); |
||
172 | |||
173 | |||
174 | RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32); |
||
175 | |||
176 | DrawingVisual dv = new DrawingVisual(); |
||
177 | |||
178 | _canvas.Measure(new System.Windows.Size(finalItem.BorderSize.Width + 50, finalItem.BorderSize.Height + 50)); |
||
179 | //_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))); |
||
180 | _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))); |
||
181 | |||
182 | using (DrawingContext ctx = dv.RenderOpen()) |
||
183 | { |
||
184 | VisualBrush vb = new VisualBrush(_canvas); |
||
185 | //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))); |
||
186 | 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))); |
||
187 | } |
||
188 | |||
189 | try |
||
190 | { |
||
191 | renderBitmap.Render(dv); |
||
192 | |||
193 | GC.Collect(); |
||
194 | GC.WaitForPendingFinalizers(); |
||
195 | GC.Collect(); |
||
196 | //bitmap.Render(controlToConvert); |
||
197 | // encode png data |
||
198 | PngBitmapEncoder pngEncoder = new PngBitmapEncoder(); |
||
199 | // puch rendered bitmap into it |
||
200 | pngEncoder.Interlace = PngInterlaceOption.Off; |
||
201 | pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap)); |
||
202 | return pngEncoder; |
||
203 | |||
204 | } |
||
205 | 53880c83 | ljiyeon | catch //(Exception ex) |
206 | 5ce56a3a | KangIngu | { |
207 | return null; |
||
208 | } |
||
209 | 787a4489 | KangIngu | |
210 | } |
||
211 | |||
212 | 5ce56a3a | KangIngu | public void DialogMessage_Alert(string content, string header) |
213 | { |
||
214 | DialogParameters parameters = new DialogParameters() |
||
215 | { |
||
216 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
217 | 0d32593b | ljiyeon | Content = new TextBlock() |
218 | { |
||
219 | MinWidth = 400, |
||
220 | FontSize = 11, |
||
221 | Text = content, |
||
222 | TextWrapping = System.Windows.TextWrapping.Wrap |
||
223 | }, |
||
224 | 5ce56a3a | KangIngu | Header = header, |
225 | Theme = new VisualStudio2013Theme(), |
||
226 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
227 | }; |
||
228 | RadWindow.Alert(parameters); |
||
229 | } |
||
230 | |||
231 | #region Event |
||
232 | |||
233 | 498f0fc9 | ljiyeon | #region Private Symbol Add Event |
234 | 787a4489 | KangIngu | private void Create_Symbol(object sender, RoutedEventArgs e) |
235 | { |
||
236 | 5529d2a2 | humkyung | MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn(); |
237 | 787a4489 | KangIngu | |
238 | if (Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면 |
||
239 | { |
||
240 | DialogMessage_Alert("Please Select Controls", "Alert"); |
||
241 | } |
||
242 | else //선택된 것이 있으면 |
||
243 | { |
||
244 | string MarkupData = ""; |
||
245 | finalItem = new AdornerFinal(); |
||
246 | |||
247 | foreach (var item in Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children) |
||
248 | { |
||
249 | if (item.GetType().Name == "AdornerFinal") |
||
250 | { |
||
251 | finalItem = (item as Controls.AdornerFinal); |
||
252 | 4913851c | humkyung | foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>()) |
253 | 787a4489 | KangIngu | { |
254 | if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
||
255 | { |
||
256 | 5529d2a2 | humkyung | markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
257 | 787a4489 | KangIngu | MarkupData += markupReturn.ConvertData; |
258 | } |
||
259 | } |
||
260 | } |
||
261 | } |
||
262 | DialogParameters parameters = new DialogParameters() |
||
263 | { |
||
264 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
265 | 53880c83 | ljiyeon | Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args), |
266 | 787a4489 | KangIngu | DefaultPromptResultValue = "Custom State", |
267 | Content = "Name :", |
||
268 | Header = "Insert Custom Symbol Name", |
||
269 | Theme = new VisualStudio2013Theme(), |
||
270 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
271 | }; |
||
272 | RadWindow.Prompt(parameters); |
||
273 | } |
||
274 | |||
275 | } |
||
276 | 5ce56a3a | KangIngu | #endregion |
277 | 787a4489 | KangIngu | |
278 | 5ce56a3a | KangIngu | #region Symbol Add Close Event |
279 | f65e6c02 | taeseongkim | private async void MarkupNamePromptClose(string data, WindowClosedEventArgs args) |
280 | 787a4489 | KangIngu | { |
281 | c73426a9 | ljiyeon | try |
282 | 787a4489 | KangIngu | { |
283 | c73426a9 | ljiyeon | if (args.PromptResult != null) |
284 | 53880c83 | ljiyeon | { |
285 | c73426a9 | ljiyeon | if (args.DialogResult.Value) |
286 | { |
||
287 | PngBitmapEncoder _Encoder = symImage(data); |
||
288 | 787a4489 | KangIngu | |
289 | c73426a9 | ljiyeon | System.IO.MemoryStream fs = new System.IO.MemoryStream(); |
290 | _Encoder.Save(fs); |
||
291 | System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs); |
||
292 | 787a4489 | KangIngu | |
293 | c73426a9 | ljiyeon | byte[] Img_byte = fs.ToArray(); |
294 | 787a4489 | KangIngu | |
295 | c73426a9 | ljiyeon | kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
296 | 24678e06 | humkyung | filename = fileUploader.Run(App.ViewInfo.ProjectNO, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte); |
297 | c73426a9 | ljiyeon | Check_Uri.UriCheck(filename); |
298 | if (RadTab.SelectedIndex == 0) |
||
299 | { |
||
300 | SymbolSave(args.PromptResult, filename, data); |
||
301 | } |
||
302 | else |
||
303 | { |
||
304 | SymbolSave_Public(args.PromptResult, filename, data, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
||
305 | } |
||
306 | 53880c83 | ljiyeon | |
307 | f65e6c02 | taeseongkim | await DataBindAsync(); |
308 | 53880c83 | ljiyeon | } |
309 | 498f0fc9 | ljiyeon | } |
310 | 53880c83 | ljiyeon | } |
311 | c73426a9 | ljiyeon | catch(Exception ex) |
312 | { |
||
313 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert"); |
||
314 | } |
||
315 | 53880c83 | ljiyeon | } |
316 | #endregion |
||
317 | |||
318 | public void SymbolSave(string Name, string Url, string Data) |
||
319 | { |
||
320 | try |
||
321 | { |
||
322 | SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE |
||
323 | 498f0fc9 | ljiyeon | { |
324 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
325 | 53880c83 | ljiyeon | MEMBER_USER_ID = App.ViewInfo.UserID, |
326 | NAME = Name, |
||
327 | IMAGE_URL = Url, |
||
328 | DATA = Data |
||
329 | }; |
||
330 | 5ce56a3a | KangIngu | |
331 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted; |
332 | Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1); |
||
333 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
||
334 | } |
||
335 | catch (Exception) |
||
336 | { |
||
337 | throw; |
||
338 | 787a4489 | KangIngu | } |
339 | } |
||
340 | 53880c83 | ljiyeon | |
341 | public void SymbolSave_Public(string Name, string Url, string Data, string Department) |
||
342 | { |
||
343 | try |
||
344 | { |
||
345 | SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC |
||
346 | { |
||
347 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
348 | 53880c83 | ljiyeon | DEPARTMENT = Department, |
349 | NAME = Name, |
||
350 | IMAGE_URL = Url, |
||
351 | DATA = Data |
||
352 | }; |
||
353 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted; |
||
354 | Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1); |
||
355 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public); |
||
356 | } |
||
357 | catch (Exception) |
||
358 | { |
||
359 | throw; |
||
360 | } |
||
361 | } |
||
362 | |||
363 | f65e6c02 | taeseongkim | private async void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e) |
364 | 53880c83 | ljiyeon | { |
365 | Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
366 | f65e6c02 | taeseongkim | await DataBindAsync(); |
367 | 53880c83 | ljiyeon | } |
368 | |||
369 | f65e6c02 | taeseongkim | private async void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e) |
370 | 53880c83 | ljiyeon | { |
371 | Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
372 | f65e6c02 | taeseongkim | await DataBindAsync(); |
373 | 53880c83 | ljiyeon | } |
374 | 787a4489 | KangIngu | |
375 | 498f0fc9 | ljiyeon | #region Private Symbol Delete Event |
376 | 5ce56a3a | KangIngu | private void Remove_Symbol(object sender, RoutedEventArgs e) |
377 | 787a4489 | KangIngu | { |
378 | 5ce56a3a | KangIngu | if (lstSymbolPrivate.SelectedItem == null) |
379 | { |
||
380 | DialogMessage_Alert("Please Select Symbol", "Alert"); |
||
381 | return; |
||
382 | } |
||
383 | 6c781c0c | djkim | string delItem_ID = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID; |
384 | 0f065e57 | ljiyeon | |
385 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted; |
386 | 0f065e57 | ljiyeon | Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1); |
387 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex); |
388 | 498f0fc9 | ljiyeon | } |
389 | #endregion |
||
390 | #region Public Symbol Delete Event |
||
391 | private void Remove_Symbol_Public(object sender, RoutedEventArgs e) |
||
392 | { |
||
393 | if (lstSymbolPublic.SelectedItem == null) |
||
394 | { |
||
395 | DialogMessage_Alert("Please Select Symbol", "Alert"); |
||
396 | return; |
||
397 | } |
||
398 | string delItem_ID = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID; |
||
399 | |||
400 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted; |
||
401 | Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1); |
||
402 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex); |
||
403 | 6c781c0c | djkim | } |
404 | 787a4489 | KangIngu | |
405 | f65e6c02 | taeseongkim | private async void BaseClient_DeleteSymbolCompleted(object sender, ServiceDeepView.DeleteSymbolCompletedEventArgs e) |
406 | 6c781c0c | djkim | { |
407 | 0f065e57 | ljiyeon | Logger.sendResLog("DeleteSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
408 | f65e6c02 | taeseongkim | await DataBindAsync(); |
409 | 5ce56a3a | KangIngu | } |
410 | #endregion |
||
411 | 787a4489 | KangIngu | |
412 | 34c8d43a | ljiyeon | public Undo_data UndoData { get; set; } |
413 | 702abd98 | humkyung | /// <summary> |
414 | /// place symbol which has given id to original position which is created |
||
415 | /// </summary> |
||
416 | /// <date>2018.06.14</date> |
||
417 | /// <param name="id"></param> |
||
418 | c7fde400 | taeseongkim | private void PlaceSymbol(string id,Point CurrentMousePoint) |
419 | 5ce56a3a | KangIngu | { |
420 | 702abd98 | humkyung | string Data_ = ""; |
421 | 787a4489 | KangIngu | |
422 | c7fde400 | taeseongkim | var systemMain = Common.ViewerDataModel.Instance.SystemMain; |
423 | var mainMenu = systemMain.dzMainMenu; |
||
424 | |||
425 | SelectionSet.Instance.UnSelect(mainMenu); /// unselect alreay selected items |
||
426 | |||
427 | 702abd98 | humkyung | try |
428 | 5ce56a3a | KangIngu | { |
429 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetSymbolData: ", id + "," + RadTab.SelectedIndex, 1); |
430 | c7fde400 | taeseongkim | Data_ = mainMenu.BaseClient.GetSymbolData(id, RadTab.SelectedIndex); |
431 | |||
432 | 0f065e57 | ljiyeon | if (Data_ != null || Data_ != "") |
433 | { |
||
434 | Logger.sendResLog("GetSymbolData", "TRUE", 1); |
||
435 | } |
||
436 | else |
||
437 | { |
||
438 | Logger.sendResLog("GetSymbolData", "FALSE", 1); |
||
439 | } |
||
440 | 787a4489 | KangIngu | |
441 | 53880c83 | ljiyeon | //MARKUP_DATA_GROUP INSERT |
442 | c0977e97 | djkim | //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP |
443 | //{ |
||
444 | // SYMBOL_ID = id,//InnerItem.Symbol_ID |
||
445 | // STATE = 0, |
||
446 | //}; |
||
447 | //long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO); |
||
448 | //Logger.sendReqLog("AddMarkupDataGroup: ", "", 1); |
||
449 | 53880c83 | ljiyeon | |
450 | 5ce56a3a | KangIngu | if (Data_.Contains("|DZ|")) |
451 | { |
||
452 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
453 | |||
454 | string[] delimiterChars = { "|DZ|" }; |
||
455 | string[] data = Data_.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
||
456 | |||
457 | 34c8d43a | ljiyeon | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
458 | UndoData = new Undo_data() |
||
459 | { |
||
460 | IsUndo = false, |
||
461 | Event = Event_Type.Create, |
||
462 | EventTime = DateTime.Now, |
||
463 | Markup_List = new List<Multi_Undo_data>() |
||
464 | }; |
||
465 | ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
||
466 | { |
||
467 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
468 | }); |
||
469 | |||
470 | foreach (string parse in data) |
||
471 | 5ce56a3a | KangIngu | { |
472 | if (parse != "") |
||
473 | { |
||
474 | 5529d2a2 | humkyung | System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty); |
475 | 24678e06 | humkyung | (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid(); |
476 | c8e9b3e4 | ljiyeon | (item as MarkupToPDF.Common.CommentUserInfo).SymbolID = id; |
477 | c0977e97 | djkim | //(item as MarkupToPDF.Common.CommentUserInfo).GroupID = group_id; |
478 | c7fde400 | taeseongkim | |
479 | 5ce56a3a | KangIngu | ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
480 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
||
481 | 53880c83 | ljiyeon | |
482 | 5ce56a3a | KangIngu | adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
483 | 34c8d43a | ljiyeon | |
484 | multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
||
485 | |||
486 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
487 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
488 | 5ce56a3a | KangIngu | } |
489 | } |
||
490 | c7fde400 | taeseongkim | |
491 | 5ce56a3a | KangIngu | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
492 | |||
493 | c7fde400 | taeseongkim | // 마우스 클릭된 페이지 위치 |
494 | |||
495 | var pageWidth = mainMenu.pageNavigator.CurrentPage.Width; |
||
496 | var pageHeight = mainMenu.pageNavigator.CurrentPage.Height; |
||
497 | var angle = Common.ViewerDataModel.Instance.Angle; |
||
498 | |||
499 | Point pagePoint = new Point(pageWidth/2, pageHeight/2); |
||
500 | |||
501 | var rotatePoint = Rotate(mainMenu.CanvasDrawingMouseDownPoint,pagePoint,angle); |
||
502 | |||
503 | var diff = Point.Subtract(rotatePoint, final.Centeroid); |
||
504 | 6b6e937c | taeseongkim | final.TranslateItems(diff.X, diff.Y); |
505 | c7fde400 | taeseongkim | |
506 | mainMenu.SelectLayer.Children.Add(final); |
||
507 | //var finalPosition = new Point(Canvas.GetLeft(final), Canvas.GetTop(final)); |
||
508 | //Rect rect = new Rect(finalPosition, Point.Add(finalPosition,new Vector(final.Width,final.Height))); |
||
509 | |||
510 | //SelectionSet.Instance.SelectItemByRect(final.getAdornerSize(), mainMenu); |
||
511 | |||
512 | 5ce56a3a | KangIngu | } |
513 | 53880c83 | ljiyeon | else |
514 | { |
||
515 | c0977e97 | djkim | PlaceImageSymbol(id, 0); |
516 | 53880c83 | ljiyeon | } |
517 | } |
||
518 | catch (Exception ex) |
||
519 | { |
||
520 | this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error"); |
||
521 | } |
||
522 | } |
||
523 | |||
524 | c7fde400 | taeseongkim | |
525 | //출처: https://icodebroker.tistory.com/3189 [ICODEBROKER] |
||
526 | public Point Rotate(Point sourcePoint, Point centerPoint, double rotateAngle) |
||
527 | { |
||
528 | Point targetPoint = new Point(); |
||
529 | |||
530 | double radian = rotateAngle / 180 * Math.PI; |
||
531 | |||
532 | targetPoint.X = Math.Cos(radian) * (sourcePoint.X - centerPoint.X) - Math.Sin(radian) * (sourcePoint.Y - centerPoint.Y) + centerPoint.X; |
||
533 | targetPoint.Y = Math.Sin(radian) * (sourcePoint.X - centerPoint.X) + Math.Cos(radian) * (sourcePoint.Y - centerPoint.Y) + centerPoint.Y; |
||
534 | |||
535 | return targetPoint; |
||
536 | } |
||
537 | |||
538 | |||
539 | |||
540 | 53880c83 | ljiyeon | private void PlaceImageSymbol(string id, long group_id) |
541 | { |
||
542 | |||
543 | //canvasZoommovingMouseDownPoint |
||
544 | string Data_ = ""; |
||
545 | |||
546 | try |
||
547 | { |
||
548 | Logger.sendReqLog("GetSymbolImageURL: ", id + "," + RadTab.SelectedIndex, 1); |
||
549 | Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, RadTab.SelectedIndex); |
||
550 | if (Data_ != null || Data_ != "") |
||
551 | { |
||
552 | Logger.sendResLog("GetSymbolImageURL", "TRUE", 1); |
||
553 | } |
||
554 | else |
||
555 | { |
||
556 | Logger.sendResLog("GetSymbolImageURL", "FALSE", 1); |
||
557 | } |
||
558 | |||
559 | //MARKUP_DATA_GROUP INSERT |
||
560 | c0977e97 | djkim | //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP |
561 | //{ |
||
562 | // SYMBOL_ID = id,//InnerItem.Symbol_ID |
||
563 | // STATE = 0, |
||
564 | //}; |
||
565 | 53880c83 | ljiyeon | //long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO); |
566 | //Logger.sendReqLog("AddMarkupDataGroup: ", "", 1); |
||
567 | |||
568 | if (Data_ != null) |
||
569 | { |
||
570 | Image img = new Image(); |
||
571 | //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_)); |
||
572 | if (Data_.Contains(".svg")) |
||
573 | { |
||
574 | byte[] imageData = null; |
||
575 | DrawingImage image = null; |
||
576 | using (System.Net.WebClient web = new System.Net.WebClient()) |
||
577 | { |
||
578 | imageData = web.DownloadData(new Uri(Data_)); |
||
579 | System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
||
580 | image = SvgReader.Load(stream); |
||
581 | } |
||
582 | img.Source = image; |
||
583 | } |
||
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 | be31927d | djkim | 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 | 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 | Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1); |
||
813 | 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 | Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1); |
||
821 | 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 | 0f065e57 | ljiyeon | 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 | ViewerDataModel.Instance.PageNumber = 0; |
||
967 | 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 | Logger.sendResLog("SyncInit", ex.Message, 0); |
||
976 | } |
||
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 | Logger.sendResLog("Move_Symbol", type.Name, 0); |
||
1003 | 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 | Logger.sendReqLog("RenameSymbolAsync: ", id + "," + _name, 1); |
||
1024 | 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 | Logger.sendReqLog("RenameSymbolAsync: ", id + "," + _name, 1); |
||
1032 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(id, _name, RadTab.SelectedIndex); |
||
1033 | } |
||
1034 | |||
1035 | } |
||
1036 | ffcc8124 | ljiyeon | } |
1037 | 8e5a4a6a | taeseongkim | |
1038 | 787a4489 | KangIngu | } |
1039 | } |