프로젝트

일반

사용자정보

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

markus / KCOM / Controls / Symbol.xaml.cs @ 0b75c341

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

1 53880c83 ljiyeon
using IKCOM;
2
using KCOM.Common;
3 787a4489 KangIngu
using KCOM.Events;
4 5ce56a3a KangIngu
using KCOMDataModel.Common;
5
using KCOMDataModel.DataModel;
6 34c8d43a ljiyeon
using MarkupToPDF.Common;
7 036650a0 humkyung
using MarkupToPDF.Controls.Parsing;
8 53880c83 ljiyeon
using Svg2Xaml;
9 787a4489 KangIngu
using System;
10
using System.Collections.Generic;
11 53880c83 ljiyeon
using System.ComponentModel;
12 787a4489 KangIngu
using System.Linq;
13
using System.Text;
14
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 5928384e djkim
            List<Symbol_Custom> Custom_List = new List<Symbol_Custom>();           
98
            
99
            var symbol_Private = ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolList(App.ViewInfo.UserID);
100 6c781c0c djkim
            foreach (var item in symbol_Private)
101 5ce56a3a KangIngu
            {
102 6c781c0c djkim
                Custom.Name = item.NAME;
103 19391ad3 djkim
                Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL, App.isExternal);
104 6c781c0c djkim
                Custom.ID = item.ID;
105
                Custom_List.Add(Custom);
106 5ce56a3a KangIngu
                Custom = new Symbol_Custom();
107 6c781c0c djkim
            }
108
            lstSymbolPrivate.ItemsSource = Custom_List;
109 5ce56a3a KangIngu
110 6c781c0c djkim
            Custom = new Symbol_Custom();
111
            Custom_List = new List<Symbol_Custom>();
112 5ce56a3a KangIngu
113 5928384e djkim
            deptlist.ItemsSource = ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetPublicSymbolDeptList();
114 5ce56a3a KangIngu
115 6c781c0c djkim
            List<SYMBOL_PUBLIC> symbol_Public;
116 5ce56a3a KangIngu
117 53880c83 ljiyeon
118 6c781c0c djkim
            if (deptlist.SelectedValue != null)
119
            {
120 5928384e djkim
                symbol_Public = ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetPublicSymbolList(deptlist.SelectedValue.ToString());
121 6c781c0c djkim
            }
122
            else
123
            {
124 5928384e djkim
                symbol_Public = ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetPublicSymbolList(null);
125 5ce56a3a KangIngu
            }
126 6c781c0c djkim
            foreach (var item in symbol_Public)
127
            {
128
                Custom.Name = item.NAME;
129 19391ad3 djkim
                Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL, App.isExternal);
130 6c781c0c djkim
                Custom.ID = item.ID;
131
                Custom_List.Add(Custom);
132
                Custom = new Symbol_Custom();
133
            }
134 5928384e djkim
            lstSymbolPublic.ItemsSource = Custom_List;            
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
            DialogParameters parameters = new DialogParameters()
190
            {
191 b9b01f8e ljiyeon
                Owner = Application.Current.MainWindow,
192 0d32593b ljiyeon
                Content = new TextBlock()
193
                {
194
                    MinWidth = 400,
195
                    FontSize = 11,
196
                    Text = content,
197
                    TextWrapping = System.Windows.TextWrapping.Wrap
198
                },
199 5ce56a3a KangIngu
                Header = header,
200
                Theme = new VisualStudio2013Theme(),
201
                ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
202
            };
203
            RadWindow.Alert(parameters);
204
        }
205
206
        #region Event
207
208 498f0fc9 ljiyeon
        #region Private Symbol Add Event
209 787a4489 KangIngu
        private void Create_Symbol(object sender, RoutedEventArgs e)
210
        {
211 5529d2a2 humkyung
            MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
212 787a4489 KangIngu
213
            if (Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
214
            {
215
                DialogMessage_Alert("Please Select Controls", "Alert");
216
            }
217
            else //선택된 것이 있으면
218
            {
219
                string MarkupData = "";
220
                finalItem = new AdornerFinal();
221
222
                foreach (var item in Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children)
223
                {
224
                    if (item.GetType().Name == "AdornerFinal")
225
                    {
226
                        finalItem = (item as Controls.AdornerFinal);
227 4913851c humkyung
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
228 787a4489 KangIngu
                        {
229
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
230
                            {
231 5529d2a2 humkyung
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
232 787a4489 KangIngu
                                MarkupData += markupReturn.ConvertData;
233
                            }
234
                        }
235
                    }
236
                }
237
                DialogParameters parameters = new DialogParameters()
238
                {
239 b9b01f8e ljiyeon
                    Owner = Application.Current.MainWindow,
240 53880c83 ljiyeon
                    Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args),
241 787a4489 KangIngu
                    DefaultPromptResultValue = "Custom State",
242
                    Content = "Name :",
243
                    Header = "Insert Custom Symbol Name",
244
                    Theme = new VisualStudio2013Theme(),
245
                    ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 },
246
                };
247
                RadWindow.Prompt(parameters);
248
            }
