프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ f816dd63

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

1
using KCOM.Common;
2
using KCOM.Common.Converter;
3
using KCOM.Controls;
4
using KCOM.Events;
5
using KCOMDataModel.DataModel;
6
using MarkupToPDF.Common;
7
using Svg2Xaml;
8
using System;
9
using System.Collections.Generic;
10
using System.Linq;
11
using System.Text;
12
using System.Windows;
13
using System.Windows.Controls;
14
using System.Windows.Input;
15
using System.Windows.Media;
16
using System.Windows.Media.Imaging;
17
using Telerik.Windows.Controls;
18
using IKCOM;
19
using Microsoft.Win32;
20
using System.IO;
21
using System.Reflection;
22
using System.Windows.Controls.Primitives;
23
using MarkupToPDF.Controls.Parsing;
24
using Telerik.Windows.Data;
25
using System.ComponentModel;
26

    
27
namespace KCOM.Views
28
{
29
    public partial class TopMenu : UserControl
30
    {
31
        public int rotateOffSet = 0;
32
        private double[] rotateValue = { 0, 90, 180, 270 };
33
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
34
        public bool isClosed = true;
35
        public RadWindow CheckPop;
36
        public RadWindow OptionPop;
37
        public MarkupToPDF.Common.Undo_data UndoData;
38
        MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn();
39

    
40
        /// <summary>
41
        /// TaskBar에 메시지를 입력합니다
42
        /// </summary>
43
        /// <param name="message"></param>
44
        /// <param name="type"></param>
45
        public void TaskMessage(string message, TaskMessageType type)
46
        {
47
            //if (taskBar != null)
48
            //{
49
            //    string color = "";
50
            //    taskBar.Content = message;
51
            //    DicTaskMessage.TryGetValue(type, out color);
52
            //    taskBar.Foreground = new SolidColorBrush(StringToColorConverter.Parse(color));
53
            //}
54
        }
55

    
56
        /// <summary>
57
        /// Task Type명을 Key값으로 지정합니다
58
        /// </summary>
59
        public enum TaskMessageType
60
        {
61
            Normal,
62
            Caption,
63
            Error,
64
        }
65

    
66
        private void CheckShapeState()
67
        {
68

    
69

    
70
            if (cbHatchShape.IsChecked == true)
71
            {
72
                cbFillShape.IsChecked = false;
73
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
74
            }
75
            else if(cbFillShape.IsChecked == true)
76
            {
77
                cbHatchShape.IsChecked = false;
78
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
79
            }
80
            else
81
            {
82
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
83
            }
84
        }
85

    
86
        //강인구 추가(Undo End)
87
        private void SetPaintEvent()
88
        {
89
            List<AdornerMember> AdonerList = GetAdornerItem();
90

    
91
            if (AdonerList.Count > 0)
92
            {
93
                Undo_data UndoData = new Undo_data()
94
                {
95
                    IsUndo = false,
96
                    Event = Event_Type.Option,
97
                    EventTime = DateTime.Now,
98
                    paint = ViewerDataModel.Instance.paintSet,
99
                    Markup_List = new List<Multi_Undo_data>()
100
                };
101
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
102

    
103
                foreach (AdornerMember InnerItem in AdonerList)
104
                {
105
                    multi_Undo_Data.PointSet = new List<Point>();
106

    
107
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
108
                    {
109
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
110
                    }
111

    
112
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
113
                    UndoData.Markup_List.Add(multi_Undo_Data);
114
                    multi_Undo_Data = new Multi_Undo_data();
115
                }
116

    
117
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
118
                {
119
                    ViewerDataModel.Instance.UndoDataList.Remove(i);                    
120
                });
121
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
122
                
123

    
124
            }
125

    
126
        }
127

    
128
        private void SetHighlightEvent()
129
        {
130
            List<AdornerMember> AdonerList = GetAdornerItem();
131

    
132
            if (AdonerList.Count > 0)
133
            {
134
                foreach (AdornerMember InnerItem in AdonerList)
135
                {
136
                    switch (InnerItem.DrawingData.GetType().Name)
137
                    {
138
                        case ("TextControl"):
139
                            {
140
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
141
                            }
142
                            break;
143
                        case ("ArrowTextControl"):
144
                            {
145
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
146
                            }
147
                            break;
148
                    }
149
                }
150
            }
151

    
152
        }
153

    
154
        private void FillShapeEvent(object sender, RoutedEventArgs e)
155
        {
156
            #region 주석
157
            //if ((sender as CheckBox).IsChecked.Value)
158
            //{
159
            //    cbHatchShape.IsChecked = false;
160
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Fill.png", UriKind.Relative));
161
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Fill.png", UriKind.Relative));
162
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle_Fill.png", UriKind.Relative));
163
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon.png", UriKind.Relative));
164
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon.png", UriKind.Relative));
165
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_Fill.png", UriKind.Relative));
166
            //    TaskMessage("채우기 옵션이 적용되었습니다", TaskMessageType.Normal);
167
            //}
168
            //else
169
            //{
170

    
171
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
172
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
173
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
174
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
175
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
176
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
177
            //    TaskMessage("채우기 옵션이 해제되었습니다", TaskMessageType.Caption);
178
            //}
179
            #endregion
180
            ViewerDataModel.Instance.checkFillShape = (sender as CheckBox).IsChecked.Value;
181

    
182
            if (ViewerDataModel.Instance.checkFillShape)
183
            {
184
                cbHatchShape.IsChecked = false;
185
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
186
            }
187
            else
188
            {
189
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
190
            }
191
            SetPaintEvent();
192
        }
193

    
194
        /// <summary>
195
        /// 도형 빗금 처리
196
        /// </summary>
197
        /// <param name="sender"></param>
198
        /// <param name="e"></param>
199
        private void HatchShapeEvent(object sender, RoutedEventArgs e)
200
        {
201
			#region 주석
202
            //if ((sender as CheckBox).IsChecked.Value)
203
            //{
204
            //    cbFillShape.IsChecked = false;
205
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Hatch.png", UriKind.Relative));
206
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Hatch.png", UriKind.Relative));
207
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/rectangle-icon_Hatch.png", UriKind.Relative));
208
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_Hatch.png", UriKind.Relative));
209
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_Hatch.png", UriKind.Relative));
210
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_hatch.png", UriKind.Relative));
211
            //    TaskMessage("무늬 옵션이 적용되었습니다", TaskMessageType.Normal);
212
            //}
213
            //else
214
            //{
215
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
216
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
217
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
218
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
219
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
220
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
221
            //    TaskMessage("무늬 옵션이 해제되었습니다", TaskMessageType.Caption);
222
            //} 
223
            #endregion
224

    
225
            //강인구 추가
226
            ViewerDataModel.Instance.checkHatchShape = (sender as CheckBox).IsChecked.Value;
227
            if (ViewerDataModel.Instance.checkHatchShape)
228
            {
229
                cbFillShape.IsChecked = false;
230
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
231
            }
232
            else
233
            {
234
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;  
235
            }
236
            SetPaintEvent();
237
        }
238

    
239
 		//강인구 추가
240
        private string SetColor(string ID)
241
        {
242
            try
243
            {
244
                return ViewerDataModel.Instance._markupInfoList.Where(info => info.MarkupInfoID == ID).First().DisplayColor;
245
            }
246
            catch (Exception)
247
            {
248
                return "#FFFFFF";
249
            }
250
        }
251

    
252
        void SaveTimer_Tick(object sender, EventArgs e)
253
        {
254
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
255
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
256
            {
257
                SaveEvent(null, null);
258
            }
259

    
260
        }
261

    
262
        private void SaveTime(bool IsRun)
263
        {
264
            if(SaveTimer == null)
265
            {
266
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
267
                SaveTimer.Interval = new TimeSpan(0, 0, 5);
268
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
269
            }
270

    
271
            if (IsRun)
272
            {
273
                SaveTimer.Start();
274
            }
275
            else
276
            {
277
                SaveTimer.Stop();
278
            }
279
        }
280
        private void SaveTime(bool IsRun,int timeinterval)
281
        {
282
            if (SaveTimer == null)
283
            {
284
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
285
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
286
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
287
            }
288
            else
289
            {
290
                SaveTimer.Stop();
291
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
292
            }
293

    
294
            if (IsRun)
295
            {
296
                SaveTimer.Start();
297
            }
298
            else
299
            {
300
                SaveTimer.Stop();
301
            }
302
        }
303
        /// <summary>
304
        /// enable busy indicator and then call _SaveEvent method.
305
        /// </summary>
306
        /// <param name="sender"></param>
307
        /// <param name="e"></param>
308
        public void SaveEvent(object sender, RoutedEventArgs e)
309
        {
310
            if (this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy == true) return;
311

    
312
            this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
313
            System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
314
            {
315
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
316
            }).ContinueWith(task =>
317
            {
318
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
319
            });
320
        }
321

    
322
        /// <summary>
323
        /// save markup
324
        /// </summary>
325
        /// <param name="sender"></param>
