프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (143 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
            this.ParentOfType<MainWindow>().dzMainMenu.EmptyControlCheck();
311

    
312
            if (this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy == true) return;
313

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

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

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

    
337
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
338

    
339
                //코멘트가 없을 경우
340
                if (ViewerDataModel.Instance.MarkupList_USER.Count == 0)
341
                {
342
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
343
                    {
344
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
345
                        {
346
                            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
347
                            return;
348
                        }
349
                    }
350
                }
351

    
352
                menu.ChangeCommentReact();
353

    
354
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
355
                {
356
                    RefactoryCommentReact(menu);
357
                }
358
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 && menu.gridViewMarkup.Items.Count > 0)
359
                {
360
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
361
                    return;
362
                }
363
                else
364
                {
365
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
366
                    {
367
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
368
                        {
369
                            RefactoryCommentReact(menu);
370
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
371

    
372
                            if (ViewerDataModel.Instance.IsConsolidate)
373
                            {
374
                                return;
375
                            }
376

    
377
                            menu.gridViewMarkup.ItemsSource = null;
378
                            menu.gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
379
                            menu.gridViewMarkup.SelectedItem = item;
380
                            GroupDescriptor descriptor = new GroupDescriptor();
381
                            descriptor.Member = "Depatment";
382
                            descriptor.DisplayContent = "DEPT";
383
                            descriptor.SortDirection = ListSortDirection.Ascending;
384
                            menu.gridViewMarkup.GroupDescriptors.Add(descriptor);
385

    
386
                            if (sender != null)
387
                            {
388
                                if (ViewerDataModel.Instance.IsPressCtrl)
389
                                {
390
                                    ViewerDataModel.Instance.IsPressCtrl = false;
391
                                }
392
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
393
                            }
394
                            return;
395
                        }
396
                    }
397
                }
398
                if (sender != null)
399
                {
400
                    if (ViewerDataModel.Instance.IsPressCtrl)
401
                    {
402
                        ViewerDataModel.Instance.IsPressCtrl = false;
403
                    }
404
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
405
                }
406
            }
407
            catch(Exception ex)
408
            {
409
               
410
            }
411
            finally
412
            {
413
            }
414
        }
415

    
416
		public void RefactoryCommentReact(MainMenu menu)
417
        {
418
            this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
419

    
420
            SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
421
            SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
422
            SaveCommand.Instance.user_id = App.ViewInfo.UserID;
423
            SaveCommand.Instance.page_no = Convert.ToInt32(tlcurrentPage.Text);
424

    
425
            try
426
            {
427
                List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
428
                foreach (var item in menu.gridViewMarkup.SelectedItems)
429
                {
430
                    if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
431
                    {
432
                        MySelectItem.Add(item as IKCOM.MarkupInfoItem);
433
                    }
434
                }
435

    
436
                menu.ChangeCommentReact();
437
                SaveCommand.Instance.Execute(MySelectItem, SaveCommand.Instance.page_no);
438
                SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
439
            }
440
            catch (Exception ex)
441
            {
442
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
443
                throw ex;
444
            }
445
        }
446

    
447
        //강인구 추가
448
        public void Print_Start(string Type)
449
        {
450
            if (ViewerDataModel.Instance.IsPressCtrl)
451
            {
452
                ViewerDataModel.Instance.IsPressCtrl = false;
453
            }
454
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
455
            {
456
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
457
                SelectionSet.Instance.UnSelect(menu);
458
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
459
                {
460
                    RefactoryCommentReact(menu);
461
                }
462
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
463
                {
464

    
465
                }
466
                else
467
                {
468
                    RefactoryCommentReact(menu);
469
                }
470
            }
471

    
472
            bool isprint = false;
473
            if (Type == "Print")
474
            {
475
                isprint = true;
476
            }
477

    
478
            RadWindow PrintWindow = new RadWindow();
479
            //IKCOM.MarkupInfoItem _result = null;
480
            PrintWindow.Width = 850;
481
            PrintWindow.Height = 600;
482
            //PrintWindow.Width = 650;
483
            //PrintWindow.Height = 550;
484
            PrintWindow.Header = Type;
485

    
486
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
487

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

    
491
            if (markupinfo.Count() > 0)
492
            {
493
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
494
            }
495
            else
496
            {
497
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
498
            }
499

    
500
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
501
                App.SystemInfo.HostName,
502
                App.ViewInfo.ProjectNO,
503
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
504
                App.ViewInfo.DocumentItemID
505
                );
506

    
507
            PrintWindow.Content = new KCOM.Control.PrintControl(
508
                      Tile_Url,
509
                      App.ViewInfo.ProjectNO,
510
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
511
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
512
                      App.ViewInfo.DocumentItemID,
513
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
514
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
515

    
516
            //프린트 팝업 옵션
517
            //PrintWindow.BorderThickness = new Thickness(3);
518
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
519
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
520
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
521
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
522
            PrintWindow.Background.Opacity = 0.6;
523
            PrintWindow.Owner = Application.Current.MainWindow;
524
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
525
            PrintWindow.ShowDialog();
526
        }
527

    
528
        //강인구 추가
529
        private void PrintEvent(object sender, RoutedEventArgs e)
530
        {
531
            RadRibbonButton button = sender as RadRibbonButton;
532
            Print_Start(button.Content.ToString());
533
        }
534

    
535
        private List<AdornerMember> GetAdornerItem()
536
        {
537
            List<AdornerMember> AdonerList = new List<AdornerMember>();
538

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

    
578
                foreach (AdornerMember InnerItem in AdonerList)
579
                {
580
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
581
                  
582
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
583
                    UndoData.Markup_List.Add(multi_Undo_Data);
584
                    multi_Undo_Data = new Multi_Undo_data();
585
                }
586

    
587
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
588
                {
589
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
590
                });
591
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
592
            }
593
        }
594

    
595
        //강인구 추가(Undo End)