249
250
        }
251 5ce56a3a KangIngu
        #endregion
252 787a4489 KangIngu
253 5ce56a3a KangIngu
        #region Symbol Add Close Event 
254 787a4489 KangIngu
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
255
        {
256 c73426a9 ljiyeon
            try
257 787a4489 KangIngu
            {
258 c73426a9 ljiyeon
                if (args.PromptResult != null)
259 53880c83 ljiyeon
                {
260 c73426a9 ljiyeon
                    if (args.DialogResult.Value)
261
                    {
262
                        PngBitmapEncoder _Encoder = symImage(data);
263 787a4489 KangIngu
264 c73426a9 ljiyeon
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
265
                        _Encoder.Save(fs);
266
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
267 787a4489 KangIngu
268 c73426a9 ljiyeon
                        byte[] Img_byte = fs.ToArray();
269 787a4489 KangIngu
270 c73426a9 ljiyeon
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
271 24678e06 humkyung
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte);
272 c73426a9 ljiyeon
                        Check_Uri.UriCheck(filename);
273
                        if (RadTab.SelectedIndex == 0)
274
                        {
275
                            SymbolSave(args.PromptResult, filename, data);
276
                        }
277
                        else
278
                        {
279
                            SymbolSave_Public(args.PromptResult, filename, data, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
280
                        }
281 53880c83 ljiyeon
282 c73426a9 ljiyeon
                        DataBind();
283 53880c83 ljiyeon
                    }
284 498f0fc9 ljiyeon
                }
285 53880c83 ljiyeon
            }
286 c73426a9 ljiyeon
            catch(Exception ex)
287
            {
288
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert");
289
            }
290 53880c83 ljiyeon
        }
291
        #endregion
292
293
        public void SymbolSave(string Name, string Url, string Data)
294
        {
295
            try
296
            {
297
                SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE
298 498f0fc9 ljiyeon
                {
299 24678e06 humkyung
                    ID = Commons.shortGuid(),
300 53880c83 ljiyeon
                    MEMBER_USER_ID = App.ViewInfo.UserID,
301
                    NAME = Name,
302
                    IMAGE_URL = Url,
303
                    DATA = Data
304
                };
305 5ce56a3a KangIngu
306 53880c83 ljiyeon
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted;
307
                Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1);
308
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private);
309
            }
310
            catch (Exception)
311
            {
312
                throw;
313 787a4489 KangIngu
            }
314
        }
315 53880c83 ljiyeon
316
        public void SymbolSave_Public(string Name, string Url, string Data, string Department)
317
        {
318
            try
319
            {
320
                SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC
321
                {
322 24678e06 humkyung
                    ID = Commons.shortGuid(),
323 53880c83 ljiyeon
                    DEPARTMENT = Department,
324
                    NAME = Name,
325
                    IMAGE_URL = Url,
326
                    DATA = Data
327
                };
328
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted;
329
                Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1);
330
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public);
331
            }
332
            catch (Exception)
333
            {
334
                throw;
335
            }
336
        }
337
338
        private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e)
339
        {
340
            Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
341
            DataBind();
342
        }
343
344
        private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e)
345
        {
346
            Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
347
            DataBind();
348
        }
349 787a4489 KangIngu
350 498f0fc9 ljiyeon
        #region Private Symbol Delete Event
351 5ce56a3a KangIngu
        private void Remove_Symbol(object sender, RoutedEventArgs e)
352 787a4489 KangIngu
        {
353 5ce56a3a KangIngu
            if (lstSymbolPrivate.SelectedItem == null)
354
            {
355
                DialogMessage_Alert("Please Select Symbol", "Alert");
356
                return;
357
            }
358 6c781c0c djkim
            string delItem_ID = (lstSymbolPrivate.SelectedItem as Symbol_Custom).ID;
359 0f065e57 ljiyeon
360 53880c83 ljiyeon
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted;
361 0f065e57 ljiyeon
            Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1);
