프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM / Controls / Symbol.xaml.cs @ 5a223b60

이력 | 보기 | 이력해설 | 다운로드 (46.8 KB)

1
using IKCOM;
2
using KCOM.Common;
3
using KCOM.Events;
4
using KCOMDataModel.Common;
5
using KCOMDataModel.DataModel;
6
using MarkupToPDF.Common;
7
using MarkupToPDF.Controls.Parsing;
8
using System;
9
using System.Collections.Generic;
10
using System.ComponentModel;
11
using System.Linq;
12
using System.Text;
13
using System.Threading.Tasks;
14
using System.Windows;
15
using System.Windows.Controls;
16
using System.Windows.Data;
17
using System.Windows.Documents;
18
using System.Windows.Input;
19
using System.Windows.Media;
20
using System.Windows.Media.Imaging;
21
using System.Windows.Navigation;
22
using System.Windows.Shapes;
23
using Telerik.Windows.Controls;
24
using Telerik.Windows.Controls.DragDrop;
25

    
26
namespace KCOM.Controls
27
{
28
    public class Symbol_Custom
29
    {
30
        public string ID { get; set; }
31
        public string Name { get; set; }
32
        public string ImageUri { get; set; }
33
    }
34

    
35
    /// <summary>
36
    /// Symbol.xaml에 대한 상호 작용 논리
37
    /// </summary>
38
    public partial class Symbol : UserControl
39
    {
40
        AdornerFinal finalItem;
41
        bool IsMouseDown = false;
42
        string moveItem_id = "";
43
        public string filename { get; set; }
44
        bool _Initialize = false;
45

    
46
        public Symbol()
47
        {
48
            //App.splashString(ISplashMessage.SYMBOL);
49
            InitializeComponent();
50

    
51
            //RadDragAndDropManager.AddDragInfoHandler(lstSymbolPrivate, OnDragPrivateInfo);
52
            //RadDragAndDropManager.AddDragQueryHandler(lstSymbolPrivate, OnDragPrivateQuery);
53
            //RadDragAndDropManager.SetAllowDrag(lstSymbolPrivate, true);
54
            this.Loaded += Symbol_Loaded;
55
 
56
        }
57

    
58
        
59

    
60
        private async void Symbol_Loaded(object sender, RoutedEventArgs e)
61
        {
62
            if (!App.IsDesignMode)
63
            {
64
                if (!_Initialize)
65
                {
66
                    _Initialize = true;
67
                    await DataBindAsync();
68

    
69
                }
70
            }
71
        }
72

    
73
        private void OnDragPrivateInfo(object sender, DragDropEventArgs e)
74
        {
75
        }
76

    
77
        private void OnDragPrivateQuery(object sender, DragDropQueryEventArgs e)
78
        {
79
            if (e.Options.Status == DragStatus.DragQuery)
80
            {
81
                //var draggedListBoxItem = (e.Options.Source as System.Windows.Controls.ListBox).SelectedItem;
82
                //BitmapImage im = new BitmapImage(new Uri((draggedListBoxItem as DeepView.ServiceDeepView_Symbol.SymbolPrivate).ImageUri));
83
                //ImageSource _source = im;
84
                //Image img = new Image();
85
                //img.Source = _source;
86

    
87
                //e.Options.Payload = im;
88
                //var dragCue = new Image();
89
                //dragCue.Source = img.Source;
90
                //dragCue.Width = 0;
91
                //dragCue.Height = 0;
92
                //e.Options.DragCue = dragCue;
93

    
94

    
95
                //PayLoadAdorner = new AdornerFinal();
96
                //DeepView.ServiceDeepView_Symbol.SymbolPrivate tempDragableControl = (e.Options.Source as System.Windows.Controls.ListBox).SelectedItem as DeepView.ServiceDeepView_Symbol.SymbolPrivate;
97
                //var xamldata = tempDragableControl.Data;
98
                ////this.DeepLayer.markupParse(xamldata, this.DeepLayer._TempLayer, "복사된 데이터_이름으로 수정해야함");
99
                //PayLoadAdorner = this.DeepLayer.markupParseToAdorner(xamldata, this.DeepLayer._SelectLayer, "");
100
                //this.DeepLayer._SelectLayer.Children.Add(PayLoadAdorner);
101
            }
102

    
103
            e.QueryResult = true;
104
            e.Handled = true;
105
        }
106

    
107
        private async Task DataBindAsync()
108
        {
109
            //lstSymbolPrivate.ItemsSource = null;
110
            //lstSymbolPublic.ItemsSource = null;
111

    
112
            Symbol_Custom Custom = new Symbol_Custom();
113
            List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();
114

    
115
            try
116
            {
117

    
118
                var symbol_Private = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetSymbolListAsync(App.ViewInfo.UserID);
119

    
120
                foreach (var item in symbol_Private)
121
                {
122
                    Custom.Name = item.NAME;
123
                    Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL.Replace("//","/").Replace(":/", "://"), App.isExternal);
124
                    Custom.ID = item.ID;
125
                    Custom_List.Add(Custom);
126
                    Custom = new Symbol_Custom();
127
                }
128
                lstSymbolPrivate.ItemsSource = Custom_List;
129
            }
130
            catch (Exception ex)
131
            {
132
                System.Diagnostics.Debug.WriteLine(ex.ToString());
133
            }
134

    
135
            Custom = new Symbol_Custom();
136
            Custom_List = new List<Symbol_Custom>();
137

    
138
            deptlist.ItemsSource = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetPublicSymbolDeptListAsync();
139

    
140
            List<SYMBOL_PUBLIC> symbol_Public;
141

    
142

    
143
            if (deptlist.SelectedValue != null)
144
            {
145
                symbol_Public = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetPublicSymbolListAsync(deptlist.SelectedValue.ToString());
146
            }
147
            else
148
            {
149
                symbol_Public = await ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseTaskClient.GetPublicSymbolListAsync(null);
150
            }
151

    
152
            if (symbol_Public != null)
153
            {
154
                foreach (var item in symbol_Public)
155
                {
156
                    Custom.Name = item.NAME;
157
                    Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL.Replace("//", "/").Replace(":/", "://"), App.isExternal);
158
                    Custom.ID = item.ID;
159
                    Custom_List.Add(Custom);
160
                    Custom = new Symbol_Custom();
161
                }
162

    
163
                lstSymbolPublic.ItemsSource = Custom_List;
164
            }
165
        }