596
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
597
        {
598
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
599
            {
600
                cbLineSize.Value = cbLineSize.Minimum;
601
            }
602
            List<AdornerMember> AdonerList = GetAdornerItem();
603
            if (AdonerList.Count > 0)
604
            {
605
                Undo_data UndoData = new Undo_data()
606
                {
607
                    IsUndo = false,
608
                    Event = Event_Type.Option,
609
                    EventTime = DateTime.Now,
610
                    LineSize = ViewerDataModel.Instance.LineSize,
611
                    Markup_List = new List<Multi_Undo_data>()
612
                };
613
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
614

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

    
703
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
704
                    UndoData.Markup_List.Add(multi_Undo_Data);
705
                    multi_Undo_Data = new Multi_Undo_data();
706
                }
707

    
708
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
709
                {
710
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
711
                });
712
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
713

    
714
                
715
            }
716
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
717
            Properties.Settings.Default.Save();
718
        }
719

    
720

    
721
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
722
        {
723
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
724
            {
725
                cbIntervalSize.Value = cbIntervalSize.Minimum;
726
            }
727
            List<AdornerMember> AdonerList = GetAdornerItem();
728
            if (AdonerList.Count > 0)
729
            {
730

    
731
                Undo_data UndoData = new Undo_data()
732
                {
733
                    IsUndo = false,
734
                    Event = Event_Type.Option,
735
                    EventTime = DateTime.Now,
736
                    Interval = ViewerDataModel.Instance.Interval,
737
                    Markup_List = new List<Multi_Undo_data>()
738
                };
739
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
740

    
741
                foreach (AdornerMember InnerItem in AdonerList)
742
                {
743
                    switch (InnerItem.DrawingData.GetType().Name)
744
                    {
745
                        case ("LineControl"):
746
                            {
747
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
748

    
749
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
750
                                UndoData.Markup_List.Add(multi_Undo_Data);
751
                                multi_Undo_Data = new Multi_Undo_data();
752
                            }
753
                            break;
754
                    }
755
                }
756

    
757
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
758
                {
759
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
760
                });
761
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
762
            }
763
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
764
            Properties.Settings.Default.Save();
765
        }
766
        
767
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
768
        {
769
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
770
            {
771
                cbArcLength.Value = cbArcLength.Minimum;
772
            }
773
            List<AdornerMember> AdonerList = GetAdornerItem();
774
            if (AdonerList.Count > 0)
775
            {
776

    
777
                //Undo_data UndoData = new Undo_data()
778
                //{
779
                //    IsUndo = false,
780
                //    Event = Event_Type.Option,
781
                //    EventTime = DateTime.Now,
782
                //    Interval = ViewerDataModel.Instance.Interval,
783
                //    Markup_List = new List<Multi_Undo_data>()
784
                //};
785
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
786

    
787
                foreach (AdornerMember InnerItem in AdonerList)
788
                {
789
                    switch (InnerItem.DrawingData.GetType().Name)
790
                    {
791
                        case ("RectCloudControl"):
792
                            {
793
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
794

    
795
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
796
                                //UndoData.Markup_List.Add(multi_Undo_Data);
797
                                //multi_Undo_Data = new Multi_Undo_data();
798
                            }
799
                            break;
800
                        case ("CloudControl"):
801
                            {
802
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
803

    
804
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
805
                                //UndoData.Markup_List.Add(multi_Undo_Data);
806
                                //multi_Undo_Data = new Multi_Undo_data();
807
                            }
808
                            break;
809
                    }
810
                }
811

    
812
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
813
                //{
814
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
815
                //});
816
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
817
            }
818

    
819
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
820
            Properties.Settings.Default.Save();
821
        }
822

    
823
        //강인구 추가(Undo End)
824
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
825
        {
826
            //강인구 추가
827
            if (this.ParentOfType<MainWindow>() != null)
828
            {
829
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
830
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
831
                {
832
                    Undo_data UndoData = new Undo_data()
833
                    {
834
                        IsUndo = false,
835
                        Event = Event_Type.Option,
836
                        EventTime = DateTime.Now,
837
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
838
                        Markup_List = new List<Multi_Undo_data>()
839
                    };
840
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
841

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

    
922
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
923
                                UndoData.Markup_List.Add(multi_Undo_Data);
924
                                multi_Undo_Data = new Multi_Undo_data();
925
                            }
926

    
927
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
928
                            {
929
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
930
                            });
931
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
932
                        }
933
                    }
934
                }
935
            }
936
        }
937

    
938
        //강인구 추가
939
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
940
        {
941
            //if (this.ParentOfType<MainWindow>() != null)
942
            //{
943
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
944
            //    {
945
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
946
            //        {
947
            //            if (item.GetType().Name == "AdornerFinal")
948
            //            {
949
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
950
            //                {
951
            //                    switch (InnerItem.DrawingData.GetType().Name)
952
            //                    {
953
            //                        case ("TextControl"):
954
            //                            {
955
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
956
            //                            }
957
            //                            break;
958
            //                        case ("ArrowTextControl"):
959
            //                            {
960
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
961
            //                            }
962
            //                            break;
963
            //                    }
964
            //                }
965
            //            }
966
            //        }
967
            //    }
968
            //}
969
        }
970

    
971
        //강인구 추가
972
        private void btnBold_Checked(object sender, RoutedEventArgs e)
973
        {
974
            if (this.ParentOfType<MainWindow>() != null)
975
            {
976
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
977
                {
978
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
979
                    {
980
                        if (item.GetType().Name == "AdornerFinal")
981
                        {
982
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
983
                            {
984
                                switch (InnerItem.DrawingData.GetType().Name)
985
                                {
986
                                    case ("TextControl"):
987
                                        {
988
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
989
                                            {
990
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
991
                                            }
992
                                            else
993
                                            {
994
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
995
                                            }
996

    
997
                                        }
998
                                        break;
999
                                    case ("ArrowTextControl"):
1000
                                        {
1001
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1002
                                            {
1003
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1004
                                            }
1005
                                            else
1006
                                            {
1007
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1008
                                            }
1009
                                        }
1010
                                        break;
1011
                                }
1012
                            }
1013
                        }
1014
                    }
1015
                }
1016
            }
1017
        }
