프로젝트

일반

사용자정보

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

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

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