166

    
167
        public async Task<PngBitmapEncoder> symImageAsync_old(string data,double PageAngle)
168
        {
169

    
170
            Canvas _canvas = new Canvas();
171
            _canvas.Background = Brushes.White;
172
            _canvas.Width = finalItem.BorderSize.Width;
173
            _canvas.Height = finalItem.BorderSize.Height;
174
            await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas, PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.NewMarkupCancelToken(),
175
                STAMP_Contents: App.SystemInfo.STAMP_CONTENTS);
176

    
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
            catch //(Exception ex)
212
            {
213
                return null;
214
            }
215

    
216
        }
217

    
218
        public async Task<PngBitmapEncoder> symImageAsync(string data, double PageAngle)
219
        {
220

    
221
            Canvas _canvas = new Canvas();
222
            _canvas.Background = Brushes.White;
223

    
224
            List<Rect> rects = new List<Rect>();
225

    
226
            finalItem.Members.ForEach(member =>
227
            {
228
                if(member?.DrawingData is MarkupToPDF.ICommentRect comment)
229
                {
230
                    rects.Add(comment.GetCommentRect());
231
                }
232
            });
233

    
234
            var rect = MathHelper.CombineRects(rects);
235

    
236
            _canvas.Width = rect.Width;
237
            _canvas.Height = rect.Height;
238

    
239
            await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas, PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.NewMarkupCancelToken(),
240
                STAMP_Contents: App.SystemInfo.STAMP_CONTENTS);
241

    
242
            BitmapEncoder encoder = new PngBitmapEncoder();
243
            RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)rect.Width, (int)rect.Height, 96d, 96d, PixelFormats.Pbgra32);
244

    
245
            DrawingVisual dv = new DrawingVisual();
246
            //Window window = new Window();
247
            //window.Content = _canvas;
248
            //var result = window.ShowDialog();
249
            //if(result.GetValueOrDefault())
250
            //{
251

    
252
            //}
253

    
254
            _canvas.Measure(rect.Size);
255
            _canvas.Arrange(new Rect(new System.Windows.Point { X = -rect.X + 35, Y = -rect.Y + 35 }, new Point(rect.Width + 35, rect.Height + 35)));
256

    
257
            using (DrawingContext ctx = dv.RenderOpen())
258
            {
259
                VisualBrush vb = new VisualBrush(_canvas);
260
                ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point { X = -rect.X, Y = -rect.Y }, new Point(rect.Width, rect.Height)));
261
            }
262
            Window window2 = new Window();
263
            window2.Content = _canvas;
264
            var result2 = window2.ShowDialog();
265
            if (result2.GetValueOrDefault())
266
            {
267

    
268
            }
269
            try