326
        /// <param name="e"></param>
327
        public void _SaveEvent(object sender, RoutedEventArgs e)
328
        {
329
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
330
            try
331
            {
332
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
333

    
334
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
335

    
336
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
337
                {
338
                    this.ExecuteSaveCommand(menu);
339
                }
340
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 && menu.gridViewMarkup.Items.Count > 0)
341
                {
342
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
343
                    return;
344
                }
345
                else
346
                {
347
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
348
                    {
349
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
350
                        {
351
                            this.ExecuteSaveCommand(menu);
352
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
353
                            if (ViewerDataModel.Instance.IsConsolidate)
354
                            {
355
                                return;
356
                            }
357

    
358
                            if (sender != null)
359
                            {
360
                                if (ViewerDataModel.Instance.IsPressCtrl)
361
                                {
362
                                    ViewerDataModel.Instance.IsPressCtrl = false;
363
                                }
364
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
365
                            }
366
                            return;
367
                        }
368
                    }
369
                }
370
                if (sender != null)
371
                {
372
                    if (ViewerDataModel.Instance.IsPressCtrl)
373
                    {
374
                        ViewerDataModel.Instance.IsPressCtrl = false;
375
                    }
376
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
377
                }
378
            }
379
            catch(Exception ex)
380
            {
381
               
382
            }
383
            finally
384
            {
385
                /// delete markup information when 코멘트가 없을 경우
386
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
387
                {
388
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
389
                    {
390
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
391
                        {
392
                            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
393
                        }
394
                    }
395
                }
396
            }
397
        }
398

    
399
        /// <summary>
400
        /// call save command
401
        /// </summary>
402
        /// <param name="menu"></param>
403
		private void ExecuteSaveCommand(MainMenu menu)
404
        {
405
            SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
406
            SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
407
            SaveCommand.Instance.user_id = App.ViewInfo.UserID;
408
            SaveCommand.Instance.page_no = Convert.ToInt32(tlcurrentPage.Text);
409

    
410
            try
411
            {
412
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
413

    
414
                List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
415
                foreach (var item in menu.gridViewMarkup.SelectedItems)
416
                {
417
                    if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
418
                    {
419
                        SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
420
                    }
421
                }
422

    
423
                menu.UpdateMyMarkupList();
424
                SaveCommand.Instance.Execute(SelectedMarkupInfos, SaveCommand.Instance.page_no);
425
                SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
426
            }
427
            catch (Exception ex)
428
            {
429
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
430
                throw ex;
431
            }
432
        }
433

    
434
        //강인구 추가
435
        public void Print_Start(string Type)
436
        {
437
            if (ViewerDataModel.Instance.IsPressCtrl)
438
            {
439
                ViewerDataModel.Instance.IsPressCtrl = false;
440
            }
441
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
442
            {
443
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
444
                SelectionSet.Instance.UnSelect(menu);
445
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
446
                {
447
                    this.SaveEvent(null, null);
448
                }
449
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
450
                {
451

    
452
                }
453
                else
454
                {
455
                    this.SaveEvent(null, null);
456
                }
457
            }
458

    
459
            bool isprint = false;
460
            if (Type == "Print")
461
            {
462
                isprint = true;
463
            }
464

    
465
            RadWindow PrintWindow = new RadWindow();
466
            //IKCOM.MarkupInfoItem _result = null;
467
            PrintWindow.Width = 850;
468
            PrintWindow.Height = 600;
469
            //PrintWindow.Width = 650;
470
            //PrintWindow.Height = 550;
471
            PrintWindow.Header = Type;
472

    
473
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
474

    
475
            Logger.sendReqLog("GetPrintDocItemList: ", App.ViewInfo.ProjectNO + "," + App.ViewInfo.DocumentItemID + "," + ViewerDataModel.Instance._markupInfoList.ToList(), 1);
476
            markupinfo = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetPrintDocItemList(App.ViewInfo.ProjectNO, App.ViewInfo.DocumentItemID, ViewerDataModel.Instance._markupInfoList.ToList());
477

    
478
            if (markupinfo.Count() > 0)
479
            {
480
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
481
            }
482
            else
483
            {
484
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
485
            }
486

    
487
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
488
                App.SystemInfo.HostName,
489
                App.ViewInfo.ProjectNO,
490
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
491
                App.ViewInfo.DocumentItemID
492
                );
493

    
494
            PrintWindow.Content = new KCOM.Control.PrintControl(
495
                      Tile_Url,
496
                      App.ViewInfo.ProjectNO,
497
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
498
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
499
                      App.ViewInfo.DocumentItemID,
500
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
501
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
502

    
503
            //프린트 팝업 옵션
504
            //PrintWindow.BorderThickness = new Thickness(3);
505
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
506
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
507
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
508
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
509
            PrintWindow.Background.Opacity = 0.6;
510
            PrintWindow.Owner = Application.Current.MainWindow;
511
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
512
            PrintWindow.ShowDialog();
513
        }
514

    
515
        //강인구 추가
516
        private void PrintEvent(object sender, RoutedEventArgs e)
517
        {
518
            RadRibbonButton button = sender as RadRibbonButton;
519
            Print_Start(button.Content.ToString());
520
        }
521

    
522
        private List<AdornerMember> GetAdornerItem()
523
        {
524
            List<AdornerMember> AdonerList = new List<AdornerMember>();
525

    
526
            if (this.ParentOfType<MainWindow>() != null)
527
            {
528
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
529
                {
530
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
531
                    {
532
                        if (item.GetType().Name == "AdornerFinal")
533
                        {
534
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
535
                            {
536
                                AdonerList.Add(InnerItem);
537
                            }
538
                        }
539
                    }
540
                }
541
            }
542
            return AdonerList;
543
        }
544
        /// <summary>
545
        /// 투명도
546
        /// </summary>
547
        /// <param name="sender"></param>
548
        /// <param name="e"></param>
549
        //강인구 추가(Undo End)
550
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
551
        {
552
            List<AdornerMember> AdonerList = GetAdornerItem();
553
            if(AdonerList.Count > 0)
554
            {
555
                Undo_data UndoData = new Undo_data()
556
                {
557
                    IsUndo = false,
558
                    Event = Event_Type.Option,
559
                    EventTime = DateTime.Now,
560
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
561
                    Markup_List = new List<Multi_Undo_data>()
562
                };
563
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
564

    
565
                foreach (AdornerMember InnerItem in AdonerList)
566
                {
567
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
568
                  
569
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
570
                    UndoData.Markup_List.Add(multi_Undo_Data);
571
                    multi_Undo_Data = new Multi_Undo_data();
572
                }
573

    
574
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
575
                {
576
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
577
                });
578
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
579
            }
580
        }
581

    
582
        //강인구 추가(Undo End)
583
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
584
        {
585
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
586
            {
587
                cbLineSize.Value = cbLineSize.Minimum;
588
            }
589
            List<AdornerMember> AdonerList = GetAdornerItem();
590
            if (AdonerList.Count > 0)
591
            {
592
                Undo_data UndoData = new Undo_data()
593
                {
594
                    IsUndo = false,
595
                    Event = Event_Type.Option,
596
                    EventTime = DateTime.Now,
597
                    LineSize = ViewerDataModel.Instance.LineSize,
598
                    Markup_List = new List<Multi_Undo_data>()
599
                };
600
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
601

    
602
                foreach (AdornerMember InnerItem in AdonerList)
603
                {
604
                    switch (InnerItem.DrawingData.GetType().Name)
605
                    {
606
                        case ("LineControl"):
607
                            {
608
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
609
                            }
610
                            break;
611
                        case ("ArcControl"):
612
                            {
613
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
614
                            }
615
                            break;
616
                        case ("ArrowArcControl"):
617
                            {
618
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).LineSize = ViewerDataModel.Instance.LineSize;
619
                            }
620
                            break;
621
                        case ("ArrowControl_Multi"):
622
                            {
623
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
624
                            }
625
                            break;
626
                        case ("CloudControl"):
627
                            {
628
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
629
                            }
630
                            break;
631
                        case ("PolygonControl"):
632
                            {
633
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
634
                            }
635
                            break;
636
                        case ("RectangleControl"):
637
                            {
638
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
639
                            }
640
                            break;
641
                        case ("RectCloudControl"):
642
                            {
643
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
644
                            }
645
                            break;
646
                        case ("TriControl"):
647
                            {
648
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
649
                            }
650
                            break;
651
                        case ("CircleControl"):
652
                            {
653
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
654
                            }
655
                            break;
656
                        case ("ArrowTextControl"):
657
                            {
658
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).LineSize = ViewerDataModel.Instance.LineSize;
659
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).BorderSize = new Thickness(ViewerDataModel.Instance.LineSize);
660
                            }
661
                            break;
662
                        case ("TextControl"):
663
                            {
664
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize);
665
                            }
666
                            break;
667
                        case ("InsideWhiteControl"):
668
                            {
669
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
670
                            }
671
                            break;
672
                        case ("OverlapWhiteControl"):