1018

    
1019
        //강인구 추가
1020
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1021
        {
1022
            if (this.ParentOfType<MainWindow>() != null)
1023
            {
1024
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1025
                {
1026
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1027
                    {
1028
                        if (item.GetType().Name == "AdornerFinal")
1029
                        {
1030
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1031
                            {
1032
                                switch (InnerItem.DrawingData.GetType().Name)
1033
                                {
1034
                                    case ("TextControl"):
1035
                                        {
1036
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1037
                                            {
1038
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1039
                                            }
1040
                                            else
1041
                                            {
1042
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1043
                                            }
1044

    
1045
                                        }
1046
                                        break;
1047
                                    case ("ArrowTextControl"):
1048
                                        {
1049
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1050
                                            {
1051
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1052
                                            }
1053
                                            else
1054
                                            {
1055
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1056
                                            }
1057
                                        }
1058
                                        break;
1059
                                }
1060
                            }
1061
                        }
1062
                    }
1063
                }
1064
            }
1065
        }
1066

    
1067
        //강인구 추가
1068
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1069
        {
1070
            if (this.ParentOfType<MainWindow>() != null)
1071
            {
1072
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1073
                {
1074
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1075
                    {
1076
                        if (item.GetType().Name == "AdornerFinal")
1077
                        {
1078
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1079
                            {
1080
                                switch (InnerItem.DrawingData.GetType().Name)
1081
                                {
1082
                                    case ("TextControl"):
1083
                                        {
1084
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1085
                                            {
1086
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1087
                                            }
1088
                                            else
1089
                                            {
1090
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1091
                                            }
1092
                                        }
1093
                                        break;
1094
                                    case ("ArrowTextControl"):
1095
                                        {
1096
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1097
                                            {
1098
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1099
                                            }
1100
                                            else
1101
                                            {
1102
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1103
                                            }
1104
                                        }
1105
                                        break;
1106
                                }
1107
                            }
1108
                        }
1109
                    }
1110
                }
1111
            }
1112
        }
1113

    
1114
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1115
        {
1116
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1117
        }
1118

    
1119
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1120
        {
1121
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1122
            {
1123
                comboFontSize.Value = comboFontSize.Minimum;
1124
            }
1125
            if (this.ParentOfType<MainWindow>() != null)
1126
            {
1127
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1128
                {
1129
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1130
                    {
1131
                        if (item.GetType().Name == "AdornerFinal")
1132
                        {
1133
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1134
                            {
1135
                                switch (InnerItem.DrawingData.GetType().Name)
1136
                                {
1137
                                    case ("TextControl"):
1138
                                        {
1139
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1140
                                        }
1141
                                        break;
1142
                                    case ("ArrowTextControl"):
1143
                                        {
1144
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1145
                                        }
1146
                                        break;
1147
                                }
1148
                            }
1149
                        }
1150
                    }
1151
                }
1152
            }
1153
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1154
            Properties.Settings.Default.Save();
1155
        }
1156

    
1157
        //강인구 추가
1158
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1159
        {
1160
            if (this.ParentOfType<MainWindow>() != null)
1161
            {
1162
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1163
                {
1164
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1165
                    {
1166
                        if (item.GetType().Name == "AdornerFinal")
1167
                        {
1168
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1169
                            {
1170
                                switch (InnerItem.DrawingData.GetType().Name)
1171
                                {
1172
                                    case ("TextControl"):
1173
                                        {
1174
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1175
                                            //{
1176
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily = new FontFamily(comboFontFamily.Text);
1177
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1178
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1179
                                            //}
1180
                                            //else
1181
                                            //{
1182
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1183
                                            //}
1184
                                        }
1185
                                        break;
1186
                                    case ("ArrowTextControl"):
1187
                                        {
1188
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1189
                                            //{
1190
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1191
                                            //}
1192
                                            //else
1193
                                            //{
1194
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1195
                                            //}
1196
                                        }
1197
                                        break;
1198
                                }
1199
                            }
1200
                        }
1201
                    }
1202
                }
1203
            }
1204
        }
1205

    
1206
        /// <summary>
1207
        /// 텍스트 컨트롤 하일라이트 처리
1208
        /// </summary>
1209
        /// <param name="sender"></param>
1210
        /// <param name="e"></param>
1211
        private void HighlightEvent(object sender, RoutedEventArgs e)
1212
        {
1213

    
1214
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1215
            SetHighlightEvent();
1216
            //if ((sender as CheckBox).IsChecked.Value)
1217
            //{
1218
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1219
            //}
1220
            //else
1221
            //{
1222
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1223
            //}
1224
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1225
            //{
1226
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1227
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1228
            //    instance.SetText();
1229
            //}
1230
        }
1231

    
1232
        //추가페이지 이동 엔터
1233
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1234
        {
1235
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1236
            if (e.Key == Key.Enter)
1237
            {
1238
                try
1239
                {
1240
                    var instanceMain = this.ParentOfType<MainWindow>();
1241
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1242
                }
1243
                catch (Exception)
1244
                {
1245
                    RadWindow.Alert(new DialogParameters
1246
                    {
1247
                        Owner = Application.Current.MainWindow,
1248
                        Theme = new VisualStudio2013Theme(),
1249
                        Header = "안내",
1250
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1251
                    });
1252
                }
1253
                
1254
            }
1255
        }
1256

    
1257
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1258
        {
1259
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1260
            if (e.Key == Key.Enter)
1261
            {
1262
                try
1263
                {
1264
                    var instanceMain = this.ParentOfType<MainWindow>();
1265
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1266
                }
1267
                catch (Exception)
1268
                {
1269
                    RadWindow.Alert(new DialogParameters
1270
                    {
1271
                        Owner = Application.Current.MainWindow,
1272
                        Theme = new VisualStudio2013Theme(),
1273
                        Header = "안내",
1274
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1275
                    });
1276
                }
1277

    
1278
            }
1279
        }