270
            {
271
                renderBitmap.Render(dv);
272

    
273
                GC.Collect();
274
                GC.WaitForPendingFinalizers();
275
                GC.Collect();
276
                //bitmap.Render(controlToConvert);
277
                // encode png data
278
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
279
                // puch rendered bitmap into it
280
                pngEncoder.Interlace = PngInterlaceOption.Off;
281
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
282
                return pngEncoder;
283

    
284
            }
285
            catch //(Exception ex)
286
            {
287
                return null;
288
            }
289

    
290
        }
291

    
292
        public void DialogMessage_Alert(string content, string header)
293
        {
294
            App.splashScreen.Close();
295

    
296
            DialogParameters parameters = new DialogParameters()
297
            {
298
                Owner = Application.Current.MainWindow,
299
                Content = new TextBlock()
300
                {
301
                    MinWidth = 400,
302
                    FontSize = 11,
303
                    Text = content,
304
                    TextWrapping = System.Windows.TextWrapping.Wrap
305
                },
306
                Header = header,
307
                Theme = new VisualStudio2013Theme(),
308
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
309
            };
310
            RadWindow.Alert(parameters);
311
        }
312

    
313
        #region Event
314

    
315
        #region Private Symbol Add Event
316
        private void Create_Symbol(object sender, RoutedEventArgs e)
317
        {
318
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
319

    
320
            if (Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
321
            {
322
                DialogMessage_Alert("Please Select Controls", "Alert");
323
            }
324
            else //선택된 것이 있으면
325
            {
326
                string MarkupData = "";
327
                finalItem = new AdornerFinal();
328

    
329
                foreach (var item in Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children)
330
                {
331
                    if (item.GetType().Name == "AdornerFinal")
332
                    {
333
                        finalItem = (item as Controls.AdornerFinal);
334
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
335
                        {
336
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
337
                            {
338
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
339
                                MarkupData += markupReturn.ConvertData;
340
                            }
341
                        }
342
                    }
343
                }
344
                DialogParameters parameters = new DialogParameters()
345
                {
346
                    Owner = Application.Current.MainWindow,
347
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
348
                    DefaultPromptResultValue = "Custom State",
349
                    Content = "Name :",
350
                    Header = "Insert Custom Symbol Name",
351
                    Theme = new VisualStudio2013Theme(),
352
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
353
                };
354
                RadWindow.Prompt(parameters);
355
            }
356

    
357
        }
358
        #endregion
359

    
360
        #region Symbol Add Close Event 
361
        private async void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
362
        {
363
            try
364
            {
365
                if (args.PromptResult != null)
366
                {
367
                    if (args.DialogResult.Value)
368
                    {
369
                        PngBitmapEncoder _Encoder = null;
370
                        
371
                        if (finalItem.Members.Any(x=> x.DrawingData is MarkupToPDF.ICommentRect comment))
372
                        {
373
                            _Encoder = await symImageAsync(data, ViewerDataModel.Instance.MarkupAngle);
374
                        }
375
                        else
376
                        {
377
                            _Encoder = await symImageAsync_old(data, ViewerDataModel.Instance.MarkupAngle);
378
                        }
379

    
380
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
381
                        _Encoder.Save(fs);
382
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
383

    
384
                        byte[] Img_byte = fs.ToArray();
385

    
386
                        kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
387
                        filename = fileUploader.RunSymbol(App.ViewInfo.ProjectNO, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.ShortGuid() + ".png", Img_byte);
388
                        Check_Uri.UriCheck(filename);
389
                        if (RadTab.SelectedIndex == 0)
390
                        {
391
                            SymbolSave(args.PromptResult, filename, data);
392
                        }
393
                        else
394
                        {
395
                            SymbolSave_Public(args.PromptResult, filename, data, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
396
                        }
397

    
398
                        await DataBindAsync();
399
                    }
400
                }
401
            }
402
            catch(Exception ex)
403
            {
404
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert");
405
            }
406
        }
407
        #endregion
408

    
409
        public void SymbolSave(string Name, string Url, string Data)
410
        {
411
            try
412
            {
413
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
414
                {
415
                    ID = Commons.ShortGuid(),
416
                    MEMBER_USER_ID = App.ViewInfo.UserID,
417
                    NAME = Name,
418
                    IMAGE_URL = Url,
419
                    DATA = Data
420
                };
421

    
422
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
423
                //Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
424
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
425
            }
426
            catch (Exception)
427
            {
428
                throw;
429
            }
430
        }
431

    
432
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
433
        {
434
            try
435
            {
436
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
437
                {
438
                    ID = Commons.ShortGuid(),
439
                    DEPARTMENT = Department,
440
                    NAME = Name,
441
                    IMAGE_URL = Url,
442
                    DATA = Data
443
                };
444
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
445
                //Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
446
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
447
            }
448
            catch (Exception)
449
            {
450
                throw;
451
            }
452
        }
453

    
454
        private async void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
455
        {
456
            //Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
457
            await DataBindAsync();
458
        }
459

    
460
        private async void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
461
        {
462
            //Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
463
            await DataBindAsync();
464
        }
465

    
466
        #region Private Symbol Delete Event
467
        private void Remove_Symbol(object sender, RoutedEventArgs e)
468
        {
469
            if (lstSymbolPrivate.SelectedItem == null)
470
            {
471
                DialogMessage_Alert("Please Select Symbol", "Alert");
472
                return;
473
            }
474
            string delItem_ID = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID;
475

    
476
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted;
477
            //Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1);
478
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex);
479
        }
480
        #endregion
481
        #region Public Symbol Delete Event
482
        private void Remove_Symbol_Public(object sender, RoutedEventArgs e)
483
        {
484
            if (lstSymbolPublic.SelectedItem == null)
485
            {
486
                DialogMessage_Alert("Please Select Symbol", "Alert");
487
                return;
488
            }
489
            string delItem_ID = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID;
490

    
491
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted;
492
            //Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1);
493
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex);
494
        }