673
                            {
674
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
675
                            }
676
                            break;
677
                        case ("ClipWhiteControl"):
678
                            {
679
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
680
                            }
681
                            break;
682
                        case ("CoordinateControl"):
683
                            {
684
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).LineSize = 10; //ViewerDataModel.Instance.LineSize
685
                            }
686
                            break;
687
                    }
688
                    
689

    
690
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
691
                    UndoData.Markup_List.Add(multi_Undo_Data);
692
                    multi_Undo_Data = new Multi_Undo_data();
693
                }
694

    
695
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
696
                {
697
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
698
                });
699
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
700

    
701
                
702
            }
703
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
704
            Properties.Settings.Default.Save();
705
        }
706

    
707

    
708
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
709
        {
710
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
711
            {
712
                cbIntervalSize.Value = cbIntervalSize.Minimum;
713
            }
714
            List<AdornerMember> AdonerList = GetAdornerItem();
715
            if (AdonerList.Count > 0)
716
            {
717

    
718
                Undo_data UndoData = new Undo_data()
719
                {
720
                    IsUndo = false,
721
                    Event = Event_Type.Option,
722
                    EventTime = DateTime.Now,
723
                    Interval = ViewerDataModel.Instance.Interval,
724
                    Markup_List = new List<Multi_Undo_data>()
725
                };
726
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
727

    
728
                foreach (AdornerMember InnerItem in AdonerList)
729
                {
730
                    switch (InnerItem.DrawingData.GetType().Name)
731
                    {
732
                        case ("LineControl"):
733
                            {
734
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
735

    
736
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
737
                                UndoData.Markup_List.Add(multi_Undo_Data);
738
                                multi_Undo_Data = new Multi_Undo_data();
739
                            }
740
                            break;
741
                    }
742
                }
743

    
744
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
745
                {
746
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
747
                });
748
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
749
            }
750
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
751
            Properties.Settings.Default.Save();
752
        }
753
        
754
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
755
        {
756
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
757
            {
758
                cbArcLength.Value = cbArcLength.Minimum;
759
            }
760
            List<AdornerMember> AdonerList = GetAdornerItem();
761
            if (AdonerList.Count > 0)
762
            {
763

    
764
                //Undo_data UndoData = new Undo_data()
765
                //{
766
                //    IsUndo = false,
767
                //    Event = Event_Type.Option,
768
                //    EventTime = DateTime.Now,
769
                //    Interval = ViewerDataModel.Instance.Interval,
770
                //    Markup_List = new List<Multi_Undo_data>()
771
                //};
772
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
773

    
774
                foreach (AdornerMember InnerItem in AdonerList)
775
                {
776
                    switch (InnerItem.DrawingData.GetType().Name)
777
                    {
778
                        case ("RectCloudControl"):
779
                            {
780
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
781

    
782
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
783
                                //UndoData.Markup_List.Add(multi_Undo_Data);
784
                                //multi_Undo_Data = new Multi_Undo_data();
785
                            }
786
                            break;
787
                        case ("CloudControl"):
788
                            {
789
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
790

    
791
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
792
                                //UndoData.Markup_List.Add(multi_Undo_Data);
793
                                //multi_Undo_Data = new Multi_Undo_data();
794
                            }
795
                            break;
796
                    }
797
                }
798

    
799
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
800
                //{
801
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
802
                //});
803
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
804
            }
805

    
806
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
807
            Properties.Settings.Default.Save();
808
        }
809

    
810
        //강인구 추가(Undo End)
811
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
812
        {
813
            //강인구 추가
814
            if (this.ParentOfType<MainWindow>() != null)
815
            {
816
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
817
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
818
                {
819
                    Undo_data UndoData = new Undo_data()
820
                    {
821
                        IsUndo = false,
822
                        Event = Event_Type.Option,
823
                        EventTime = DateTime.Now,
824
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
825
                        Markup_List = new List<Multi_Undo_data>()
826
                    };
827
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
828

    
829
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
830
                    {
831
                        if (item.GetType().Name == "AdornerFinal")
832
                        {
833
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
834
                            {
835
                                switch (InnerItem.DrawingData.GetType().Name)
836
                                {
837
                                    case ("LineControl"):
838
                                        {
839
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
840
                                        }
841
                                        break;
842
                                    case ("ArcControl"):
843
                                        {
844
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
845
                                        }
846
                                        break;
847
                                    case ("ArrowArcControl"):
848
                                        {
849
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
850
                                        }
851
                                        break;
852
                                    case ("ArrowControl_Multi"):
853
                                        {
854
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
855
                                        }
856
                                        break;
857
                                    case ("CloudControl"):
858
                                        {
859
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
860
                                        }
861
                                        break;
862
                                    case ("PolygonControl"):
863
                                        {
864
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
865
                                        }
866
                                        break;
867
                                    case ("RectangleControl"):
868
                                        {
869
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
870
                                        }
871
                                        break;
872
                                    case ("RectCloudControl"):
873
                                        {
874
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
875
                                        }
876
                                        break;
877
                                    case ("TriControl"):
878
                                        {
879
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
880
                                        }
881
                                        break;
882
                                    case ("CircleControl"):
883
                                        {
884
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
885
                                        }
886
                                        break;
887
                                    case ("InsideWhiteControl"):
888
                                        {
889
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
890
                                        }
891
                                        break;
892
                                    case ("OverlapWhiteControl"):
893
                                        {
894
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
895
                                        }
896
                                        break;
897
                                    case ("ClipWhiteControl"):
898
                                        {
899
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
900
                                        }
901
                                        break;
902
                                    case ("CoordinateControl"):
903
                                        {
904
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
905
                                        }
906
                                        break;
907
                                }
908

    
909
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
910
                                UndoData.Markup_List.Add(multi_Undo_Data);
911
                                multi_Undo_Data = new Multi_Undo_data();
912
                            }
913

    
914
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
915
                            {
916
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
917
                            });
918
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
919
                        }
920
                    }
921
                }
922
            }
923
        }
924

    
925
        //강인구 추가
926
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
927
        {
928
            //if (this.ParentOfType<MainWindow>() != null)
929
            //{
930
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
931
            //    {
932
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
933
            //        {
934
            //            if (item.GetType().Name == "AdornerFinal")
935
            //            {
936
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
937
            //                {
938
            //                    switch (InnerItem.DrawingData.GetType().Name)
939
            //                    {
940
            //                        case ("TextControl"):
941
            //                            {
942
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
943
            //                            }
944
            //                            break;
945
            //                        case ("ArrowTextControl"):
946
            //                            {
947
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
948
            //                            }
949
            //                            break;
950
            //                    }
951
            //                }
952
            //            }
953
            //        }
954
            //    }
955
            //}
956
        }
957

    
958
        //강인구 추가
959
        private void btnBold_Checked(object sender, RoutedEventArgs e)
960
        {
961
            if (this.ParentOfType<MainWindow>() != null)
962
            {
963
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
964
                {
965
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
966
                    {
967
                        if (item.GetType().Name == "AdornerFinal")
968
                        {
969
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
970
                            {
971
                                switch (InnerItem.DrawingData.GetType().Name)
972
                                {
973
                                    case ("TextControl"):
974
                                        {
975
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
976
                                            {
977
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
978
                                            }
979
                                            else
980
                                            {
981
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
982
                                            }
983

    
984
                                        }
985
                                        break;
986
                                    case ("ArrowTextControl"):
987
                                        {
988
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
989
                                            {
990
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
991
                                            }
992
                                            else
993
                                            {
994
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
995
                                            }
996
                                        }
997
                                        break;
998
                                }
999
                            }
1000
                        }
1001
                    }
1002
                }
1003
            }
1004
        }
1005

    
1006
        //강인구 추가
1007
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1008
        {
1009
            if (this.ParentOfType<MainWindow>() != null)
1010
            {
1011
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1012
                {
1013
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1014
                    {
1015
                        if (item.GetType().Name == "AdornerFinal")
1016
                        {
1017
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1018
                            {
1019
                                switch (InnerItem.DrawingData.GetType().Name)
1020
                                {
1021
                                    case ("TextControl"):
1022
                                        {
1023
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1024
                                            {
1025
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1026
                                            }
1027
                                            else
1028
                                            {
1029
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1030
                                            }
1031

    
1032
                                        }
1033
                                        break;
1034
                                    case ("ArrowTextControl"):
1035
                                        {
1036
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1037
                                            {
1038
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1039
                                            }
1040
                                            else
1041
                                            {
1042
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1043
                                            }
1044
                                        }
1045
                                        break;
1046
                                }
1047
                            }
1048
                        }
1049
                    }
1050
                }
1051
            }
1052
        }
1053

    
1054
        //강인구 추가