362 53880c83 ljiyeon
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex);
363 498f0fc9 ljiyeon
        }
364
        #endregion
365
        #region Public Symbol Delete Event
366
        private void Remove_Symbol_Public(object sender, RoutedEventArgs e)
367
        {
368
            if (lstSymbolPublic.SelectedItem == null)
369
            {
370
                DialogMessage_Alert("Please Select Symbol", "Alert");
371
                return;
372
            }
373
            string delItem_ID = (lstSymbolPublic.SelectedItem as Symbol_Custom).ID;
374
375
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolCompleted += BaseClient_DeleteSymbolCompleted;
376
            Logger.sendReqLog("DeleteSymbolAsync: ", delItem_ID, 1);
377
            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.DeleteSymbolAsync(delItem_ID, RadTab.SelectedIndex);
378 6c781c0c djkim
        }
379 787a4489 KangIngu
380 6c781c0c djkim
        private void BaseClient_DeleteSymbolCompleted(object sender, ServiceDeepView.DeleteSymbolCompletedEventArgs e)
381
        {
382 0f065e57 ljiyeon
            Logger.sendResLog("DeleteSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
383 6c781c0c djkim
            DataBind();
384 5ce56a3a KangIngu
        }
385
        #endregion
386 787a4489 KangIngu
387 34c8d43a ljiyeon
        public Undo_data UndoData { get; set; }
388 702abd98 humkyung
        /// <summary>
389
        /// place symbol which has given id to original position which is created
390
        /// </summary>
391
        /// <date>2018.06.14</date>
392
        /// <param name="id"></param>
393
        private void PlaceSymbol(string id)
394 5ce56a3a KangIngu
        {
395 702abd98 humkyung
            string Data_ = "";
396 787a4489 KangIngu
397 702abd98 humkyung
            try
398 5ce56a3a KangIngu
            {
399 0f065e57 ljiyeon
                Logger.sendReqLog("GetSymbolData: ", id + "," + RadTab.SelectedIndex, 1);
400 6c781c0c djkim
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolData(id, RadTab.SelectedIndex);
401 0f065e57 ljiyeon
                if (Data_ != null || Data_ != "")
402
                {
403
                    Logger.sendResLog("GetSymbolData", "TRUE", 1);
404
                }
405
                else
406
                {
407
                    Logger.sendResLog("GetSymbolData", "FALSE", 1);
408
                }
409 787a4489 KangIngu
410 53880c83 ljiyeon
                //MARKUP_DATA_GROUP INSERT
411 c0977e97 djkim
                //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
412
                //{
413
                //    SYMBOL_ID = id,//InnerItem.Symbol_ID
414
                //    STATE = 0,
415
                //};
416
                //long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
417
                //Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
418 53880c83 ljiyeon
419 5ce56a3a KangIngu
                if (Data_.Contains("|DZ|"))
420
                {
421
                    List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
422
423
                    string[] delimiterChars = { "|DZ|" };
424
                    string[] data = Data_.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
425
426 34c8d43a ljiyeon
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
427
                    UndoData = new Undo_data()
428
                    {
429
                        IsUndo = false,
430
                        Event = Event_Type.Create,
431
                        EventTime = DateTime.Now,
432
                        Markup_List = new List<Multi_Undo_data>()
433
                    };
434
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
435
                    {
436
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
437
                    });
438
439
                    foreach (string parse in data)
440 5ce56a3a KangIngu
                    {
441
                        if (parse != "")
442
                        {
443 5529d2a2 humkyung
                            System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
444 24678e06 humkyung
                            (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
445 c8e9b3e4 ljiyeon
                            (item as MarkupToPDF.Common.CommentUserInfo).SymbolID = id;
446 c0977e97 djkim
                            //(item as MarkupToPDF.Common.CommentUserInfo).GroupID = group_id;
447 5ce56a3a KangIngu
                            ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
448
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
449 53880c83 ljiyeon
450 5ce56a3a KangIngu
                            adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
451 34c8d43a ljiyeon
452
                            multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
453
454
                            UndoData.Markup_List.Add(multi_Undo_Data);
455
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
456 5ce56a3a KangIngu
                        }
457
                    }
458
                    Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
459
460
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
461
                }
462 53880c83 ljiyeon
                else
463
                {
464 c0977e97 djkim
                    PlaceImageSymbol(id, 0);
465 53880c83 ljiyeon
                }
466
            }
467
            catch (Exception ex)
468
            {
469
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error");
470
            }
471
        }
472
473
        private void PlaceImageSymbol(string id, long group_id)
474
        {
475
           
476
            //canvasZoommovingMouseDownPoint
477
            string Data_ = "";
478
479
            try
480
            {
481
                Logger.sendReqLog("GetSymbolImageURL: ", id + "," + RadTab.SelectedIndex, 1);
482
                Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, RadTab.SelectedIndex);
483
                if (Data_ != null || Data_ != "")
484
                {
485
                    Logger.sendResLog("GetSymbolImageURL", "TRUE", 1);
486
                }
487
                else
488
                {
489
                    Logger.sendResLog("GetSymbolImageURL", "FALSE", 1);
490
                }
491
492
                //MARKUP_DATA_GROUP INSERT
493 c0977e97 djkim
                //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
494
                //{
495
                //    SYMBOL_ID = id,//InnerItem.Symbol_ID
496
                //    STATE = 0,
497
                //};
498 53880c83 ljiyeon
                //long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
499
                //Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
500
501
                if (Data_ != null)
502
                {
503
                    Image img = new Image();
504
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_));
505
                    if (Data_.Contains(".svg"))
506
                    {
507
                        byte[] imageData = null;
508
                        DrawingImage image = null;
509
                        using (System.Net.WebClient web = new System.Net.WebClient())
510
                        {
511
                            imageData = web.DownloadData(new Uri(Data_));
512
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
513
                            image = SvgReader.Load(stream);
514
                        }
515
                        img.Source = image;
516
                    }
517
                    else
518
                    {
519
                        img.Source = new BitmapImage(new Uri(Data_));
520
                    }
521
522
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
523
                    {
524
                        PointSet = new List<Point>(),
525
                        FilePath = Data_,
526
                        ImageData = img.Source,
527
                        StartPoint = new Point(0, 0),
528
                        EndPoint = new Point(img.Source.Width, img.Source.Height),
529
                        TopRightPoint = new Point(img.Source.Width, 0),
530
                        LeftBottomPoint = new Point(0, img.Source.Height)
531
                    };
532
533
                    currentControl.PointSet = new List<Point>
534
                                        {
535
                                            currentControl.StartPoint,
536
                                            currentControl.LeftBottomPoint,
537
                                            currentControl.EndPoint,
538
                                            currentControl.TopRightPoint,
539
                                        };
540
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
541
                    UndoData = new Undo_data()
542
                    {
543
                        IsUndo = false,
544
                        Event = Event_Type.Create,
545
                        EventTime = DateTime.Now,
546
                        Markup_List = new List<Multi_Undo_data>()
547
                    };
548
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
549
                    {
550
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
551
                    });