1280
        
1281

    
1282
        //public event EventHandler<WindowClosedEventArgs> Closed;
1283

    
1284
        //private void CheckEvent(object sender, RoutedEventArgs e)
1285
        //{
1286
        //    RadWindow CheckPop = new RadWindow();
1287
        //    test check = new test();
1288

    
1289
        //    CheckPop = new RadWindow
1290
        //    {
1291
        //        Width = 1700,
1292
        //        Height = 510,
1293
        //        Header = "My Check List",
1294
        //        Content = check,
1295
        //        Owner = this,
1296
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1297
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1298
        //    };
1299
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1300

    
1301
        //    CheckPop.Closed += CheckPop_Closed;
1302
        //    CheckPop.ShowDialog();
1303
        //}
1304

    
1305
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1306
        {
1307
            PanoramaShow();
1308
        }
1309

    
1310
        public void PanoramaShow()
1311
        {
1312
            Panorama check = new Panorama();
1313
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1314
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1315
            //double windowWidth = this.Width;
1316
            //double windowHeight = this.Height;
1317

    
1318
            var PanoramaPop = new RadWindow
1319
            {
1320
                //MinWidth = 600,
1321
                //MinHeight = 400,
1322
                //Header = "My Check List",
1323
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1324
                Content = check,
1325
                Owner = this,
1326
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1327
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1328
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1329
                IsTopmost = false,
1330
                //Left = (screenWidth / 2) - (windowWidth / 2),
1331
                //Top = (screenHeight / 2) - (windowHeight / 2),
1332
                //Left = (screenWidth / 2),
1333
                //Top = (screenHeight / 2),
1334
                Width = screenWidth * 0.4,
1335
                Height = screenHeight * 0.4,
1336
            };
1337
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1338
            //CheckPop.ShowDialog();
1339
            PanoramaPop.Owner = Application.Current.MainWindow;
1340
            PanoramaPop.Show();
1341
        }
1342

    
1343
        private void CheckEvent(object sender, RoutedEventArgs e)
1344
        {
1345
            //창이 떠있을 경우 재 실행 방지
1346
            if (isClosed)
1347
            {
1348
                //토글 및 마우스 상태 초기화
1349
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1350
                foreach(var togle in toggleList)
1351
                {
1352
                    togle.IsChecked = false;
1353
                }
1354
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1355

    
1356
                isClosed = false;
1357

    
1358
                
1359
                CheckList check = new CheckList();
1360

    
1361
                CheckPop = new RadWindow
1362
                {
1363
                    MinWidth = 1200,
1364
                    MinHeight = 500,
1365
                    //Header = "My Check List",
1366
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1367
                    Content = check,
1368
                    //Owner = this,
1369
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1370
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1371
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1372
                    IsTopmost = true,
1373
                };
1374
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1375
                CheckPop.Closed += CheckPop_Closed;
1376
                
1377
                //CheckPop.ShowDialog();
1378
                CheckPop.Show();
1379
            }
1380
        }
1381

    
1382
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1383
        {
1384
            isClosed = true;
1385
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1386
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1387
            ViewerDataModel.Instance.Capture_Opacity = 0;
1388
        }
1389

    
1390
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1391
        {
1392
            isClosed = true;
1393
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1394
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1395
            ViewerDataModel.Instance.Capture_Opacity = 0;
1396
        }
1397

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

    
1437
        private void viewEvent(object sender, RoutedEventArgs e)
1438
        {
1439
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1440
            var instanceMain = this.ParentOfType<MainWindow>();
1441

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

    
1444
            //if ((sender as RadRibbonToggleButton) != null)
1445
            //{
1446
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1447
            //    instanceToggle = (sender as RadRibbonToggleButton);
1448
            //}
1449

    
1450
            //instanceToggle.IsChecked = false;
1451

    
1452
            switch (viewButton.CommandParameter.ToString())
1453
            {
1454
                case "zoomout":
1455
                    {
1456
                        //장원
1457
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1458
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1459
                        viewButton.IsChecked = false;
1460
                        //Common.ViewerDataModel.Instance.zom
1461
                    }
1462
                    break;
1463
                case "zoomin":
1464
                    {
1465
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1466
                        viewButton.IsChecked = false;
1467
                    }
1468
                    break;
1469
                case "fullscreen":
1470
                    {
1471
                        instanceMain.WindowState = WindowState.Maximized;
1472
                        //Sizemode 대기(강인구)
1473
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1474
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1475
                        viewButton.IsChecked = false;
1476
                    }
1477
                    break;
1478
                case "fitWidth":
1479
                    {
1480
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1481
                        viewButton.IsChecked = false;
1482
                    }
1483
                    break;
1484
                case "fitHeight":
1485
                    {
1486
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1487
                        viewButton.IsChecked = false;
1488
                    }
1489
                    break;
1490
                case "boundzoom":
1491
                    {
1492

    
1493
                    }
1494
                    break;
1495
                case "Rotate_M":
1496
                    {
1497
                        drawingPannelRotate(false);
1498
                        viewButton.IsChecked = false;
1499
                    }
1500
                    break;
1501
                case "Rotate_P":
1502
                    {
1503
                        drawingPannelRotate(true);
1504
                        viewButton.IsChecked = false;
1505
                    }
1506
                    break;
1507
                case "Rotate_half":
1508
                    {
1509
                        drawingPannelRotate(true);
1510
                        drawingPannelRotate(true);
1511
                        viewButton.IsChecked = false;
1512
                    }
1513
                    break;
1514
            }
1515
        }
1516

    
1517
        private void Control_Event(object sender, RoutedEventArgs e)
1518
        {
1519

    
1520
        }
1521

    
1522
        #region 대기
1523

    
1524
        public void drawingPannelRotate(bool Flag)