1055
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1056
        {
1057
            if (this.ParentOfType<MainWindow>() != null)
1058
            {
1059
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1060
                {
1061
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1062
                    {
1063
                        if (item.GetType().Name == "AdornerFinal")
1064
                        {
1065
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1066
                            {
1067
                                switch (InnerItem.DrawingData.GetType().Name)
1068
                                {
1069
                                    case ("TextControl"):
1070
                                        {
1071
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1072
                                            {
1073
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1074
                                            }
1075
                                            else
1076
                                            {
1077
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1078
                                            }
1079
                                        }
1080
                                        break;
1081
                                    case ("ArrowTextControl"):
1082
                                        {
1083
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1084
                                            {
1085
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1086
                                            }
1087
                                            else
1088
                                            {
1089
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1090
                                            }
1091
                                        }
1092
                                        break;
1093
                                }
1094
                            }
1095
                        }
1096
                    }
1097
                }
1098
            }
1099
        }
1100

    
1101
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1102
        {
1103
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1104
        }
1105

    
1106
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1107
        {
1108
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1109
            {
1110
                comboFontSize.Value = comboFontSize.Minimum;
1111
            }
1112
            if (this.ParentOfType<MainWindow>() != null)
1113
            {
1114
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1115
                {
1116
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1117
                    {
1118
                        if (item.GetType().Name == "AdornerFinal")
1119
                        {
1120
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1121
                            {
1122
                                switch (InnerItem.DrawingData.GetType().Name)
1123
                                {
1124
                                    case ("TextControl"):
1125
                                        {
1126
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1127
                                        }
1128
                                        break;
1129
                                    case ("ArrowTextControl"):
1130
                                        {
1131
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1132
                                        }
1133
                                        break;
1134
                                }
1135
                            }
1136
                        }
1137
                    }
1138
                }
1139
            }
1140
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1141
            Properties.Settings.Default.Save();
1142
        }
1143

    
1144
        //강인구 추가
1145
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1146
        {
1147
            if (this.ParentOfType<MainWindow>() != null)
1148
            {
1149
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1150
                {
1151
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1152
                    {
1153
                        if (item.GetType().Name == "AdornerFinal")
1154
                        {
1155
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1156
                            {
1157
                                switch (InnerItem.DrawingData.GetType().Name)
1158
                                {
1159
                                    case ("TextControl"):
1160
                                        {
1161
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1162
                                            //{
1163
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily = new FontFamily(comboFontFamily.Text);
1164
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1165
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1166
                                            //}
1167
                                            //else
1168
                                            //{
1169
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1170
                                            //}
1171
                                        }
1172
                                        break;
1173
                                    case ("ArrowTextControl"):
1174
                                        {
1175
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1176
                                            //{
1177
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1178
                                            //}
1179
                                            //else
1180
                                            //{
1181
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1182
                                            //}
1183
                                        }
1184
                                        break;
1185
                                }
1186
                            }
1187
                        }
1188
                    }
1189
                }
1190
            }
1191
        }
1192

    
1193
        /// <summary>
1194
        /// 텍스트 컨트롤 하일라이트 처리
1195
        /// </summary>
1196
        /// <param name="sender"></param>
1197
        /// <param name="e"></param>
1198
        private void HighlightEvent(object sender, RoutedEventArgs e)
1199
        {
1200

    
1201
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1202
            SetHighlightEvent();
1203
            //if ((sender as CheckBox).IsChecked.Value)
1204
            //{
1205
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1206
            //}
1207
            //else
1208
            //{
1209
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1210
            //}
1211
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1212
            //{
1213
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1214
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1215
            //    instance.SetText();
1216
            //}
1217
        }
1218

    
1219
        //추가페이지 이동 엔터
1220
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1221
        {
1222
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1223
            if (e.Key == Key.Enter)
1224
            {
1225
                try
1226
                {
1227
                    var instanceMain = this.ParentOfType<MainWindow>();
1228
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1229
                }
1230
                catch (Exception)
1231
                {
1232
                    RadWindow.Alert(new DialogParameters
1233
                    {
1234
                        Owner = Application.Current.MainWindow,
1235
                        Theme = new VisualStudio2013Theme(),
1236
                        Header = "안내",
1237
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1238
                    });
1239
                }
1240
                
1241
            }
1242
        }
1243

    
1244
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1245
        {
1246
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1247
            if (e.Key == Key.Enter)
1248
            {
1249
                try
1250
                {
1251
                    var instanceMain = this.ParentOfType<MainWindow>();
1252
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1253
                }
1254
                catch (Exception)
1255
                {
1256
                    RadWindow.Alert(new DialogParameters
1257
                    {
1258
                        Owner = Application.Current.MainWindow,
1259
                        Theme = new VisualStudio2013Theme(),
1260
                        Header = "안내",
1261
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1262
                    });
1263
                }
1264

    
1265
            }
1266
        }
1267
        
1268

    
1269
        //public event EventHandler<WindowClosedEventArgs> Closed;
1270

    
1271
        //private void CheckEvent(object sender, RoutedEventArgs e)
1272
        //{
1273
        //    RadWindow CheckPop = new RadWindow();
1274
        //    test check = new test();
1275

    
1276
        //    CheckPop = new RadWindow
1277
        //    {
1278
        //        Width = 1700,
1279
        //        Height = 510,
1280
        //        Header = "My Check List",
1281
        //        Content = check,
1282
        //        Owner = this,
1283
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1284
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1285
        //    };
1286
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1287

    
1288
        //    CheckPop.Closed += CheckPop_Closed;
1289
        //    CheckPop.ShowDialog();
1290
        //}
1291

    
1292
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1293
        {
1294
            PanoramaShow();
1295
        }
1296

    
1297
        public void PanoramaShow()
1298
        {
1299
            Panorama check = new Panorama();
1300
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1301
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1302
            //double windowWidth = this.Width;
1303
            //double windowHeight = this.Height;
1304

    
1305
            var PanoramaPop = new RadWindow
1306
            {
1307
                //MinWidth = 600,
1308
                //MinHeight = 400,
1309
                //Header = "My Check List",
1310
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1311
                Content = check,
1312
                Owner = this,
1313
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1314
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1315
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1316
                IsTopmost = false,
1317
                //Left = (screenWidth / 2) - (windowWidth / 2),
1318
                //Top = (screenHeight / 2) - (windowHeight / 2),
1319
                //Left = (screenWidth / 2),
1320
                //Top = (screenHeight / 2),
1321
                Width = screenWidth * 0.4,
1322
                Height = screenHeight * 0.4,
1323
            };
1324
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1325
            //CheckPop.ShowDialog();
1326
            PanoramaPop.Owner = Application.Current.MainWindow;
1327
            PanoramaPop.Show();
1328
        }
1329

    
1330
        private void CheckEvent(object sender, RoutedEventArgs e)
1331
        {
1332
            //창이 떠있을 경우 재 실행 방지
1333
            if (isClosed)
1334
            {
1335
                //토글 및 마우스 상태 초기화
1336
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1337
                foreach(var togle in toggleList)
1338
                {
1339
                    togle.IsChecked = false;
1340
                }
1341
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1342

    
1343
                isClosed = false;
1344

    
1345
                
1346
                CheckList check = new CheckList();
1347

    
1348
                CheckPop = new RadWindow
1349
                {
1350
                    MinWidth = 1200,
1351
                    MinHeight = 500,
1352
                    //Header = "My Check List",
1353
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1354
                    Content = check,
1355
                    //Owner = this,
1356
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1357
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1358
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1359
                    IsTopmost = true,
1360
                };
1361
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1362
                CheckPop.Closed += CheckPop_Closed;
1363
                
1364
                //CheckPop.ShowDialog();
1365
                CheckPop.Show();
1366
            }
1367
        }
1368

    
1369
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1370
        {
1371
            isClosed = true;
1372
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1373
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1374
            ViewerDataModel.Instance.Capture_Opacity = 0;
1375
        }
1376

    
1377
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1378
        {
1379
            isClosed = true;
1380
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1381
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1382
            ViewerDataModel.Instance.Capture_Opacity = 0;
1383
        }
1384

    
1385
        /// <summary>
1386
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1387
        /// </summary>
1388
        /// <param name="sender"></param>
1389
        /// <param name="e"></param>
1390
        private void PageGoEvent(object sender, RoutedEventArgs e)
1391
        {
1392
            RadButton button = sender as RadButton;
1393
            var instanceMain = this.ParentOfType<MainWindow>();
1394
            
1395
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1396
            try
1397
            {
1398
                switch (button.CommandParameter.ToString())
1399
                {
1400
                    case "Down":
1401
                        {
1402
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1403
                        }
1404
                        break;
1405
                    case "Up":
1406
                        {
1407
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1408
                        }
1409
                        break;
1410
                }
1411
            }
1412
            catch (Exception)
1413
            {
1414
                RadWindow.Alert(new DialogParameters
1415
                {
1416
                    Owner = Application.Current.MainWindow,
1417
                    Theme = new VisualStudio2013Theme(),
1418
                    Header = "안내",
1419
                    Content = "페이지 번호를 정확하게 입력해 주세요",
1420
                });
1421
            }
1422
        }
1423

    
1424
        private void viewEvent(object sender, RoutedEventArgs e)