495

    
496
        private async void BaseClient_DeleteSymbolCompleted(object sender, ServiceDeepView.DeleteSymbolCompletedEventArgs e)
497
        {
498
            //Logger.sendResLog("DeleteSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
499
             await DataBindAsync();
500
        }
501
        #endregion
502

    
503
        public UndoDataGroup UndoDataGroup { get; set; }
504

    
505
        /// <summary>
506
        /// place symbol which has given id to original position which is created
507
        /// </summary>
508
        /// <date>2018.06.14</date>
509
        /// <param name="id"></param>
510
        private async Task PlaceSymbol(string id, Point CurrentMousePoint)
511
        {
512
            string Data_ = "";
513

    
514
            var systemMain = Common.ViewerDataModel.Instance.SystemMain;
515
            var mainMenu = systemMain.dzMainMenu;
516
            
517
            SelectionSet.Instance.UnSelect(mainMenu);  /// unselect alreay selected items
518

    
519
            try
520
            {
521
                Data_ = mainMenu.BaseClient.GetSymbolData(id, RadTab.SelectedIndex);
522
                if (string.IsNullOrEmpty(Data_)) return;
523

    
524
                if (Data_.Contains("|DZ|"))
525
                {
526
                    List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
527

    
528
                    string[] delimiterChars = { "|DZ|" };
529
                    string[] data = Data_.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
530

    
531
                    UndoData multi_UndoData = new UndoData();
532
                    UndoDataGroup = new UndoDataGroup()
533
                    {
534
                        IsUndo = false,
535
                        Event = EventType.Create,
536
                        EventTime = DateTime.Now,
537
                        MarkupDataColl = new List<UndoData>()
538
                    };
539
                    ViewerDataModel.Instance.UndoDataList.Where(x => x.IsUndo).ToList().ForEach(i =>
540
                    {
541
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
542
                    });
543

    
544
                    foreach (string parse in data)
545
                    {
546
                        if (!string.IsNullOrEmpty(parse))
547
                        {
548
                            System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, string.Empty, string.Empty,
549
                                STAMP_Contents: App.SystemInfo.STAMP_CONTENTS);
550
                            (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.ShortGuid();
551
                            (item as MarkupToPDF.Common.CommentUserInfo).SymbolID = id;
552

    
553
                            adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
554

    
555
                            multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
556

    
557
                            UndoDataGroup.MarkupDataColl.Add(multi_UndoData);
558
                            ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup);
559
                        }
560
                    }
561

    
562
                    Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
563

    
564
                    // 마우스 클릭된 페이지 위치
565

    
566
                    var pageWidth = ViewerDataModel.Instance.ImageViewWidth;
567
                    var pageHeight = ViewerDataModel.Instance.ImageViewHeight;
568
                    var angle = Common.ViewerDataModel.Instance.MarkupAngle;
569

    
570
                    Point pagePoint = new Point(pageWidth/2, pageHeight/2);
571

    
572
                    var rotatePoint = Rotate(mainMenu.CanvasDrawingMouseDownPoint,pagePoint,angle);
573

    
574
                    var diff = Point.Subtract(rotatePoint, final.Centeroid);
575
                    final.TranslateItems(diff.X, diff.Y);
576

    
577
                    mainMenu.SelectLayer.Children.Add(final);
578

    
579

    
580
                    //var finalPosition = new Point(Canvas.GetLeft(final), Canvas.GetTop(final));
581
                    //Rect rect = new Rect(finalPosition, Point.Add(finalPosition,new Vector(final.Width,final.Height)));
582

    
583
                    //SelectionSet.Instance.SelectItemByRect(final.getAdornerSize(), mainMenu);
584

    
585
                }
586
                else
587
                {
588
                    PlaceImageSymbol(id, 0);
589
                }
590
            }