1525
        {
1526
            var instanceMain = this.ParentOfType<MainWindow>();
1527

    
1528
            //if (rotateOffSet > 3)
1529
            //    rotateOffSet = 0;
1530

    
1531
            //if (rotateOffSet < 0)
1532
            //    rotateOffSet = 3;
1533

    
1534
            if(Flag)
1535
            {
1536
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1537
                {
1538
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1539
                }
1540
                else
1541
                {
1542
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1543
                }
1544
            }
1545
            else
1546
            {
1547
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1548
                {
1549
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1550
                }
1551
                else
1552
                {
1553
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1554
                }
1555
            }
1556
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1557
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1558
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1559

    
1560
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1561
            {
1562
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1563
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1564
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1565
            }
1566
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1567
            {
1568
                instanceMain.dzMainMenu.translate.X = 0;
1569
                instanceMain.dzMainMenu.translate.Y = 0;
1570
            }
1571
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1572
            {
1573
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1574
                instanceMain.dzMainMenu.translate.Y = 0;
1575
            }
1576
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1577
            {
1578
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1579
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1580
            }
1581
            else
1582
            {
1583
                instanceMain.dzMainMenu.translate.X = 0;
1584
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1585
            }
1586

    
1587
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1588
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1589
            //대기(강인구)
1590
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1591

    
1592

    
1593
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1594
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1595
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1596

    
1597

    
1598
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1599
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1600
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1601
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1602
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1603
            //ViewerDataModel.Instance.Document_Info.Clear();
1604
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1605
            //{
1606
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1607
            //});
1608

    
1609

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

    
1615
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1616
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1617
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1618

    
1619
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1620

    
1621
                //rotation page add or update
1622
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1623
                if (rotationdoc != null)
1624
                {
1625
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1626
                }
1627
                else
1628
                {
1629
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1630
                }
1631
            });
1632
        }
1633
        #endregion
1634

    
1635
        private void ImageConverter(RadToggleButton instanceToggle)
1636
        {
1637
            try
1638
            {           
1639
                var instanceMain = this.ParentOfType<MainWindow>();
1640
                //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1641

    
1642
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1643
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1644
                Nullable<bool> result = dlg.ShowDialog();
1645
                if (result == true)
1646
                {
1647
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1648
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1649

    
1650
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1651
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1652
                    long numByte = fileInfo.Length;
1653
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1654
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1655

    
1656
                    if (dLen < 4)
1657
                    {
1658
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1659
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1660
                        byte[] data = br.ReadBytes((int)numByte);
1661
                        br.Close();
1662

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

    
1665
                        Check_Uri.UriCheck(filepath);
1666

    
1667
                        instanceMain.dzMainMenu.filename = filepath;
1668

    
1669
                        fStream.Close();
1670
                        fStream.Dispose();
1671
                    }
1672
                    else
1673
                    {
1674
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1675
                    }
1676
                }
1677
            }
1678
            catch(Exception ex)
1679
            {
1680
                instanceToggle.IsChecked = false;
1681
                Common.ViewerDataModel.Instance.SelectedControl = "";
1682
                Common.ViewerDataModel.Instance.ControlTag = null;
1683
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1684
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1685
                this.ParentOfType<MainWindow>().DialogMessage_Alert(""+ ex , "Alert");
1686
            }
1687
        }
1688

    
1689
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1690
        {
1691

    
1692
        }
1693

    
1694
        private void ControlEvent(object sender, RoutedEventArgs e)
1695
        {
1696
            RadToggleButton instanceToggle = sender as RadToggleButton;
1697
            var instanceMain = this.ParentOfType<MainWindow>();
1698

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

    
1719
            //if (!instanceMain.IsFreeSelectionMode)
1720
            //{
1721
            //    instanceMain.IsSwingMode = true;
1722
            //}
1723

    
1724
            #region 다른 컨트롤 버튼 선택 해제
1725
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1726
            {
1727
                if (ControlState == null)
1728
                {
1729
                    instanceToggle.IsChecked = false;
1730
                    HiddenControlHide();
1731
                }
1732
            });
1733
            #endregion
1734

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

    
1737
            if (instanceToggle != null)
1738
            {
1739
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1740
            }
1741
            else if ((sender as RadRibbonToggleButton) != null)
1742
            {
1743
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1744
                instanceToggle = (sender as RadRibbonToggleButton);
1745
            }
1746
            else if ((sender as RadRibbonButton) != null)
1747
            {
1748
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1749
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1750
            }
1751
            else
1752
            {
1753
                RadButton instanceButton = sender as RadButton;
1754
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1755
            }
1756

    
1757

    
1758

    
1759
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1760
            {
1761
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1762
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1763
                {
1764
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1765
                });
1766
            });
1767
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1768

    
1769
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1770

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

    
1996
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1997

    
1998
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
1999
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2000
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2001
                        break;
2002
                    #endregion
2003
                    #region Select
2004
                    case "Select":
2005
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2006
                        {
2007
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2008
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2009
                        }
2010
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2011
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2012
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2013
                        break;
2014
                    #endregion
2015
                    #region Image
2016
                    case "Image":
2017
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2018
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2019
                        ImageConverter(instanceToggle);
2020
                        break;
2021
                    #endregion
2022
                    #region Sign
2023
                    case "Sign":
2024
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2025
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2026
                        //강인구 추가
2027
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2028
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2029
                        //{
2030
                        //    if (ea.Result == null)
2031
                        //    {
2032

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

    
2103
                        instanceToggle.IsChecked = false;
2104
                        ViewerDataModel.Instance.SelectedControl = "";
2105
                        ViewerDataModel.Instance.ControlTag = null;
2106
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2107
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2108
                        break;
2109
                    #endregion
2110
                    #region Undo
2111
                    case "Undo":
2112
                        this.ParentOfType<MainWindow>().dzMainMenu.Undo();
2113
                        instanceToggle.IsChecked = false;
2114
                        ViewerDataModel.Instance.SelectedControl = "";
2115
                        ViewerDataModel.Instance.ControlTag = null;
2116
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2117
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2118
                        break;
2119
                    #endregion
2120
                    #region Redo