1425
        {
1426
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1427
            var instanceMain = this.ParentOfType<MainWindow>();
1428

    
1429
            Point point = new Point(instanceMain.dzMainMenu.zoomAndPanCanvas.Width / 2, instanceMain.dzMainMenu.zoomAndPanCanvas.Height / 2);
1430

    
1431
            //if ((sender as RadRibbonToggleButton) != null)
1432
            //{
1433
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1434
            //    instanceToggle = (sender as RadRibbonToggleButton);
1435
            //}
1436

    
1437
            //instanceToggle.IsChecked = false;
1438

    
1439
            switch (viewButton.CommandParameter.ToString())
1440
            {
1441
                case "zoomout":
1442
                    {
1443
                        //장원
1444
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1445
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1446
                        viewButton.IsChecked = false;
1447
                        //Common.ViewerDataModel.Instance.zom
1448
                    }
1449
                    break;
1450
                case "zoomin":
1451
                    {
1452
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1453
                        viewButton.IsChecked = false;
1454
                    }
1455
                    break;
1456
                case "fullscreen":
1457
                    {
1458
                        instanceMain.WindowState = WindowState.Maximized;
1459
                        //Sizemode 대기(강인구)
1460
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1461
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1462
                        viewButton.IsChecked = false;
1463
                    }
1464
                    break;
1465
                case "fitWidth":
1466
                    {
1467
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1468
                        viewButton.IsChecked = false;
1469
                    }
1470
                    break;
1471
                case "fitHeight":
1472
                    {
1473
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1474
                        viewButton.IsChecked = false;
1475
                    }
1476
                    break;
1477
                case "boundzoom":
1478
                    {
1479

    
1480
                    }
1481
                    break;
1482
                case "Rotate_M":
1483
                    {
1484
                        drawingPannelRotate(false);
1485
                        viewButton.IsChecked = false;
1486
                    }
1487
                    break;
1488
                case "Rotate_P":
1489
                    {
1490
                        drawingPannelRotate(true);
1491
                        viewButton.IsChecked = false;
1492
                    }
1493
                    break;
1494
                case "Rotate_half":
1495
                    {
1496
                        drawingPannelRotate(true);
1497
                        drawingPannelRotate(true);
1498
                        viewButton.IsChecked = false;
1499
                    }
1500
                    break;
1501
            }
1502
        }
1503

    
1504
        private void Control_Event(object sender, RoutedEventArgs e)
1505
        {
1506

    
1507
        }
1508

    
1509
        #region 대기
1510

    
1511
        public void drawingPannelRotate(bool Flag)
1512
        {
1513
            var instanceMain = this.ParentOfType<MainWindow>();
1514

    
1515
            //if (rotateOffSet > 3)
1516
            //    rotateOffSet = 0;
1517

    
1518
            //if (rotateOffSet < 0)
1519
            //    rotateOffSet = 3;
1520

    
1521
            if(Flag)
1522
            {
1523
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1524
                {
1525
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1526
                }
1527
                else
1528
                {
1529
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1530
                }
1531
            }
1532
            else
1533
            {
1534
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1535
                {
1536
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1537
                }
1538
                else
1539
                {
1540
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1541
                }
1542
            }
1543
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1544
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1545
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1546

    
1547
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1548
            {
1549
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1550
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1551
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1552
            }
1553
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1554
            {
1555
                instanceMain.dzMainMenu.translate.X = 0;
1556
                instanceMain.dzMainMenu.translate.Y = 0;
1557
            }
1558
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1559
            {
1560
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1561
                instanceMain.dzMainMenu.translate.Y = 0;
1562
            }
1563
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1564
            {
1565
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1566
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1567
            }
1568
            else
1569
            {
1570
                instanceMain.dzMainMenu.translate.X = 0;
1571
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1572
            }
1573

    
1574
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1575
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1576
            //대기(강인구)
1577
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1578

    
1579

    
1580
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1581
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1582
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1583

    
1584

    
1585
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1586
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1587
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1588
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1589
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1590
            //ViewerDataModel.Instance.Document_Info.Clear();
1591
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1592
            //{
1593
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1594
            //});
1595

    
1596

    
1597
            //이미지 각도 변경 시 실시간 Thumbnail 각도 변경(강인구 추가)
1598
            instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(data =>
1599
            {
1600
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1601

    
1602
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1603
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1604
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1605

    
1606
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1607

    
1608
                //rotation page add or update
1609
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1610
                if (rotationdoc != null)
1611
                {
1612
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1613
                }
1614
                else
1615
                {
1616
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1617
                }
1618
            });
1619
        }
1620
        #endregion
1621

    
1622
        private void ImageConverter(RadToggleButton instanceToggle)
1623
        {
1624
            try
1625
            {           
1626
                var instanceMain = this.ParentOfType<MainWindow>();
1627
                //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1628

    
1629
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1630
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1631
                Nullable<bool> result = dlg.ShowDialog();
1632
                if (result == true)
1633
                {
1634
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1635
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1636

    
1637
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1638
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1639
                    long numByte = fileInfo.Length;
1640
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1641
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1642

    
1643
                    if (dLen < 4)
1644
                    {
1645
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1646
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1647
                        byte[] data = br.ReadBytes((int)numByte);
1648
                        br.Close();
1649

    
1650
                        string filepath = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1651

    
1652
                        Check_Uri.UriCheck(filepath);
1653

    
1654
                        instanceMain.dzMainMenu.filename = filepath;
1655

    
1656
                        fStream.Close();
1657
                        fStream.Dispose();
1658
                    }
1659
                    else
1660
                    {
1661
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1662
                    }
1663
                }
1664
            }
1665
            catch(Exception ex)
1666
            {
1667
                instanceToggle.IsChecked = false;
1668
                Common.ViewerDataModel.Instance.SelectedControl = "";
1669
                Common.ViewerDataModel.Instance.ControlTag = null;
1670
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1671
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1672
                this.ParentOfType<MainWindow>().DialogMessage_Alert(""+ ex , "Alert");
1673
            }
1674
        }
1675

    
1676
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1677
        {
1678

    
1679
        }
1680

    
1681
        private void ControlEvent(object sender, RoutedEventArgs e)
1682
        {
1683
            RadToggleButton instanceToggle = sender as RadToggleButton;
1684
            var instanceMain = this.ParentOfType<MainWindow>();
1685

    
1686
            #region Ctrl + A 눌렀을 때 대처 방법 
1687
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1688
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1689
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1690
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1691
            {
1692
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1693
                //foreach (var item in lstItem)
1694
                //{
1695
                //    foreach (var member in item.MemberSet)
1696
                //    {
1697
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1698
                //        {
1699
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1700
                //        }
1701
                //    }
1702
                //}
1703
            }
1704
            #endregion
1705

    
1706
            //if (!instanceMain.IsFreeSelectionMode)
1707
            //{
1708
            //    instanceMain.IsSwingMode = true;
1709
            //}
1710

    
1711
            #region 다른 컨트롤 버튼 선택 해제
1712
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1713
            {
1714
                if (ControlState == null)
1715
                {
1716
                    instanceToggle.IsChecked = false;
1717
                    HiddenControlHide();
1718
                }
1719
            });
1720
            #endregion
1721

    
1722
            Release_ToggleButton(sender); //-> 해당 컨트롤을 제외한 모든 컨트롤에 대해 해제 처리
1723

    
1724
            if (instanceToggle != null)
1725
            {
1726
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1727
            }
1728
            else if ((sender as RadRibbonToggleButton) != null)
1729
            {
1730
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1731
                instanceToggle = (sender as RadRibbonToggleButton);
1732
            }
1733
            else if ((sender as RadRibbonButton) != null)
1734
            {
1735
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1736
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1737
            }
1738
            else
1739
            {
1740
                RadButton instanceButton = sender as RadButton;
1741
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1742
            }
1743

    
1744

    
1745

    
1746
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1747
            {
1748
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1749
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1750
                {
1751
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1752
                });
1753
            });
1754
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1755

    
1756
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1757

    
1758
            if (instanceToggle.IsChecked != false)