552
553
                    //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
554
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
555
                    UndoData.Markup_List.Add(multi_Undo_Data);
556
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
557
558
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
559 24678e06 humkyung
                    currentControl.CommentID = Commons.shortGuid();
560 53880c83 ljiyeon
                    currentControl.SymbolID = id;
561
                    currentControl.GroupID = group_id;
562
                    currentControl.ApplyTemplate();
563
                    currentControl.SetImage();
564
565
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
566
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
567
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
568
569 7211e0c2 ljiyeon
                    /*
570 53880c83 ljiyeon
                    // 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 0d00f9c8 humkyung
                      final.TranslateItems(realPointX, realPointY);
575 53880c83 ljiyeon
                    // move.control_Select(item, dragRect);
576
                    ApplyDragSelectionRect();
577 7211e0c2 ljiyeon
                    //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = MouseHandlingMode.DragSymbol;
578 e6a9ddaf humkyung
                    ///this.ParentOfType<MainWindow>().dzMainMenu.mouseButtonDown = MouseButton.Left;
579 7211e0c2 ljiyeon
                    //this.ParentOfType<MainWindow>().dzMainMenu.symboldata(id, group_id, RadTab.SelectedIndex, Data_, img.Source);*/
580 53880c83 ljiyeon
                    
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 cb5c7f06 humkyung
                    (Application.Current.MainWindow as MainWindow).dzTopMenu.SaveEventCallback(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 cb5c7f06 humkyung
                    (Application.Current.MainWindow as MainWindow).dzTopMenu.SaveEventCallback(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)