591
            catch (Exception ex)
592
            {
593
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
594
            }
595
        }
596

    
597

    
598
        //출처: https://icodebroker.tistory.com/3189 [ICODEBROKER]
599
        public Point Rotate(Point sourcePoint, Point centerPoint, double rotateAngle)
600
        {
601
            Point targetPoint = new Point();
602

    
603
            double radian = rotateAngle / 180 * Math.PI;
604

    
605
            targetPoint.X = Math.Cos(radian) * (sourcePoint.X - centerPoint.X) - Math.Sin(radian) * (sourcePoint.Y - centerPoint.Y) + centerPoint.X;
606
            targetPoint.Y = Math.Sin(radian) * (sourcePoint.X - centerPoint.X) + Math.Cos(radian) * (sourcePoint.Y - centerPoint.Y) + centerPoint.Y;
607

    
608
            return targetPoint;
609
        }
610

    
611

    
612

    
613
        private void PlaceImageSymbol(string id, long group_id)
614
        {
615
           
616
            //canvasZoommovingMouseDownPoint
617
            string Data_ = "";
618

    
619
            try
620
            {
621
                //Logger.sendReqLog("GetSymbolImageURL: ", id + "," + RadTab.SelectedIndex, 1);
622
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, RadTab.SelectedIndex);
623
                if (Data_ != null || Data_ != "")
624
                {
625
                    //Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
626
                }
627
                else
628
                {
629
                    //Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
630
                }
631

    
632
                //MARKUP_DATA_GROUP INSERT
633
                //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
634
                //{
635
                //    SYMBOL_ID = id,//InnerItem.Symbol_ID
636
                //    STATE = 0,
637
                //};
638
                //long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
639
                ////Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
640

    
641
                if (Data_ != null)
642
                {
643
                    Image img = new Image();
644
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
645
                    if (Data_.Contains(".svg"))
646
                    {
647
                        SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(Data_);
648
                        img.Source = (DrawingImage)svgImage.ProvideValue(null);
649
                    }
650
                    else
651
                    {
652
                        img.Source = new BitmapImage(new Uri(Data_));
653
                    }
654

    
655
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
656
                    {
657
                        PointSet = new List<Point>(),
658
                        FilePath = Data_,
659
                        ImageData = img.Source,
660
                        StartPoint = new Point(0, 0),
661
                        EndPoint = new Point(img.Source.Width, img.Source.Height),
662
                        TopRightPoint = new Point(img.Source.Width, 0),
663
                        LeftBottomPoint = new Point(0, img.Source.Height)
664
                    };
665

    
666
                    currentControl.PointSet = new List<Point>
667
                                        {
668
                                            currentControl.StartPoint,
669
                                            currentControl.LeftBottomPoint,
670
                                            currentControl.EndPoint,
671
                                            currentControl.TopRightPoint,
672
                                        };
673
                    UndoData multi_UndoData = new UndoData();
674
                    UndoDataGroup = new UndoDataGroup()
675
                    {
676
                        IsUndo = false,
677
                        Event = EventType.Create,
678
                        EventTime = DateTime.Now,
679
                        MarkupDataColl = new List<UndoData>()
680
                    };
681
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
682
                    {
683
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
684
                    });
685

    
686
                    //multi_UndoData = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
687
                    multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
688
                    UndoDataGroup.MarkupDataColl.Add(multi_UndoData);
689
                    ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup);
690

    
691
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
692
                    currentControl.CommentID = Commons.ShortGuid();
693
                    currentControl.SymbolID = id;
694
                    currentControl.GroupID = group_id;
695
                    currentControl.ApplyTemplate();
696
                    currentControl.SetImage();