2121
                    case "Redo":
2122
                        this.ParentOfType<MainWindow>().dzMainMenu.Redo();
2123
                        instanceToggle.IsChecked = false;
2124
                        ViewerDataModel.Instance.SelectedControl = "";
2125
                        ViewerDataModel.Instance.ControlTag = null;
2126
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2127
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2128
                        break;
2129
                    #endregion
2130
                    #region DragZoom
2131
                    case "DragZoom":
2132
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2133
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2134
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2135
                        break;
2136
                    #endregion
2137
                    #region Grouping
2138
                    case "Group":
2139
                        var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2140
                        foreach (var togle in GrouptoggleList)
2141
                        {
2142
                            togle.IsChecked = false;
2143
                        }
2144

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

    
2205
                        if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2206
                        {
2207
                            this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2208
                        }
2209
                        else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2210
                        {
2211
                            // string MarkupData = "";
2212
                            foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2213
                            {
2214
                                if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2215
                                {
2216
                                    //MARKUP_DATA UPDATE
2217
                                    foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2218
                                    {
2219
                                        if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2220
                                        {
2221
                                            long group_id = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2222
                                            //MARKUP_DATA UPDATE
2223
                                            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2224
                                            //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2225
                                            ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2226
                                            ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2227

    
2228

    
2229
                                            //MARKUP_DATA_GROUP UPDATE
2230
                                            bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2231
                                            Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2232
                                        }
2233
                                    }
2234
                                }
2235
                            }
2236
                        }
2237
                        break;
2238
                    #endregion
2239
                    #region Capture
2240
                    case "Capture":
2241
                        SyncInit();
2242
                        //   instanceToggle.IsChecked = false;
2243
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2244
                        foreach (var togle in CaptureList)
2245
                        {
2246
                            togle.IsChecked = false;
2247
                        }
2248

    
2249
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2250
                        {
2251
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2252
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2253
                        }
2254

    
2255
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2256
                   //     ViewerDataModel.Instance.ControlTag = null;
2257
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2258

    
2259
                        /*
2260
                        //캡쳐 하기 전에 코멘트 저장
2261
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2262
                        {
2263
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2264
                            menu.ReleaseAdorner();
2265
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2266
                            {
2267
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2268
                            }
2269
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2270
                            {
2271

    
2272
                            }
2273
                            else
2274
                            {
2275
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2276
                            }
2277
                        }*/
2278

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

    
2317
                            isClosed = false;
2318
                            //Control 파일 먼저 생성
2319
                            CollapsedButton_Click();
2320
                            CadViewer check = new CadViewer();
2321
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2322
                            check.Title = "Export Viewer";
2323
                            //check.Topmost = true;
2324
                            check.Show();
2325
                            check.Closed += Check_Closed;
2326
                            instanceToggle.IsChecked = false;
2327
                        }
2328
                        break;
2329
                    case "CadViewer":
2330
                        if (isClosed)
2331
                        {
2332
                            //토글 및 마우스 상태 초기화
2333
                            var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2334
                            foreach (var togle in toggleList)
2335
                            {
2336
                                togle.IsChecked = false;
2337
                            }
2338
                            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2339

    
2340
                            isClosed = false;
2341
                            CadResultViewer check = new CadResultViewer();
2342
                            check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2343
                            check.Title = "Viewer";
2344
                            check.Show();
2345

    
2346
                            check.Closed += Check_Closed;
2347

    
2348
                        }
2349
                        break;
2350
                    #endregion
2351
                    default:
2352
                        break;
2353
                }
2354
                #endregion
2355
            }
2356
            else
2357
            {
2358

    
2359
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2360
                {
2361
                    instanceMain.dzMainMenu.IsSwingMode = false;
2362
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2363
                    Common.ViewerDataModel.Instance.ControlTag = null;
2364
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2365
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2366
                }
2367
            }
2368
        }
2369

    
2370
        private void SyncInit()
2371
        {
2372
            try
2373
            {
2374
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2375
                {
2376
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2377
                    ViewerDataModel.Instance.PageBalanceMode = false;
2378
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2379
                    ViewerDataModel.Instance.PageNumber = 0;
2380
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2381
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2382
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2383
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2384
                }
2385
            }
2386
            catch (Exception ex)
2387
            {
2388
                Logger.sendResLog("SyncInit", ex.Message, 0);
2389
            }
2390

    
2391
        }
2392

    
2393
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2394
        CommentUserInfo currentControl { get; set; }
2395
        private Point GetSquareEndPoint(Point StartP, Point EndP)
2396
        {
2397
            Point Return_Point = new Point();
2398
            double dx = EndP.X - StartP.X;
2399
            double dy = EndP.Y - StartP.Y;
2400
            double length;
2401
            length = Math.Max(Math.Abs(dx), Math.Abs(dy));
2402
            Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length;
2403
            Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length;
2404
            return Return_Point;
2405
        }
2406
        private void Check_Closed(object sender, EventArgs e)
2407
        {
2408
            isClosed = true;
2409
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2410
            //토글 및 마우스 상태 초기화
2411
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2412
            foreach (var togle in toggleList)
2413
            {
2414
                togle.IsChecked = false;
2415
            }
2416
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2417
            ViewerDataModel.Instance.Capture_Opacity = 0;
2418

    
2419
        }
2420

    
2421
        /* public class test 
2422
         {
2423
             public double width { get; set; }
2424
             public double height { get; set; }
2425
         }
2426
         */
2427
        private void CollapsedButton_Click()
2428
        {
2429
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2430

    
2431
            string[] data = new string[0];
2432

    
2433
            int cnt = 0;
2434
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2435

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

    
2438
            foreach (var item in gridSelectionItem)
2439
            {
2440
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2441
                {
2442
                    var instance = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2443
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2444
                    data = new string[instance.Count];
2445
                    foreach (var markup in instance)
2446
                    {
2447
                        data[cnt++] = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(markup.Data);
2448
                    }
2449
                }
2450
            }
2451

    
2452
            if (data != null)
2453
            {
2454
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2455
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2456
                if (!File.Exists(FilePath))
2457
                {
2458
                    Directory.CreateDirectory(FilePath);
2459
                }
2460

    
2461
                if (!string.IsNullOrEmpty(FileName))
2462
                {
2463
                    //  File.WriteAllText(SaveDig.FileName, data);
2464
                    File.WriteAllLines(FileName, data);
2465
                }
2466
            }
2467
        }
