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