1759
            {
1760
                #region 컨트롤이 체크되었다면
1761
                switch (instanceToggle.CommandParameter.ToString())
1762
                {
1763
                    #region Line
1764
                    case "Line":
1765
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
1766
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1767
                        if (instanceToggle.Tag.ToString() == "LineDelete")
1768
                        {
1769
                            //HiddenInterval.Visibility = Visibility.Visible;
1770
                        }
1771
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
1772
                        break;
1773
                    #endregion
1774
                    #region ChainLine
1775
                    case "ChainLine":
1776
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
1777
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1778
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
1779
                        break;
1780
                    #endregion
1781
                    #region DimLine
1782
                    case "DimLine":
1783
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
1784
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1785
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
1786
                        break;
1787
                    #endregion
1788
                    #region TwinLine
1789
                    case "TwinLine":
1790
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
1791
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1792
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
1793
                        break;
1794
                    #endregion
1795
                    #region CancelLine
1796
                    case "CancelLine":
1797
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
1798
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1799
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
1800
                        break;
1801
                    #endregion
1802
                    #region PolygonCloud
1803
                    case "PolygonCloud":
1804
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
1805
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1806
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
1807
                        break;
1808
                    #endregion
1809
                    #region RectCloud
1810
                    case "RectCloud":
1811
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
1812
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1813
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
1814
                        break;
1815
                    #endregion
1816
                    #region Rectangle
1817
                    case "Rectangle":
1818
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
1819
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1820
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
1821
                        break;
1822
                    #endregion
1823
                    #region Triangle
1824
                    case "Triangle":
1825
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
1826
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1827
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
1828
                        break;
1829
                    #endregion
1830
                    #region RectCloud
1831
                    case "Circle":
1832
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
1833
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1834
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
1835
                        break;
1836
                    #endregion
1837
                    #region Symbol
1838
                    case "Symbol":
1839
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
1840
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1841
                        break;
1842
                    #endregion
1843
                    #region SymbolN
1844
                    case "SymbolN":
1845
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
1846
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
1847
                        break;
1848
                    #endregion
1849
                    #region Text
1850
                    case "Text":
1851
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
1852
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1853
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
1854
                        break;
1855
                    #endregion
1856
                    #region TextBorder
1857
                    case "TextBorder":
1858
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
1859
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1860
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
1861
                        break;
1862
                    #endregion
1863
                    #region TextCloud
1864
                    case "TextCloud":
1865
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
1866
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1867
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
1868
                        break;
1869
                    #endregion
1870
                    #region Date
1871
                    case "Date":
1872
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
1873
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
1874
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
1875
                        break;
1876
                    #endregion
1877
                    #region ArrowText
1878
                    case "ArrowText":
1879
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
1880
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
1881
                        {
1882
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
1883
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
1884
                        }
1885
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
1886
                        {
1887
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
1888
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
1889
                        }
1890
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
1891
                        {
1892
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
1893
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
1894
                        }
1895
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
1896
                        {
1897
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
1898
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
1899
                        }
1900
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
1901
                        {
1902
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
1903
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
1904
                        }
1905
                        else
1906
                        {
1907
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
1908
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
1909
                            //HiddenAxisLock.Visibility = Visibility.Visible;
1910
                        }
1911
                        break;
1912
                    #endregion
1913
                    #region Arrow
1914
                    case "Arrow":
1915
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
1916
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1917
                        //HiddenDimSize.Visibility = Visibility.Visible;
1918
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
1919
                        break;
1920
                    #endregion
1921
                    #region Shape
1922
                    case "Shape":
1923
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
1924
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
1925
                        break;
1926
                    #endregion
1927
                    #region Polygon
1928
                    case "Polygon":
1929
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
1930
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
1931
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1932
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
1933
                        break;
1934
                    #endregion
1935
                    #region Arc
1936
                    case "Arc":
1937
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
1938
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
1939
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1940
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1941
                        break;
1942
                    #endregion
1943
                    #region ArrowArc
1944
                    case "ArrowArc":
1945
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowArc";
1946
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcArrow;
1947
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1948
                        TaskMessage("ArcArrow 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1949
                        break;
1950
                    #endregion
1951
                    #region ArrowMulti
1952
                    case "ArrowMulti":
1953
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
1954
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
1955
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1956
                        break;
1957
                    #endregion
1958
                    #region Etc
1959
                    case "Etc":
1960
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
1961
                        break;
1962
                    #endregion
1963
                    #region Ink
1964
                    case "Ink":
1965
                        if (instanceToggle.Tag.ToString() == "EraserClear")
1966
                        {
1967
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1968
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
1969
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
1970
                        }
1971
                        else if (instanceToggle.Tag.ToString() == "Eraser")
1972
                        {
1973
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1974
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
1975
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
1976
                        }
1977
                        else
1978
                        {
1979
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
1980
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
1981
                        }
1982

    
1983
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1984

    
1985
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
1986
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
1987
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
1988
                        break;
1989
                    #endregion
1990
                    #region Select
1991
                    case "Select":
1992
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
1993
                        {
1994
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
1995
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
1996
                        }
1997
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
1998
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1999
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2000
                        break;
2001
                    #endregion
2002
                    #region Image
2003
                    case "Image":
2004
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2005
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2006
                        ImageConverter(instanceToggle);
2007
                        break;
2008
                    #endregion
2009
                    #region Sign
2010
                    case "Sign":
2011
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2012
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2013
                        //강인구 추가
2014
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2015
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2016
                        //{
2017
                        //    if (ea.Result == null)
2018
                        //    {
2019

    
2020
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2021
                        //    }
2022
                        //    else
2023
                        //    {
2024
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2025
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2026
                        //        {
2027
                        //            BitmapImage im = new BitmapImage();
2028
                        //            im.SetSource(ms);
2029
                        //            instanceMain.DeepLayer.SignImage = im;
2030
                        //            ms.Close();
2031
                        //        }
2032
                        //    }
2033
                        //};
2034
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2035
                        break;
2036
                    #endregion
2037
                    #region Check
2038
                    case "Check":
2039
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2040
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2041
                        //강인구 추가
2042
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2043
                        break;
2044
                    #endregion
2045
                    #region Batch
2046
                    case "Batch":
2047
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2048
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2049
                        //강인구 추가
2050
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2051
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2052
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2053
                        break;
2054
                    #endregion
2055
                    #region Copy
2056
                    case "Copy":
2057
                        Copy_Start();
2058
                        instanceToggle.IsChecked = false;
2059
                        ViewerDataModel.Instance.SelectedControl = "";
2060
                        ViewerDataModel.Instance.ControlTag = null;
2061
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2062
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2063
                        break;
2064
                    #endregion
2065
                    #region Cut
2066
                    case "Cut":
2067
                        Cut_Start();
2068
                        instanceToggle.IsChecked = false;
2069
                        ViewerDataModel.Instance.SelectedControl = "";
2070
                        ViewerDataModel.Instance.ControlTag = null;
2071
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2072
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2073
                        break;
2074
                    #endregion
2075
                    #region Paste
2076
                    case "Paste":
2077
                        Paste_Start();
2078
                        instanceToggle.IsChecked = false;
2079
                        ViewerDataModel.Instance.SelectedControl = "";
2080
                        ViewerDataModel.Instance.ControlTag = null;
2081
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2082
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2083
                        break;
2084
                    #endregion
2085
                    #region Delete
2086
                    case "Delete":
2087
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2088
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2089

    
2090
                        instanceToggle.IsChecked = false;
2091
                        ViewerDataModel.Instance.SelectedControl = "";
2092
                        ViewerDataModel.Instance.ControlTag = null;
2093
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2094
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2095
                        break;
2096
                    #endregion
2097
                    #region Undo
2098
                    case "Undo":
2099
                        UndoCommand.Instance.Execute();
2100
                        instanceToggle.IsChecked = false;
2101
                        ViewerDataModel.Instance.SelectedControl = "";
2102
                        ViewerDataModel.Instance.ControlTag = null;
2103
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2104
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2105
                        break;
2106
                    #endregion
2107
                    #region Redo
2108
                    case "Redo":
2109
                        RedoCommand.Instance.Execute();
2110
                        instanceToggle.IsChecked = false;
2111
                        ViewerDataModel.Instance.SelectedControl = "";
2112
                        ViewerDataModel.Instance.ControlTag = null;
2113
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2114
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2115
                        break;
2116
                    #endregion
2117
                    #region DragZoom
2118
                    case "DragZoom":
2119
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2120
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2121
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2122
                        break;
2123
                    #endregion
2124
                    #region Grouping
2125
                    case "Group":
2126
                        var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2127
                        foreach (var togle in GrouptoggleList)
2128
                        {
2129
                            togle.IsChecked = false;
2130
                        }
2131

    
2132
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2133
                        {
2134
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2135
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2136
                        }
2137
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2138
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2139
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2140
                        if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2141
                        {
2142
                            this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2143
                        }
2144
                        else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2145
                        {
2146
                            // string MarkupData = "";
2147
                            foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2148
                            {
2149
                                if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2150
                                {
2151
                                    //MARKUP_DATA_GROUP INSERT
2152
                                    MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2153
                                    {
2154
                                        SYMBOL_ID = null,//InnerItem.Symbol_ID
2155
                                        STATE = 0,
2156
                                    };
2157
                                    long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2158
                                    Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2159
                                    if (group_id > 0)
2160
                                    {
2161
                                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2162
                                        {
2163
                                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2164
                                            {
2165
                                                //MARKUP_DATA UPDATE
2166
                                                //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2167
                                                //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2168
                                                ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2169
                                                ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2170
                                            }
2171
                                        }
2172
                                    }
2173
                                }
2174
                            }
2175
                        }
2176
                        break;
2177
                    case "UnGroup":
2178
                        var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2179
                        foreach (var togle in UnGrouptoggleList)
2180
                        {
2181
                            togle.IsChecked = false;
2182
                        }
2183
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2184
                        {
2185
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2186
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2187
                        }
2188
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2189
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2190
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2191

    
2192
                        if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2193
                        {
2194
                            this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2195
                        }
2196
                        else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2197
                        {
2198
                            // string MarkupData = "";
2199
                            foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2200
                            {
2201
                                if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2202
                                {
2203
                                    //MARKUP_DATA UPDATE
2204
                                    foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2205
                                    {
2206
                                        if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2207
                                        {
2208
                                            long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2209
                                            //MARKUP_DATA UPDATE
2210
                                            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2211
                                            //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2212
                                            ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2213
                                            ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2214

    
2215

    
2216
                                            //MARKUP_DATA_GROUP UPDATE
2217
                                            bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2218
                                            Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2219
                                        }
2220
                                    }
2221
                                }
2222
                            }
2223
                        }
2224
                        break;
2225
                    #endregion
2226
                    #region Capture
2227
                    case "Capture":
2228
                        SyncInit();
2229
                        //   instanceToggle.IsChecked = false;
2230
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2231
                        foreach (var togle in CaptureList)
2232
                        {
2233
                            togle.IsChecked = false;
2234
                        }
2235

    
2236
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2237
                        {
2238
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2239
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2240
                        }
2241

    
2242
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2243
                   //     ViewerDataModel.Instance.ControlTag = null;
2244
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2245

    
2246
                        /*
2247
                        //캡쳐 하기 전에 코멘트 저장
2248
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2249
                        {
2250
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2251
                            menu.ReleaseAdorner();
2252
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2253
                            {
2254
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2255
                            }
2256
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2257
                            {
2258

    
2259
                            }
2260
                            else
2261
                            {
2262
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2263
                            }
2264
                        }*/
2265

    
2266
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2267
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2268
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2269
                        Application.Current.MainWindow.Focus();
2270
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2271
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2272
                        break;
2273
                    #endregion
2274
                    #region Cad
2275
                    case "Inside":
2276
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2277
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2278
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2279
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2280
                        break;
2281
                    case "Overlap":
2282
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2283
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2284
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2285
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2286
                        break;
2287
                    case "Clip":
2288
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2289
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2290
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2291
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2292
                        break;
2293
                    case "CadExport":
2294
                        if (isClosed)
2295
                        {
2296
                            //토글 및 마우스 상태 초기화
2297
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2298
                            foreach (var togle in toggleList)
2299
                            {
2300
                                togle.IsChecked = false;
2301
                            }
2302
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2303

    
2304
                            isClosed = false;
2305
                            //Control 파일 먼저 생성
2306
                            CollapsedButton_Click();
2307
                            CadViewer check = new CadViewer();
2308
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2309
                            check.Title = "Export Viewer";
2310
                            //check.Topmost = true;
2311
                            check.Show();
2312
                            check.Closed += Check_Closed;
2313
                            instanceToggle.IsChecked = false;
2314
                        }
2315
                        break;
2316
                    case "CadViewer":
2317
                        if (isClosed)
2318
                        {
2319
                            //토글 및 마우스 상태 초기화
2320
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2321
                            foreach (var togle in toggleList)
2322
                            {
2323
                                togle.IsChecked = false;
2324
                            }
2325
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2326

    
2327
                            isClosed = false;
2328
                            CadResultViewer check = new CadResultViewer();
2329
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2330
                            check.Title = "Viewer";
2331
                            check.Show();
2332

    
2333
                            check.Closed += Check_Closed;
2334

    
2335
                        }
2336
                        break;
2337
                    #endregion
2338
                    default:
2339
                        break;
2340
                }
2341
                #endregion
2342
            }
2343
            else
2344
            {
2345

    
2346
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2347
                {
2348
                    instanceMain.dzMainMenu.IsSwingMode = false;
2349
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2350
                    Common.ViewerDataModel.Instance.ControlTag = null;
2351
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2352
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2353
                }
2354
            }
2355
        }