697

    
698
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
699
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
700
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
701

    
702
                    /*
703
                    // this.ParentOfType<MainWindow>().dzMainMenu.isLeftMouseButtonDownOnWindow = true;
704
                    // final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
705
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
706
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
707
                      final.TranslateItems(realPointX, realPointY);
708
                    // move.control_Select(item, dragRect);
709
                    ApplyDragSelectionRect();
710
                    //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = MouseHandlingMode.DragSymbol;
711
                    ///this.ParentOfType<MainWindow>().dzMainMenu.mouseButtonDown = MouseButton.Left;
712
                    //this.ParentOfType<MainWindow>().dzMainMenu.symboldata(id, group_id, RadTab.SelectedIndex, Data_, img.Source);*/
713
                    
714
                }
715
            }
716
            catch(Exception ex)
717
            {
718
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
719
            }
720
        }
721

    
722
        public UndoData multi_UndoData;
723
        private void ApplyDragSelectionRect()
724
        {
725
            multi_UndoData = new UndoData();
726

    
727
            UndoDataGroup = new UndoDataGroup()
728
            {
729
                IsUndo = false,
730
                Event = EventType.Operation,
731
                EventTime = DateTime.Now,
732
                MarkupDataColl = new List<UndoData>()
733
            };
734

    
735
            this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Visibility = Visibility.Collapsed;
736

    
737
            double x = Canvas.GetLeft(this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder);
738
            double y = Canvas.GetTop(this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder);
739
            double width = this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Width;
740
            double height = this.ParentOfType<MainWindow>().dzMainMenu.dragSelectionBorder.Height;
741
            Rect dragRect = new Rect(x, y, width, height);
742
            Boolean Flag = false;
743
            dragRect.Inflate(width / 10, height / 10);
744
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
745
            var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList();
746

    
747
            dragRect = new Rect(x, y, width, height);
748
            dragRect.Inflate(width / 10, height / 10);
749

    
750
            //move.mousemode = MarkupToPDF.Controls.Common.MouseMode.Selecting;
751
            //move.
752
            foreach (var item in Items)
753
            {
754
                Flag = SelectionSet.Instance.SelectControl(item, dragRect);
755

    
756
                if (Flag)
757
                {
758
                    adornerSet.Add(item);
759
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(item);
760

    
761
                    this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item);
762
                    UndoDataGroup.MarkupDataColl.Add(multi_UndoData);
763
                    multi_UndoData = new UndoData();
764
                    if (item.GroupID > 0)
765
                    {
766

    
767
                    }
768
                }
769
            }
770
            if (adornerSet.Count > 0)
771
            {
772
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
773
                {
774
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
775
                });
776
                ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup);
777

    
778
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
779
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
780
            }
781
        }
782

    
783
        ///private Move move;
784
        #region Symbol DoubleClick Event
785
        private void Move_Symbol(object sender, MouseButtonEventArgs e)
786
        {
787
            try
788
            {
789
                Type type = e.OriginalSource.GetType();
790
                string id = string.Empty;
791
                //Logger.sendResLog("Move_Symbol", type.Name, 0);
792
                if (type.Name == "Image")
793
                {
794
                    id = ((e.OriginalSource as Image).DataContext as Symbol_Custom).ID;
795
                }
796
                else if (type.Name == "Border")
797
                {
798
                    id = ((e.OriginalSource as Border).DataContext as Symbol_Custom).ID;
799
                }
800
                else if (type.Name == "TextBox")
801
                {
802
                    id = ((e.OriginalSource as TextBox).DataContext as Symbol_Custom).ID;
803
                }
804

    
805
                IsMouseDown = true;
806

    
807
                if (e.ClickCount > 1)
808
                {
809
                    this.PlaceSymbol(id,ViewerDataModel.Instance.SystemMain.dzMainMenu.CanvasDrawingMouseDownPoint);
810
                }
811
            }
812
            catch(Exception ex)
813
            {
814
                //Logger.sendResLog("Move_Symbol", ex.Message, 0);
815
            }
816
        }
817
        #endregion
818

    
819
        #region Private Symbol Rename Event
820
        private void Rename_Symbol(object sender, RoutedEventArgs e)
821
        {
822
            if (lstSymbolPrivate.SelectedItem == null)
823
            {
824
                DialogMessage_Alert("Please Select Symbol", "Alert");
825
                return;
826
            }
827

    
828
            DialogParameters parameters = new DialogParameters()
829
            {
830
                Owner = Application.Current.MainWindow,
831
                Closed = (obj, args) => this.MarkupReNamePromptClose("", args),
832
                //DefaultPromptResultValue = "Custom State",
833
                DefaultPromptResultValue = (lstSymbolPrivate.SelectedItem as Symbol_Custom).Name,
834
                Content = "Name :",
835
                Header = "Update Custom Symbol Name",
836
                Theme = new VisualStudio2013Theme(),
837
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
838
            };
839
            RadWindow.Prompt(parameters);
840

    
841
        }
