프로젝트

일반

사용자정보

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

markus / KCOM / Controls / Symbol.xaml.cs @ f816dd63

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

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