2356

    
2357
        private void SyncInit()
2358
        {
2359
            try
2360
            {
2361
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2362
                {
2363
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2364
                    ViewerDataModel.Instance.PageBalanceMode = false;
2365
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2366
                    ViewerDataModel.Instance.PageNumber = 0;
2367
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2368
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2369
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2370
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2371
                }
2372
            }
2373
            catch (Exception ex)
2374
            {
2375
                Logger.sendResLog("SyncInit", ex.Message, 0);
2376
            }
2377

    
2378
        }
2379

    
2380
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2381
        CommentUserInfo currentControl { get; set; }
2382
        private Point GetSquareEndPoint(Point StartP, Point EndP)
2383
        {
2384
            Point Return_Point = new Point();
2385
            double dx = EndP.X - StartP.X;
2386
            double dy = EndP.Y - StartP.Y;
2387
            double length;
2388
            length = Math.Max(Math.Abs(dx), Math.Abs(dy));
2389
            Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length;
2390
            Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length;
2391
            return Return_Point;
2392
        }
2393
        private void Check_Closed(object sender, EventArgs e)
2394
        {
2395
            isClosed = true;
2396
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2397
            //토글 및 마우스 상태 초기화
2398
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2399
            foreach (var togle in toggleList)
2400
            {
2401
                togle.IsChecked = false;
2402
            }
2403
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2404
            ViewerDataModel.Instance.Capture_Opacity = 0;
2405

    
2406
        }
2407

    
2408
        /* public class test 
2409
         {
2410
             public double width { get; set; }
2411
             public double height { get; set; }
2412
         }
2413
         */
2414
        private void CollapsedButton_Click()
2415
        {
2416
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2417

    
2418
            string[] data = new string[0];
2419

    
2420
            int cnt = 0;
2421
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2422

    
2423
            List<MarkupInfoItem> gridSelectionItem = menu.gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
2424

    
2425
            foreach (var item in gridSelectionItem)
2426
            {
2427
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2428
                {
2429
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2430
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2431
                    data = new string[instance.Count];
2432
                    foreach (var markup in instance)
2433
                    {
2434
                        data[cnt++] = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(markup.Data);
2435
                    }
2436
                }
2437
            }
2438

    
2439
            if (data != null)
2440
            {
2441
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2442
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2443
                if (!File.Exists(FilePath))
2444
                {
2445
                    Directory.CreateDirectory(FilePath);
2446
                }
2447

    
2448
                if (!string.IsNullOrEmpty(FileName))
2449
                {
2450
                    //  File.WriteAllText(SaveDig.FileName, data);
2451
                    File.WriteAllLines(FileName, data);
2452
                }
2453
            }
2454
        }
2455

    
2456
        private double minHeight;
2457
        private double minWidth;
2458

    
2459
        private double maxHeight;
2460
        private double maxWidth;
2461

    
2462
        public bool CanVResize { get; private set; }
2463
        public bool CanHResize { get; private set; }
2464

    
2465
        public void DesignerComponent(FrameworkElement content)
2466
        {
2467
            this.InitializeComponent();
2468

    
2469
            if (!double.IsNaN(content.Width))
2470
            {
2471
                CanHResize = false;
2472
                this.Width = content.Width;
2473
            }
2474
            else
2475
            {
2476
                CanHResize = true;
2477
                this.Width = 23.0;
2478
            }
2479
            if (!double.IsNaN(content.Height))
2480
            {
2481
                CanVResize = false;
2482
                this.Height = content.Height; ;
2483
            }
2484
            else
2485
            {
2486
                CanVResize = true;
2487
                this.Height = 23.0;
2488
            }
2489

    
2490
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2491
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2492
            maxWidth = content.MaxWidth;
2493
            maxHeight = content.MaxHeight;
2494

    
2495
            double top = (double)content.GetValue(Canvas.TopProperty);
2496
            if (double.IsNaN(top))
2497
                top = 0.0;
2498
            double left = (double)content.GetValue(Canvas.LeftProperty);
2499
            if (double.IsNaN(left))
2500
                left = 0.0;
2501
            SetValue(Canvas.TopProperty, top);
2502
            SetValue(Canvas.LeftProperty, left);
2503

    
2504
            //Set the actual content. Note that "Content" property is a new property. See below
2505
            this.Content = content;
2506
        }