842
        #endregion
843

    
844
        #region Public Symbol Rename Event
845
        private void Rename_Symbol_Public(object sender, RoutedEventArgs e)
846
        {
847
            if (lstSymbolPublic.SelectedItem == null)
848
            {
849
                DialogMessage_Alert("Please Select Symbol", "Alert");
850
                return;
851
            }
852

    
853
            DialogParameters parameters = new DialogParameters()
854
            {
855
                Owner = Application.Current.MainWindow,
856
                Closed = (obj, args) => this.MarkupReNamePromptClose("", args),
857
                //DefaultPromptResultValue = "Custom State",
858
                DefaultPromptResultValue = (lstSymbolPublic.SelectedItem as Symbol_Custom).Name,
859
                Content = "Name :",
860
                Header = "Update Custom Symbol Name",
861
                Theme = new VisualStudio2013Theme(),
862
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
863
            };
864
            RadWindow.Prompt(parameters);
865

    
866
        }
867
        #endregion
868
        #region Symbol Rename Close Event
869
        private void MarkupReNamePromptClose(string data, WindowClosedEventArgs args)
870
        {
871
            if (args.DialogResult != null && args.DialogResult.Value)
872
            {
873
                if(RadTab.SelectedIndex == 0)
874
                {
875
                    string _id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID;
876
                    string _name = args.PromptResult;
877
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted;
878
                    //Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1);
879
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex);
880
                }
881
                else
882
                {
883
                    string _id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID;
884
                    string _name = args.PromptResult;
885
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted;
886
                    //Logger.sendReqLog("RenameSymbolAsync: ", _id + "," + _name, 1);
887
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(_id, _name, RadTab.SelectedIndex);
888
                }
889
            }
890
        }
891

    
892
        private async void BaseClient_RenameSymbolCompleted(object sender, ServiceDeepView.RenameSymbolCompletedEventArgs e)
893
        {
894
            //Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
895
            await DataBindAsync();
896
        }
897
        #endregion
898

    
899
        #region Wheel Event
900
        private void lstSymbolPrivate_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
901
        {
902
            ScView.ScrollToVerticalOffset(ScView.ContentVerticalOffset - (e.Delta / 2));
903
        }
904
        private void lstSymbolPublic_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
905
        {
906
            ScView_Public.ScrollToVerticalOffset(ScView_Public.ContentVerticalOffset - (e.Delta / 2));
907
        }
908
        #endregion
909

    
910
        #region Tab Selection Event
911
        private void RadTabControl_PreviewSelectionChanged(object sender, RadSelectionChangedEventArgs e)
912
        {
913
            foreach (var item in (e.OriginalSource as RadTabControl).Items)
914
            {
915
                (item as RadTabItem).FontWeight = FontWeights.Normal;
916
            }
917
            ((e.OriginalSource as RadTabControl).SelectedItem as RadTabItem).FontWeight = FontWeights.Bold;
918
        }
919
        #endregion
920

    
921
        #region Department Selection Event
922
        private async void deptlist_SelectionChanged(object sender, SelectionChangedEventArgs e)
923
        {
924
            await DataBindAsync();
925
        }
926
        #endregion
927

    
928
        #endregion
929

    
930
        private void lstSymbolPrivate_PreviewMouseUp(object sender, MouseButtonEventArgs e)
931
        {
932

    
933
        }
934

    
935
        private void lstSymbolPrivate_MouseLeave(object sender, MouseEventArgs e)
936
        {
937

    
938
        }
939

    
940
        private void lstSymbolPrivate_MouseDown(object sender, MouseButtonEventArgs e)
941
        {
942

    
943
        }
944

    
945
        private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
946
        {
947
            if(IsMouseDown && e.LeftButton == MouseButtonState.Pressed)
948
            {
949
                ViewerDataModel.Instance.SystemMain.dzMainMenu.Symbol_ID = moveItem_id;
950
            }
951
            else
952
            {
953
                IsMouseDown = false;
954
            }
955
        }
956

    
957
        private void StackPanel_MouseUp(object sender, MouseButtonEventArgs e)
958
        {
959
            IsMouseDown = false;
960
        }
961

    
962
        /// <summary>
963
        /// place symbol which user select
964
        /// </summary>
965
        /// <author>humkyung</author>
966
        /// <date>2018.06.14</date>
967
        /// <param name="sender"></param>
968
        /// <param name="e"></param>
969
        private void Place_Symbol(object sender, RoutedEventArgs e)