2468

    
2469
        private double minHeight;
2470
        private double minWidth;
2471

    
2472
        private double maxHeight;
2473
        private double maxWidth;
2474

    
2475
        public bool CanVResize { get; private set; }
2476
        public bool CanHResize { get; private set; }
2477

    
2478
        public void DesignerComponent(FrameworkElement content)
2479
        {
2480
            this.InitializeComponent();
2481

    
2482
            if (!double.IsNaN(content.Width))
2483
            {
2484
                CanHResize = false;
2485
                this.Width = content.Width;
2486
            }
2487
            else
2488
            {
2489
                CanHResize = true;
2490
                this.Width = 23.0;
2491
            }
2492
            if (!double.IsNaN(content.Height))
2493
            {
2494
                CanVResize = false;
2495
                this.Height = content.Height; ;
2496
            }
2497
            else
2498
            {
2499
                CanVResize = true;
2500
                this.Height = 23.0;
2501
            }
2502

    
2503
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2504
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2505
            maxWidth = content.MaxWidth;
2506
            maxHeight = content.MaxHeight;
2507

    
2508
            double top = (double)content.GetValue(Canvas.TopProperty);
2509
            if (double.IsNaN(top))
2510
                top = 0.0;
2511
            double left = (double)content.GetValue(Canvas.LeftProperty);
2512
            if (double.IsNaN(left))
2513
                left = 0.0;
2514
            SetValue(Canvas.TopProperty, top);
2515
            SetValue(Canvas.LeftProperty, left);
2516

    
2517
            //Set the actual content. Note that "Content" property is a new property. See below
2518
            this.Content = content;
2519
        }