2507
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2508
        {
2509
            string name = ((Thumb)sender).Name;
2510
            if (name.Contains("Top"))
2511
            {
2512
                double newHeight = this.Height - e.VerticalChange;
2513
                if (newHeight >= minHeight && newHeight <= maxHeight)
2514
                {
2515
                    this.Height = newHeight;
2516
                    SetValue(Canvas.TopProperty,
2517
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2518
                }
2519
            }
2520
            if (name.Contains("Right"))
2521
            {
2522
                double newWidth = this.Width + e.HorizontalChange;
2523
                if (newWidth >= minWidth && newWidth <= maxWidth)
2524
                    this.Width = newWidth;
2525
            }
2526
            if (name.Contains("Bottom"))
2527
            {
2528
                double newHeight = this.Height + e.VerticalChange;
2529
                if (newHeight >= minHeight && newHeight <= maxHeight)
2530
                    this.Height = newHeight;
2531
            }
2532
            if (name.Contains("Left"))
2533
            {
2534
                double newWidth = this.Width - e.HorizontalChange;
2535
                if (newWidth >= minWidth && newWidth <= maxWidth)
2536
                {
2537
                    this.Width = newWidth;
2538
                    SetValue(Canvas.LeftProperty,
2539
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2540
                }
2541
            }
2542
        }
2543

    
2544
        private void drawControlBorder(object sender)
2545
        {
2546
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2547
        }
2548

    
2549
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2550
        {
2551
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2552
            if (designerItem != null)
2553
            {
2554
                double deltaVertical, deltaHorizontal;
2555

    
2556
                switch (VerticalAlignment)
2557
                {
2558
                    case VerticalAlignment.Bottom:
2559
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2560
                        designerItem.Height -= deltaVertical;
2561
                        break;
2562
                    case VerticalAlignment.Top:
2563
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2564
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2565
                        designerItem.Height -= deltaVertical;
2566
                        break;
2567
                    default:
2568
                        break;
2569
                }
2570

    
2571
                switch (HorizontalAlignment)
2572
                {
2573
                    case HorizontalAlignment.Left:
2574
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2575
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2576
                        designerItem.Width -= deltaHorizontal;
2577
                        break;
2578
                    case HorizontalAlignment.Right:
2579
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2580
                        designerItem.Width -= deltaHorizontal;
2581
                        break;
2582
                    default:
2583
                        break;
2584
                }
2585
            }
2586
            e.Handled = true;
2587
        }
2588

    
2589
        SaveFileDialog SaveDig = new SaveFileDialog(); //파일 세이브 다이얼로그
2590

    
2591
        void ExportMethod()
2592
        {
2593
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2594
            SaveDig.Filter = "PDF file format|*.pdf";
2595
            SaveDig.Title = "Save an DWG File";
2596
            SaveDig.ShowDialog();
2597
        }
2598

    
2599
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2600
        {            
2601
            if (cbAutoSave.IsChecked == true)
2602
            {
2603
                SaveTime(true, (int)cbSaveInterval.Value);
2604
            }
2605
            else
2606
            {
2607
                SaveTime(false, (int)cbSaveInterval.Value);
2608
            }
2609
        }
2610
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2611
        {
2612
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2613
            {
2614
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2615
            }
2616
            if (cbAutoSave.IsChecked == true)
2617
            {
2618
                SaveTime(true, (int)cbSaveInterval.Value);
2619
            }
2620

    
2621
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2622
            Properties.Settings.Default.Save();
2623
        }
2624
        //강인구 자동 저장 추가
2625
        private void AutoSave(object sender, RoutedEventArgs e)
2626
        {
2627
            RadToggleButton instanceToggle = sender as RadToggleButton;
2628

    
2629
            if(instanceToggle.IsChecked == true)
2630
            {
2631
                SaveTime(true);
2632
            }
2633
            else
2634
            {
2635
                SaveTime(false);
2636
            }
2637
        }
2638

    
2639
        public void Copy_Start()
2640
        {
2641
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2642
            {
2643
                string MarkupData = "";
2644

    
2645
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2646
                {
2647
                    if (item.GetType().Name == "AdornerFinal")
2648
                    {
2649
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2650

    
2651
                        {
2652
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2653
                            {
2654
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2655
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2656
                            }
2657
                        }
2658
                        Clipboard.SetText(MarkupData);
2659
                    }
2660
                }
2661
            }
2662
        }
2663

    
2664
        public void Cut_Start()
2665
        {
2666
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2667
            {
2668
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2669
                {
2670
                    string MarkupData = "";
2671

    
2672
                    if (item.GetType().Name == "AdornerFinal")
2673
                    {
2674
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2675
                        {
2676
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2677
                            {
2678
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2679
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2680
                            }
2681
                        }
2682
                        //클립보드에 넣음
2683
                        Clipboard.SetText(MarkupData);
2684
                    }
2685
                }
2686
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2687
            }
2688
        }
2689

    
2690
        public void Paste_Start()
2691
        {
2692
            //마크업 붙여넣기
2693
            //if (Clipboard.GetText().Contains("|DZ|"))
2694
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2695
            {
2696
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2697

    
2698
                string[] delimiterChars = { "|OR|" };
2699
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2700

    
2701
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2702

    
2703
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2704

    
2705
                //강인구 Undo/Redo 보류
2706
                UndoData = new Undo_data()
2707
                {
2708
                    IsUndo = false,
2709
                    Event = Event_Type.Create,
2710
                    EventTime = DateTime.Now,
2711
                    Markup_List = new List<Multi_Undo_data>()
2712
                };
2713

    
2714
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2715
                {
2716
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2717
                });
2718

    
2719
                foreach (string parse in data)
2720
                {
2721
                    if (parse != "")
2722
                    {
2723
                        System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2724
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2725

    
2726
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2727
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2728

    
2729
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2730

    
2731
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2732
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2733

    
2734
                        multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
2735

    
2736
                        UndoData.Markup_List.Add(multi_Undo_Data);
2737
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2738
                    }
2739
                }
2740
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2741

    
2742
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2743
                {
2744
                    Canvas.SetLeft(final, 0);
2745
                    Canvas.SetTop(final, 0);
2746
                }
2747
                else
2748
                {
2749
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2750
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2751
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2752

    
2753
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2754
                    {
2755
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2756
                    }
2757

    
2758
                }
2759
                
2760

    
2761
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2762

    
2763
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2764
                //Canvas.SetLeft(final, 50);
2765
                //Canvas.SetTop(final, 50);
2766
            }
2767
            //외부 이미지 붙여넣기
2768
            else if (Clipboard.GetImage() != null)
2769
            {
2770
                try
2771
                {
2772
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2773

    
2774
                    //강인구 Undo/Redo 보류
2775
                    UndoData = new Undo_data()
2776
                    {
2777
                        IsUndo = false,
2778
                        Event = Event_Type.Create,
2779
                        EventTime = DateTime.Now,
2780
                        Markup_List = new List<Multi_Undo_data>()
2781
                    };
2782

    
2783

    
2784
                    string temppath = System.IO.Path.GetTempPath();
2785
                    //string filename = KCOM.Events.Save.shortCommentKey();
2786
                    string filename = Commons.shortFileKey();
2787

    
2788
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2789
                    clipboardImage.Save(temppath + "\\" + filename);
2790

    
2791
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2792
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2793
                    long numByte = fileInfo.Length;
2794
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2795
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2796

    
2797
                    if (dLen < 4)
2798
                    {
2799
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2800
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2801
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2802
                        byte[] data = br.ReadBytes((int)numByte);
2803

    
2804
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2805
                        Check_Uri.UriCheck(filename);
2806
                        br.Close();
2807
                        fStream.Close();
2808
                        fStream.Dispose();
2809
                    }
2810
                    else
2811
                    {
2812
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2813
                        return;
2814
                    }
2815

    
2816
                    fileInfo.Delete();
2817

    
2818
                    //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2819
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2820
                    IntPtr hBitmap = bmp.GetHbitmap();
2821
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2822
                    Image img = new Image();
2823
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2824
                    if (filename.Contains(".svg"))
2825
                    {
2826
                        byte[] imageData = null;
2827
                        DrawingImage image = null;
2828
                        using (System.Net.WebClient web = new System.Net.WebClient())
2829
                        {
2830
                            imageData = web.DownloadData(new Uri(filename));
2831
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2832
                            image = SvgReader.Load(stream);
2833
                        }
2834
                        img.Source = image;
2835
                    }
2836
                    else
2837
                    {
2838
                        img.Source = new BitmapImage(new Uri(filename));
2839
                    }
2840

    
2841
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2842
                    {
2843
                        PointSet = new List<Point>(),
2844
                        //FilePath = img.Source.ToString(),
2845
                        FilePath = filename,
2846
                        ImageData = img.Source,
2847
                        StartPoint = new Point(100, 100),
2848
                        EndPoint = new Point(200, 200),
2849
                        TopRightPoint = new Point(100, 200),
2850
                        LeftBottomPoint = new Point(200, 100)
2851
                    };
2852

    
2853
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2854
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2855
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2856

    
2857
                    currentControl.PointSet = new List<Point>
2858
                                        {
2859
                                            currentControl.StartPoint,
2860
                                            currentControl.LeftBottomPoint,
2861
                                            currentControl.EndPoint,
2862
                                            currentControl.TopRightPoint,
2863
                                        };
2864

    
2865
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2866
                    UndoData.Markup_List.Add(multi_Undo_Data);
2867
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2868

    
2869
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2870
                    currentControl.CommentID = Commons.shortGuid();
2871

    
2872
                    currentControl.ApplyTemplate();
2873
                    currentControl.SetImage();
2874

    
2875
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2876
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2877
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2878

    
2879
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2880
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2881
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2882
                }
2883
                catch(Exception ex)
2884
                {
2885
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2886
                }
2887
            }
2888
        }
2889
    }
2890
}
클립보드 이미지 추가 (최대 크기: 500 MB)