970
        {
971
            if (lstSymbolPrivate.SelectedItem == null)
972
            {
973
                DialogMessage_Alert("Please Select Symbol",  "Alert");
974
                return;
975
            }
976

    
977
            string id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID;
978
            this.PlaceSymbol(id, ViewerDataModel.Instance.SystemMain.dzMainMenu.CanvasDrawingMouseDownPoint);
979
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
980
        }
981

    
982
        private void Place_Symbol_Public(object sender, RoutedEventArgs e)
983
        {
984
            if (lstSymbolPublic.SelectedItem == null)
985
            {
986
                DialogMessage_Alert("Please Select Symbol", "Alert");
987
                return;
988
            }
989

    
990
            string id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID;
991
            this.PlaceSymbol(id, ViewerDataModel.Instance.SystemMain.dzMainMenu.CanvasDrawingMouseDownPoint);
992
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
993
        }
994

    
995
        private void Image_Place_Register(object sender, RoutedEventArgs e)
996
        {
997
            SyncInit();
998
            ViewerDataModel.Instance.SystemMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
999
            //캡쳐 하기 전에 코멘트 저장
1000
            if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
1001
            {
1002
                var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
1003
                SelectionSet.Instance.UnSelect(menu);
1004
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
1005
                {
1006
                    (Application.Current.MainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null);
1007
                }
1008
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
1009
                {
1010

    
1011
                }
1012
                else
1013
                {
1014
                    (Application.Current.MainWindow as MainWindow).dzTopMenu.SaveEventCallback(null, null);
1015
                }
1016
            }
1017
            Application.Current.MainWindow.Focus();
1018
            Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
1019
            (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
1020
        }
1021

    
1022

    
1023
        private void SyncInit()
1024
        {
1025
            try
1026
            {
1027
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
1028
                {
1029
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
1030
                    ViewerDataModel.Instance.PageBalanceMode = false;
1031
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
1032
                    ViewerDataModel.Instance.SyncPageNumber = 0;
1033
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
1034
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
1035
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
1036
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
1037
                }
1038
            }
1039
            catch (Exception ex)
1040
            {
1041
                //Logger.sendResLog("SyncInit", ex.Message, 0);
1042
            }
1043
        }
1044

    
1045
        private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
1046
        {
1047
            var block = sender as TextBox;
1048
            block.Focusable = true;
1049
               
1050
        }
1051

    
1052
        private void TextBlock_MouseEnter(object sender, MouseEventArgs e)
1053
        {
1054
            var block = sender as TextBox;
1055
            if (block != null)
1056
            {
1057
                //block.Text = "Enter";
1058

    
1059
            }
1060
        }
1061

    
1062
        private void OnKeyDownHandler(object sender, KeyEventArgs e)
1063
        {
1064
            if (e.Key == Key.Return)
1065
            {
1066
                Type type = e.OriginalSource.GetType();
1067
                string id = string.Empty;
1068
                //Logger.sendResLog("Move_Symbol", type.Name, 0);
1069
                if (type.Name == "Image")
1070
                {
1071
                    id = ((e.OriginalSource as Image).DataContext as Symbol_Custom).ID;
1072
                }
1073
                else if (type.Name == "Border")
1074
                {
1075
                    id = ((e.OriginalSource as Border).DataContext as Symbol_Custom).ID;
1076
                }
1077
                else if (type.Name == "TextBox")
1078
                {
1079
                    id = ((e.OriginalSource as TextBox).DataContext as Symbol_Custom).ID;
1080
                }
1081

    
1082
                //((System.Windows.Controls.TextBox)sender).Text;
1083

    
1084
                if (RadTab.SelectedIndex == 0)
1085
                {
1086
                    //string _id = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID;
1087
                    string _name = ((System.Windows.Controls.TextBox)sender).Text;
1088
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted;
1089
                    //Logger.sendReqLog("RenameSymbolAsync: ", id + "," + _name, 1);
1090
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(id, _name, RadTab.SelectedIndex);
1091
                }
1092
                else
1093
                {
1094
                    //string _id = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID;
1095
                    string _name = ((System.Windows.Controls.TextBox)sender).Text;
1096
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolCompleted += BaseClient_RenameSymbolCompleted;
1097
                    //Logger.sendReqLog("RenameSymbolAsync: ", id + "," + _name, 1);
1098
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.RenameSymbolAsync(id, _name, RadTab.SelectedIndex);
1099
                }
1100
                
1101
            }
1102
        }
1103
        
1104
    }
1105
}
클립보드 이미지 추가 (최대 크기: 500 MB)