2520
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2521
        {
2522
            string name = ((Thumb)sender).Name;
2523
            if (name.Contains("Top"))
2524
            {
2525
                double newHeight = this.Height - e.VerticalChange;
2526
                if (newHeight >= minHeight && newHeight <= maxHeight)
2527
                {
2528
                    this.Height = newHeight;
2529
                    SetValue(Canvas.TopProperty,
2530
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2531
                }
2532
            }
2533
            if (name.Contains("Right"))
2534
            {
2535
                double newWidth = this.Width + e.HorizontalChange;
2536
                if (newWidth >= minWidth && newWidth <= maxWidth)
2537
                    this.Width = newWidth;
2538
            }
2539
            if (name.Contains("Bottom"))
2540
            {
2541
                double newHeight = this.Height + e.VerticalChange;
2542
                if (newHeight >= minHeight && newHeight <= maxHeight)
2543
                    this.Height = newHeight;
2544
            }
2545
            if (name.Contains("Left"))
2546
            {
2547
                double newWidth = this.Width - e.HorizontalChange;
2548
                if (newWidth >= minWidth && newWidth <= maxWidth)
2549
                {
2550
                    this.Width = newWidth;
2551
                    SetValue(Canvas.LeftProperty,
2552
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2553
                }
2554
            }
2555
        }
2556

    
2557
        private void drawControlBorder(object sender)
2558
        {
2559
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2560
        }
2561

    
2562
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2563
        {
2564
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2565
            if (designerItem != null)
2566
            {
2567
                double deltaVertical, deltaHorizontal;
2568

    
2569
                switch (VerticalAlignment)
2570
                {
2571
                    case VerticalAlignment.Bottom:
2572
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2573
                        designerItem.Height -= deltaVertical;
2574
                        break;
2575
                    case VerticalAlignment.Top:
2576
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2577
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2578
                        designerItem.Height -= deltaVertical;
2579
                        break;
2580
                    default:
2581
                        break;
2582
                }
2583

    
2584
                switch (HorizontalAlignment)
2585
                {
2586
                    case HorizontalAlignment.Left:
2587
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2588
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2589
                        designerItem.Width -= deltaHorizontal;
2590
                        break;
2591
                    case HorizontalAlignment.Right:
2592
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2593
                        designerItem.Width -= deltaHorizontal;
2594
                        break;
2595
                    default:
2596
                        break;
2597
                }
2598
            }
2599
            e.Handled = true;
2600
        }
2601

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

    
2604
        void ExportMethod()
2605
        {
2606
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2607
            SaveDig.Filter = "PDF file format|*.pdf";
2608
            SaveDig.Title = "Save an DWG File";
2609
            SaveDig.ShowDialog();
2610
        }
2611

    
2612
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2613
        {            
2614
            if (cbAutoSave.IsChecked == true)
2615
            {
2616
                SaveTime(true, (int)cbSaveInterval.Value);
2617
            }
2618
            else
2619
            {
2620
                SaveTime(false, (int)cbSaveInterval.Value);
2621
            }
2622
        }
2623
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2624
        {
2625
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2626
            {
2627
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2628
            }
2629
            if (cbAutoSave.IsChecked == true)
2630
            {
2631
                SaveTime(true, (int)cbSaveInterval.Value);
2632
            }
2633

    
2634
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2635
            Properties.Settings.Default.Save();
2636
        }
2637
        //강인구 자동 저장 추가
2638
        private void AutoSave(object sender, RoutedEventArgs e)
2639
        {
2640
            RadToggleButton instanceToggle = sender as RadToggleButton;
2641

    
2642
            if(instanceToggle.IsChecked == true)
2643
            {
2644
                SaveTime(true);
2645
            }
2646
            else
2647
            {
2648
                SaveTime(false);
2649
            }
2650
        }
2651

    
2652
        public void Copy_Start()
2653
        {
2654
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2655
            {
2656
                string MarkupData = "";
2657

    
2658
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2659
                {
2660
                    if (item.GetType().Name == "AdornerFinal")
2661
                    {
2662
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2663

    
2664
                        {
2665
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2666
                            {
2667
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2668
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2669
                            }
2670
                        }
2671
                        Clipboard.SetText(MarkupData);
2672
                    }
2673
                }
2674
            }
2675
        }
2676

    
2677
        public void Cut_Start()
2678
        {
2679
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2680
            {
2681
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2682
                {
2683
                    string MarkupData = "";
2684

    
2685
                    if (item.GetType().Name == "AdornerFinal")
2686
                    {
2687
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2688
                        {
2689
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2690
                            {
2691
                                markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2692
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2693
                            }
2694
                        }
2695
                        //클립보드에 넣음
2696
                        Clipboard.SetText(MarkupData);
2697
                    }
2698
                }
2699
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2700
            }
2701
        }
2702

    
2703
        public void Paste_Start()
2704
        {
2705
            //마크업 붙여넣기
2706
            //if (Clipboard.GetText().Contains("|DZ|"))
2707
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2708
            {
2709
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2710

    
2711
                string[] delimiterChars = { "|OR|" };
2712
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2713

    
2714
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2715

    
2716
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2717

    
2718
                //강인구 Undo/Redo 보류
2719
                UndoData = new Undo_data()
2720
                {
2721
                    IsUndo = false,
2722
                    Event = Event_Type.Create,
2723
                    EventTime = DateTime.Now,
2724
                    Markup_List = new List<Multi_Undo_data>()
2725
                };
2726

    
2727
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2728
                {
2729
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2730
                });
2731

    
2732
                foreach (string parse in data)
2733
                {
2734
                    if (parse != "")
2735
                    {
2736
                        System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2737
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2738

    
2739
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2740
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2741

    
2742
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2743

    
2744
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2745
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2746

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

    
2749
                        UndoData.Markup_List.Add(multi_Undo_Data);
2750
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2751
                    }
2752
                }
2753
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2754

    
2755
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2756
                {
2757
                    Canvas.SetLeft(final, 0);
2758
                    Canvas.SetTop(final, 0);
2759
                }
2760
                else
2761
                {
2762
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2763
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2764
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2765

    
2766
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2767
                    {
2768
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2769
                    }
2770

    
2771
                }
2772
                
2773

    
2774
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2775

    
2776
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2777
                //Canvas.SetLeft(final, 50);
2778
                //Canvas.SetTop(final, 50);
2779
            }
2780
            //외부 이미지 붙여넣기
2781
            else if (Clipboard.GetImage() != null)
2782
            {
2783
                try
2784
                {
2785
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2786

    
2787
                    //강인구 Undo/Redo 보류
2788
                    UndoData = new Undo_data()
2789
                    {
2790
                        IsUndo = false,
2791
                        Event = Event_Type.Create,
2792
                        EventTime = DateTime.Now,
2793
                        Markup_List = new List<Multi_Undo_data>()
2794
                    };
2795

    
2796

    
2797
                    string temppath = System.IO.Path.GetTempPath();
2798
                    //string filename = KCOM.Events.Save.shortCommentKey();
2799
                    string filename = Commons.shortFileKey();
2800

    
2801
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2802
                    clipboardImage.Save(temppath + "\\" + filename);
2803

    
2804
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2805
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2806
                    long numByte = fileInfo.Length;
2807
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2808
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2809

    
2810
                    if (dLen < 4)
2811
                    {
2812
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2813
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2814
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2815
                        byte[] data = br.ReadBytes((int)numByte);
2816

    
2817
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2818
                        Check_Uri.UriCheck(filename);
2819
                        br.Close();
2820
                        fStream.Close();
2821
                        fStream.Dispose();
2822
                    }
2823
                    else
2824
                    {
2825
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2826
                        return;
2827
                    }
2828

    
2829
                    fileInfo.Delete();
2830

    
2831
                    //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2832
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2833
                    IntPtr hBitmap = bmp.GetHbitmap();
2834
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2835
                    Image img = new Image();
2836
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2837
                    if (filename.Contains(".svg"))
2838
                    {
2839
                        byte[] imageData = null;
2840
                        DrawingImage image = null;
2841
                        using (System.Net.WebClient web = new System.Net.WebClient())
2842
                        {
2843
                            imageData = web.DownloadData(new Uri(filename));
2844
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2845
                            image = SvgReader.Load(stream);
2846
                        }
2847
                        img.Source = image;
2848
                    }
2849
                    else
2850
                    {
2851
                        img.Source = new BitmapImage(new Uri(filename));
2852
                    }
2853

    
2854
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2855
                    {
2856
                        PointSet = new List<Point>(),
2857
                        //FilePath = img.Source.ToString(),
2858
                        FilePath = filename,
2859
                        ImageData = img.Source,
2860
                        StartPoint = new Point(100, 100),
2861
                        EndPoint = new Point(200, 200),
2862
                        TopRightPoint = new Point(100, 200),
2863
                        LeftBottomPoint = new Point(200, 100)
2864
                    };
2865

    
2866
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2867
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2868
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2869

    
2870
                    currentControl.PointSet = new List<Point>
2871
                                        {
2872
                                            currentControl.StartPoint,
2873
                                            currentControl.LeftBottomPoint,
2874
                                            currentControl.EndPoint,
2875
                                            currentControl.TopRightPoint,
2876
                                        };
2877

    
2878
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2879
                    UndoData.Markup_List.Add(multi_Undo_Data);
2880
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2881

    
2882
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2883
                    currentControl.CommentID = Commons.shortGuid();
2884

    
2885
                    currentControl.ApplyTemplate();
2886
                    currentControl.SetImage();
2887

    
2888
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2889
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2890
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2891

    
2892
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2893
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2894
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2895
                }
2896
                catch(Exception ex)
2897
                {
2898
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2899
                }
2900
            }
2901
        }
2902
    }
2903
}
클립보드 이미지 추가 (최대 크기: 500 MB)