프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 664ea2e1

이력 | 보기 | 이력해설 | 다운로드 (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
using System.Web;
27
using Markus.Fonts;
28

    
29
namespace KCOM.Views
30
{
31
    public partial class TopMenu : UserControl
32
    {
33
        public int rotateOffSet = 0;
34
        private double[] rotateValue = { 0, 90, 180, 270 };
35
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
36
        public bool isClosed = true;
37
        public RadWindow CheckPop;
38
        public RadWindow OptionPop;
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
            /*
48
            if (taskBar != null)
49
            {
50
                string color = "";
51
                taskBar.Content = message;
52
                DicTaskMessage.TryGetValue(type, out color);
53
                taskBar.Foreground = new SolidColorBrush(StringToColorConverter.Parse(color));
54
            }
55
            */
56
        }
57

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

    
68
        private void CheckShapeState()
69
        {
70

    
71

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

    
88
        /// <summary>
89
        ///  comment의 속성 변경시 저장여부 확인 하도록 undocommand에 추가
90
        /// </summary>
91
        /// <param name="adnoerFinal"></param>
92
        public void ChangeComment(Controls.AdornerFinal adnoerFinal)
93
        {
94
            var adornerMembers = adnoerFinal.Members.Cast<Controls.AdornerMember>();
95

    
96
            if (adornerMembers.Count() > 0)
97
            {
98
                UndoCommand.Instance.Push(adornerMembers.Select(x => x.DrawingData).Cast<CommentUserInfo>().ToList(), adnoerFinal.AngleValue);
99
            }
100
        }
101

    
102
        //강인구 추가(Undo End)
103
        private void SetPaintEvent()
104
        {
105
            List<AdornerMember> AdonerList = GetAdornerItem();
106

    
107
            if (AdonerList.Count > 0)
108
            {
109
                Undo_data UndoData = new Undo_data()
110
                {
111
                    IsUndo = false,
112
                    Event = Event_Type.Option,
113
                    EventTime = DateTime.Now,
114
                    paint = ViewerDataModel.Instance.paintSet,
115
                    Markup_List = new List<Multi_Undo_data>()
116
                };
117
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
118

    
119
                foreach (AdornerMember InnerItem in AdonerList)
120
                {
121
                    multi_Undo_Data.PointSet = new List<Point>();
122

    
123
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
124
                    {
125
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
126
                    }
127

    
128
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
129
                    UndoData.Markup_List.Add(multi_Undo_Data);
130
                    multi_Undo_Data = new Multi_Undo_data();
131
                }
132

    
133
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
134
                {
135
                    ViewerDataModel.Instance.UndoDataList.Remove(i);                    
136
                });
137
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
138
            }
139
        }
140

    
141
        private void SetHighlightEvent()
142
        {
143
            List<AdornerMember> AdonerList = GetAdornerItem();
144

    
145
            if (AdonerList.Count > 0)
146
            {
147
                foreach (AdornerMember InnerItem in AdonerList)
148
                {
149
                    switch (InnerItem.DrawingData.GetType().Name)
150
                    {
151
                        case ("TextControl"):
152
                            {
153
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
154
                            }
155
                            break;
156
                        case ("ArrowTextControl"):
157
                            {
158
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
159
                            }
160
                            break;
161
                    }
162
                }
163
            }
164

    
165
        }
166

    
167
        private void FillShapeEvent(object sender, RoutedEventArgs e)
168
        {
169
            #region 주석
170
            //if ((sender as CheckBox).IsChecked.Value)
171
            //{
172
            //    cbHatchShape.IsChecked = false;
173
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Fill.png", UriKind.Relative));
174
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Fill.png", UriKind.Relative));
175
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle_Fill.png", UriKind.Relative));
176
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon.png", UriKind.Relative));
177
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon.png", UriKind.Relative));
178
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_Fill.png", UriKind.Relative));
179
            //    TaskMessage("채우기 옵션이 적용되었습니다", TaskMessageType.Normal);
180
            //}
181
            //else
182
            //{
183

    
184
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
185
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
186
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
187
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
188
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
189
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
190
            //    TaskMessage("채우기 옵션이 해제되었습니다", TaskMessageType.Caption);
191
            //}
192
            #endregion
193
            ViewerDataModel.Instance.checkFillShape = (sender as CheckBox).IsChecked.Value;
194

    
195
            if (ViewerDataModel.Instance.checkFillShape)
196
            {
197
                cbHatchShape.IsChecked = false;
198
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
199
            }
200
            else
201
            {
202
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
203
            }
204
            SetPaintEvent();
205
        }
206

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

    
238
            //강인구 추가
239
            ViewerDataModel.Instance.checkHatchShape = (sender as CheckBox).IsChecked.Value;
240
            if (ViewerDataModel.Instance.checkHatchShape)
241
            {
242
                cbFillShape.IsChecked = false;
243
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
244
            }
245
            else
246
            {
247
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;  
248
            }
249
            SetPaintEvent();
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
                SaveEventCallback(null, null);
258
            }
259
        }
260

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

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

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

    
311
            if (mianMenu.busyIndicator.IsBusy == true)
312
            {
313
                return;
314
            }
315

    
316
            var result = await Dispatcher.InvokeAsync<bool>(()=>
317
            {
318
                this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
319

    
320
                _SaveEvent(sender, e);
321

    
322
                mianMenu.busyIndicator.IsBusy = false;
323
                return true;
324
            });
325

    
326
            //System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
327
            //{
328
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
329
            //}).ContinueWith(task =>
330
            //{
331
            //    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
332
            //});
333
        }
334

    
335
        /// <summary>
336
        /// save markup
337
        ///  - convert ink control to polygon control if ink control exists
338
        ///  - unselect and update my markup list
339
        /// <param name="sender"></param>
340
        /// <param name="e"></param>
341
        public void _SaveEvent(object sender, RoutedEventArgs e)
342
        {
343
            var mainMenu = this.ParentOfType<MainWindow>().dzMainMenu;
344
            try
345
            {
346
                mainMenu.ConvertInkControlToPolygon();
347

    
348
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
349
                // update mylist and gridview
350
                mainMenu.UpdateMyMarkupList();
351

    
352
                if (mainMenu.gridViewMarkup.SelectedItems.Count == 0 && mainMenu.gridViewMarkup.Items.Count > 0)
353
                {
354
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
355
                }
356
                else
357
                {                    
358
                    foreach (var item in mainMenu.gridViewMarkup.SelectedItems)
359
                    {
360
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
361
                        {
362
                            /// 저장 서비스 호출
363
                            this.ExecuteSaveCommand(mainMenu);
364

    
365
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
366
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
367
                            {
368
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save is complete.", "Info");
369
                            }
370
                        }
371
                    }
372
                }
373

    
374
                mainMenu.SetCommentPages(null);
375

    
376
                ViewerDataModel.Instance.UndoDataList.Clear();
377
            }
378
            catch (Exception ex)
379
            {
380
                System.Diagnostics.Debug.WriteLine("_SaveEvent Error : " + ex.ToString());
381
            }
382
            finally
383
            {
384
                /*
385
                /// delete markup information when 코멘트가 없을 경우
386
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
387
                {
388
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
389
                    {
390
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
391
                        {
392
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
393
                        }
394
                    }
395
                }
396
                */
397
            }
398
        }
399

    
400
        /// <summary>
401
        /// call save command
402
        /// </summary>
403
        /// <param name="menu"></param>
404
		private void ExecuteSaveCommand(MainMenu menu)
405
        {
406
            if (menu.pageNavigator.CurrentPage != null)
407
            {
408
                SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
409
                SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
410
                SaveCommand.Instance.user_id = App.ViewInfo.UserID;
411
                SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
412

    
413
                try
414
                {
415
                    if (ViewerDataModel.Instance.UndoDataList.Count > 0)
416
                    {
417
                        List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
418
                        foreach (var item in menu.gridViewMarkup.SelectedItems)
419
                        {
420
                            if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
421
                            {
422
                                SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
423
                            }
424
                        }
425

    
426
                        SaveCommand.Instance.Execute(SelectedMarkupInfos);
427
                    }
428

    
429
                    if (ViewerDataModel.Instance.RotationDocs.Count > 0)
430
                    {
431
                        SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
432
                    }
433
                }
434
                catch (Exception ex)
435
                {
436
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
437
                    throw ex;
438
                }
439
            }
440
            else
441
            {
442
                System.Diagnostics.Debug.WriteLine("ExecuteSaveCommand Error - pageNavigator.CurrentPage null");
443
            }
444
        }
445

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

    
460
                }
461
                else
462
                {
463
                    this.SaveEventCallback(null, null);
464
                }
465
            }
466

    
467
            bool isprint = false;
468
            if (Type == "Print")
469
            {
470
                isprint = true;
471
            }
472

    
473
            RadWindow PrintWindow = new RadWindow();
474
            PrintWindow.Width = 850;
475
            PrintWindow.Height = 600;
476
            PrintWindow.Header = Type;
477

    
478
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
479

    
480
            markupinfo = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetPrintDocItemList(App.ViewInfo.ProjectNO, App.ViewInfo.DocumentItemID, ViewerDataModel.Instance._markupInfoList.ToList());
481

    
482
            if (markupinfo?.Count() > 0)
483
            {
484
                //Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
485
            }
486
            else
487
            {
488
                //Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
489
            }
490

    
491
            /// Tile Source URL을 구한다
492

    
493
            string sImageURL = ViewerDataModel.Instance.SystemMain.dzMainMenu.GetImageURL(App.ViewInfo.DocumentItemID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber);
494
            var url = new Uri(sImageURL);
495
            string sFolder = App.ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString() : App.ViewInfo.DocumentItemID.Substring(0, 5);
496
            var Tile_Url = string.Format(@"{0}://{1}:{2}/TileSource/{3}_Tile/{4}/{5}/",
497
                url.Scheme, url.Host, url.Port,
498
                App.ViewInfo.ProjectNO,
499
                sFolder,
500
                App.ViewInfo.DocumentItemID
501
                );
502
            /// up to here
503

    
504
            var docitem = this.ParentOfType<MainWindow>().dzMainMenu._DocItem;
505

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

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

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

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

    
540
            if (this.ParentOfType<MainWindow>() != null)
541
            {
542
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
543
                {
544
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
545
                    {
546
                        if (item.GetType().Name == "AdornerFinal")
547
                        {
548
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
549
                            {
550
                                AdonerList.Add(InnerItem);
551
                            }
552
                        }
553
                    }
554
                }
555
            }
556

    
557
            return AdonerList;
558
        }
559
        /// <summary>
560
        /// 투명도
561
        /// </summary>
562
        /// <param name="sender"></param>
563
        /// <param name="e"></param>
564
        //강인구 추가(Undo End)
565
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
566
        {
567
            List<AdornerMember> AdonerList = GetAdornerItem();
568
            if(AdonerList.Count > 0)
569
            {
570
                Undo_data UndoData = new Undo_data()
571
                {
572
                    IsUndo = false,
573
                    Event = Event_Type.Option,
574
                    EventTime = DateTime.Now,
575
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
576
                    Markup_List = new List<Multi_Undo_data>()
577
                };
578
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
579

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

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

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

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

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

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

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

    
722

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1147
                            ChangeComment(item as Controls.AdornerFinal);
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 (comboFontFamily.SelectedItem != null)
1161
            {
1162
                var font = comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont;
1163

    
1164
                if (this.ParentOfType<MainWindow>()?.dzMainMenu.SelectLayer.Children.Count > 0)
1165
                {
1166
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1167
                    {
1168
                        if (item.GetType().Name == "AdornerFinal")
1169
                        {
1170
                            var adnoerFinal = (item as Controls.AdornerFinal);
1171

    
1172
                            var adornerMembers = adnoerFinal.Members.Cast<Controls.AdornerMember>();
1173

    
1174
                            foreach (var InnerItem in adornerMembers)
1175
                            {
1176
                                switch (InnerItem.DrawingData.GetType().Name)
1177
                                {
1178
                                    case ("TextControl"):
1179
                                        (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).SetFontFamily(font.FontFamily);
1180
                                        break;
1181
                                    case ("ArrowTextControl"):
1182
                                        (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).SetFontFamily(font.FontFamily);
1183
                                        break;
1184
                                }
1185
                            }
1186

    
1187
                            ChangeComment(adnoerFinal);
1188
                        }
1189
                    }
1190
                }
1191

    
1192
                KCOM.Properties.Settings.Default.FontFamily = font.FontFamily.FontName();
1193
                Properties.Settings.Default.Save();
1194
            }
1195
        }
1196

    
1197

    
1198
        /// <summary>
1199
        /// 텍스트 컨트롤 하일라이트 처리
1200
        /// </summary>
1201
        /// <param name="sender"></param>
1202
        /// <param name="e"></param>
1203
        private void HighlightEvent(object sender, RoutedEventArgs e)
1204
        {
1205

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

    
1224
        //추가페이지 이동 엔터
1225
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1226
        {
1227
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1228
            if (e.Key == Key.Enter)
1229
            {
1230
                try
1231
                {
1232
                    var instanceMain = this.ParentOfType<MainWindow>();
1233
                    var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber);
1234
                    if (string.IsNullOrEmpty(tlcurrentPage.Text))
1235
                    {
1236
                        RadWindow.Alert(new DialogParameters
1237
                        {
1238
                            Owner = Application.Current.MainWindow,
1239
                            Theme = new VisualStudio2013Theme(),
1240
                            Header = "Info",
1241
                            Content = "Enter the correct page number.",
1242
                        });
1243
                    }
1244
                    else
1245
                    {
1246
                        if (Convert.ToInt32(tlcurrentPage.Text) > max || Convert.ToInt32(tlcurrentPage.Text) == 0)
1247
                        {
1248
                            RadWindow.Alert(new DialogParameters
1249
                            {
1250
                                Owner = Application.Current.MainWindow,
1251
                                Theme = new VisualStudio2013Theme(),
1252
                                Header = "Info",
1253
                                Content = "Enter the correct page number.",
1254
                            });
1255
                        }
1256
                        else
1257
                        {
1258
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1259
                        }
1260
                    }
1261
                    
1262
                }
1263
                catch (Exception)
1264
                {
1265
                    RadWindow.Alert(new DialogParameters
1266
                    {
1267
                        Owner = Application.Current.MainWindow,
1268
                        Theme = new VisualStudio2013Theme(),
1269
                        Header = "Info",
1270
                        Content = "Enter the correct page number.",
1271
                    });
1272
                }
1273
                
1274
            }
1275
        }
1276
        private string previousText;
1277
        private void TlcurrentPage_PreviewTextInput(object sender, TextCompositionEventArgs e)
1278
        {
1279
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
1280
            e.Handled = regex.IsMatch(e.Text);
1281
        }
1282
        private void TlcurrentPage_TextChanged(object sender, TextChangedEventArgs e)
1283
        {
1284
            double num = 0;
1285
            bool success = double.TryParse(((TextBox)sender).Text, out num);
1286
            if (success & num >= 0)
1287
                previousText = ((TextBox)sender).Text;
1288
            else
1289
            {
1290
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
1291
                {
1292
                    ((TextBox)sender).Text = "";
1293
                }
1294
                else
1295
                {
1296

    
1297
                    ((TextBox)sender).Text = previousText;
1298
                }
1299
            }
1300
        }
1301

    
1302
        /// <summary>
1303
        /// 입력한 페이지로 이동한다
1304
        /// </summary>
1305
        /// <param name="sender"></param>
1306
        /// <param name="e"></param>
1307
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1308
        {
1309
            if (e.Key == Key.Enter)
1310
            {
1311
                try
1312
                {
1313
                    var instanceMain = this.ParentOfType<MainWindow>();
1314
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1315
                }
1316
                catch (Exception)
1317
                {
1318
                    RadWindow.Alert(new DialogParameters
1319
                    {
1320
                        Owner = Application.Current.MainWindow,
1321
                        Theme = new VisualStudio2013Theme(),
1322
                        Header = "Info",
1323
                        Content = "Enter the correct page number.",
1324
                    });
1325
                }
1326
            }
1327
        }
1328
        
1329
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1330
        {
1331
            PanoramaShow();
1332
        }
1333

    
1334
        public void PanoramaShow()
1335
        {
1336
            Panorama check = new Panorama();
1337
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1338
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1339
            //double windowWidth = this.Width;
1340
            //double windowHeight = this.Height;
1341

    
1342
            var PanoramaPop = new RadWindow
1343
            {
1344
                //MinWidth = 600,
1345
                //MinHeight = 400,
1346
                //Header = "My Check List",
1347
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1348
                Content = check,
1349
                Owner = this,
1350
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1351
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1352
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1353
                IsTopmost = false,
1354
                //Left = (screenWidth / 2) - (windowWidth / 2),
1355
                //Top = (screenHeight / 2) - (windowHeight / 2),
1356
                //Left = (screenWidth / 2),
1357
                //Top = (screenHeight / 2),
1358
                Width = screenWidth * 0.4,
1359
                Height = screenHeight * 0.4,
1360
            };
1361
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1362
            //CheckPop.ShowDialog();
1363
            PanoramaPop.Owner = Application.Current.MainWindow;
1364
            PanoramaPop.Show();
1365
        }
1366

    
1367
        private void CheckEvent(object sender, RoutedEventArgs e)
1368
        {
1369
            //창이 떠있을 경우 재 실행 방지
1370
            if (isClosed)
1371
            {
1372
                //토글 및 마우스 상태 초기화
1373
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1374
                foreach(var togle in toggleList)
1375
                {
1376
                    togle.IsChecked = false;
1377
                }
1378
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1379

    
1380
                isClosed = false;
1381

    
1382
                
1383
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1384

    
1385
                CheckPop = new RadWindow
1386
                {
1387
                    MinWidth = 1200,
1388
                    MinHeight = 500,
1389
                    //Header = "My Check List",
1390
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1391
                    Content = check,
1392
                    //Owner = this,
1393
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1394
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1395
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1396
                    IsTopmost = true,
1397
                };
1398
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1399
                CheckPop.Closed += CheckPop_Closed;
1400
                
1401
                //CheckPop.ShowDialog();
1402
                CheckPop.Show();
1403
            }
1404
        }
1405

    
1406
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1407
        {
1408
            isClosed = true;
1409
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1410
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1411
            ViewerDataModel.Instance.Capture_Opacity = 0;
1412
        }
1413

    
1414
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1415
        {
1416
            isClosed = true;
1417
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1418
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1419
            ViewerDataModel.Instance.Capture_Opacity = 0;
1420
        }
1421

    
1422
        /// <summary>
1423
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1424
        /// </summary>
1425
        /// <param name="sender"></param>
1426
        /// <param name="e"></param>
1427
        private void PageGoEvent(object sender, RoutedEventArgs e)
1428
        {
1429
            RadButton button = sender as RadButton;
1430
            var instanceMain = this.ParentOfType<MainWindow>();
1431
            
1432
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1433
            try
1434
            {
1435
                switch (button.CommandParameter.ToString())
1436
                {
1437
                    case "Down":
1438
                        {
1439
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1440
                        }
1441
                        break;
1442
                    case "Up":
1443
                        {
1444
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1445
                        }
1446
                        break;
1447
                }
1448
            }
1449
            catch (Exception)
1450
            {
1451
                RadWindow.Alert(new DialogParameters
1452
                {
1453
                    Owner = Application.Current.MainWindow,
1454
                    Theme = new VisualStudio2013Theme(),
1455
                    Header = "Info",
1456
                    Content = "Enter the correct page number.",
1457
                });
1458
            }
1459
        }
1460

    
1461
        private void viewEvent(object sender, RoutedEventArgs e)
1462
        {
1463
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1464
            var instanceMain = this.ParentOfType<MainWindow>();
1465

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

    
1468
            //if ((sender as RadRibbonToggleButton) != null)
1469
            //{
1470
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1471
            //    instanceToggle = (sender as RadRibbonToggleButton);
1472
            //}
1473

    
1474
            //instanceToggle.IsChecked = false;
1475

    
1476
            switch (viewButton.CommandParameter.ToString())
1477
            {
1478
                case "zoomout":
1479
                    {
1480
                        //장원
1481
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1482
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1483
                        viewButton.IsChecked = false;
1484
                        //Common.ViewerDataModel.Instance.zom
1485
                    }
1486
                    break;
1487
                case "zoomin":
1488
                    {
1489
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1490
                        viewButton.IsChecked = false;
1491
                    }
1492
                    break;
1493
                case "fullscreen":
1494
                    {
1495
                        instanceMain.WindowState = WindowState.Maximized;
1496
                        //Sizemode 대기(강인구)
1497
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1498
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1499
                        viewButton.IsChecked = false;
1500
                    }
1501
                    break;
1502
                case "fitWidth":
1503
                    {
1504
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1505
                        viewButton.IsChecked = false;
1506
                    }
1507
                    break;
1508
                case "fitHeight":
1509
                    {
1510
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1511
                        viewButton.IsChecked = false;
1512
                    }
1513
                    break;
1514
                case "boundzoom":
1515
                    {
1516

    
1517
                    }
1518
                    break;
1519
                case "Rotate_M":
1520
                    {
1521
                        drawingPannelRotate(false);
1522
                        viewButton.IsChecked = false;
1523
                    }
1524
                    break;
1525
                case "Rotate_P":
1526
                    {
1527
                        drawingPannelRotate(true);
1528
                        viewButton.IsChecked = false;
1529
                    }
1530
                    break;
1531
                case "Rotate_half":
1532
                    {
1533
                        drawingPannelRotate(true);
1534
                        drawingPannelRotate(true);
1535
                        viewButton.IsChecked = false;
1536
                    }
1537
                    break;
1538
            }
1539
        }
1540

    
1541
        private void Control_Event(object sender, RoutedEventArgs e)
1542
        {
1543

    
1544
        }
1545

    
1546
        #region 대기
1547

    
1548
        public void drawingPannelRotate(bool Flag)
1549
        {
1550
            var instanceMain = this.ParentOfType<MainWindow>();
1551

    
1552
            //if (rotateOffSet > 3)
1553
            //    rotateOffSet = 0;
1554

    
1555
            //if (rotateOffSet < 0)
1556
            //    rotateOffSet = 3;
1557

    
1558
            if(Flag)
1559
            {
1560
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1561
                {
1562
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1563
                }
1564
                else
1565
                {
1566
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1567
                }
1568
            }
1569
            else
1570
            {
1571
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1572
                {
1573
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1574
                }
1575
                else
1576
                {
1577
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1578
                }
1579
            }
1580
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1581
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1582
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1583

    
1584
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1585
            {
1586
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1587
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1588
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1589
            }
1590
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1591
            {
1592
                instanceMain.dzMainMenu.translate.X = 0;
1593
                instanceMain.dzMainMenu.translate.Y = 0;
1594
            }
1595
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1596
            {
1597
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1598
                instanceMain.dzMainMenu.translate.Y = 0;
1599
            }
1600
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1601
            {
1602
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1603
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1604
            }
1605
            else
1606
            {
1607
                instanceMain.dzMainMenu.translate.X = 0;
1608
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1609
            }
1610

    
1611
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1612
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1613
            //대기(강인구)
1614
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1615

    
1616

    
1617
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1618
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1619
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1620

    
1621

    
1622
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1623
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1624
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1625
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1626
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1627
            //ViewerDataModel.Instance.Document_Info.Clear();
1628
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1629
            //{
1630
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1631
            //});
1632

    
1633

    
1634
            //이미지 각도 변경 시 실시간 Thumbnail 각도 변경(강인구 추가)
1635
            var thumbnaillist = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber);
1636

    
1637
            foreach (var data in thumbnaillist)
1638
            {
1639
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1640

    
1641
                //instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1642
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1643
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1644

    
1645
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1646

    
1647
                //rotation page add or update
1648
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1649
                if (rotationdoc != null)
1650
                {
1651
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1652
                }
1653
                else
1654
                {
1655
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1656
                }
1657
            }
1658
        }
1659
        #endregion
1660

    
1661
        private void ImageConverter(RadToggleButton instanceToggle)
1662
        {
1663
            try
1664
            {           
1665
                var instanceMain = this.ParentOfType<MainWindow>();
1666
                //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1667

    
1668
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1669
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1670
                Nullable<bool> result = dlg.ShowDialog();
1671
                if (result == true)
1672
                {
1673
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1674
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1675

    
1676
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1677
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1678
                    long numByte = fileInfo.Length;
1679
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1680
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1681

    
1682
                    if (dLen < 4)
1683
                    {
1684
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1685
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1686
                        byte[] data = br.ReadBytes((int)numByte);
1687
                        br.Close();
1688

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

    
1691
                        Check_Uri.UriCheck(filepath);
1692

    
1693
                        instanceMain.dzMainMenu.filename = filepath;
1694

    
1695
                        fStream.Close();
1696
                        fStream.Dispose();
1697
                    }
1698
                    else
1699
                    {
1700
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1701
                    }
1702
                }
1703
                else
1704
                {
1705
                    instanceToggle.IsChecked = false;
1706
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1707
                    Common.ViewerDataModel.Instance.ControlTag = null;
1708
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1709
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1710
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1711
                }
1712
            }
1713
            catch(Exception ex)
1714
            {
1715
                instanceToggle.IsChecked = false;
1716
                Common.ViewerDataModel.Instance.SelectedControl = "";
1717
                Common.ViewerDataModel.Instance.ControlTag = null;
1718
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1719
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1720
                this.ParentOfType<MainWindow>().DialogMessage_Alert(""+ ex , "Alert");
1721
            }
1722
        }
1723

    
1724
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1725
        {
1726

    
1727
        }
1728

    
1729
        private void ControlEvent(object sender, RoutedEventArgs e)
1730
        {
1731
            RadToggleButton instanceToggle = sender as RadToggleButton;
1732
            var instanceMain = this.ParentOfType<MainWindow>();
1733

    
1734
            #region Ctrl + A 눌렀을 때 대처 방법 
1735
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1736
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1737
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1738
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1739
            {
1740
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1741
                //foreach (var item in lstItem)
1742
                //{
1743
                //    foreach (var member in item.MemberSet)
1744
                //    {
1745
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1746
                //        {
1747
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1748
                //        }
1749
                //    }
1750
                //}
1751
            }
1752
            #endregion
1753

    
1754
            //if (!instanceMain.IsFreeSelectionMode)
1755
            //{
1756
            //    instanceMain.IsSwingMode = true;
1757
            //}
1758

    
1759
            //#region 다른 컨트롤 버튼 선택 해제
1760
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1761
            //{
1762
            //    if (ControlState == null)
1763
            //    {
1764
            //        instanceToggle.IsChecked = false;
1765
            //        HiddenControlHide();
1766
            //    }
1767
            //});
1768
            //#endregion
1769

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

    
1772
            if (instanceToggle != null)
1773
            {
1774
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1775
            }
1776
            else if ((sender as RadRibbonToggleButton) != null)
1777
            {
1778
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1779
                instanceToggle = (sender as RadRibbonToggleButton);
1780
            }
1781
            else if ((sender as RadRibbonButton) != null)
1782
            {
1783
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1784
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1785
            }
1786
            else
1787
            {
1788
                RadButton instanceButton = sender as RadButton;
1789
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1790
            }
1791

    
1792

    
1793
            //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1794
            //{
1795
            //    if (instanceToggle.CommandParameter.ToString() == "ChainLine")
1796
            //    {
1797

    
1798
            //    }
1799
            //    else
1800
            //    {
1801
            //        System.Diagnostics.Debug.WriteLine(" instanceMain.dzMainMenu.MainAngle.Visibility   " + isSee);
1802

    
1803
            //        if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
1804
            //        {
1805
            //            instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1806
            //        }
1807
            //    }
1808
            //    //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1809
            //    //{
1810
            //    //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1811
            //    //});
1812
            //});
1813

    
1814
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1815

    
1816
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1817

    
1818
            if (instanceToggle.IsChecked != false)
1819
            {
1820
                #region 컨트롤이 체크되었다면
1821
                switch (instanceToggle.CommandParameter.ToString())
1822
                {
1823
                    #region Line
1824
                    case "Line":
1825
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
1826
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1827
                        if (instanceToggle.Tag.ToString() == "LineDelete")
1828
                        {
1829
                            //HiddenInterval.Visibility = Visibility.Visible;
1830
                        }
1831
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
1832
                        break;
1833
                    #endregion
1834
                    #region ChainLine
1835
                    case "ChainLine":
1836
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
1837
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1838
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
1839
                        break;
1840
                    #endregion
1841
                    #region DimLine
1842
                    case "DimLine":
1843
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
1844
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1845
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
1846
                        break;
1847
                    #endregion
1848
                    #region TwinLine
1849
                    case "TwinLine":
1850
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
1851
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1852
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
1853
                        break;
1854
                    #endregion
1855
                    #region CancelLine
1856
                    case "CancelLine":
1857
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
1858
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1859
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
1860
                        break;
1861
                    #endregion
1862
                    #region PolygonCloud
1863
                    case "PolygonCloud":
1864
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
1865
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1866
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
1867
                        break;
1868
                    #endregion
1869
                    #region RectCloud
1870
                    case "RectCloud":
1871
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
1872
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1873
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
1874
                        break;
1875
                    #endregion
1876
                    #region Rectangle
1877
                    case "Rectangle":
1878
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
1879
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1880
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
1881
                        break;
1882
                    #endregion
1883
                    #region Triangle
1884
                    case "Triangle":
1885
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
1886
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1887
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
1888
                        break;
1889
                    #endregion
1890
                    #region RectCloud
1891
                    case "Circle":
1892
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
1893
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1894
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
1895
                        break;
1896
                    #endregion
1897
                    #region Symbol
1898
                    case "Symbol":
1899
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
1900
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1901
                        break;
1902
                    #endregion
1903
                    #region SymbolN
1904
                    case "SymbolN":
1905
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
1906
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
1907
                        break;
1908
                    #endregion
1909
                    #region Text
1910
                    case "Text":
1911
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
1912
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1913
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
1914
                        break;
1915
                    #endregion
1916
                    #region TextBorder
1917
                    case "TextBorder":
1918
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
1919
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1920
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
1921
                        break;
1922
                    #endregion
1923
                    #region TextCloud
1924
                    case "TextCloud":
1925
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
1926
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1927
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
1928
                        break;
1929
                    #endregion
1930
                    #region Date
1931
                    case "Date":
1932
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
1933
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
1934
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
1935
                        break;
1936
                    #endregion
1937
                    #region ArrowText
1938
                    case "ArrowText":
1939
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
1940
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
1941
                        {
1942
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
1943
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
1944
                        }
1945
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
1946
                        {
1947
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
1948
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
1949
                        }
1950
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
1951
                        {
1952
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
1953
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
1954
                        }
1955
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
1956
                        {
1957
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
1958
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
1959
                        }
1960
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
1961
                        {
1962
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
1963
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
1964
                        }
1965
                        else
1966
                        {
1967
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
1968
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
1969
                            //HiddenAxisLock.Visibility = Visibility.Visible;
1970
                        }
1971
                        break;
1972
                    #endregion
1973
                    #region Arrow
1974
                    case "Arrow":
1975
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
1976
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1977
                        //HiddenDimSize.Visibility = Visibility.Visible;
1978
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
1979
                        break;
1980
                    #endregion
1981
                    #region Shape
1982
                    case "Shape":
1983
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
1984
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
1985
                        break;
1986
                    #endregion
1987
                    #region Polygon
1988
                    case "Polygon":
1989
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
1990
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
1991
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1992
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
1993
                        break;
1994
                    #endregion
1995
                    #region Arc
1996
                    case "Arc":
1997
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
1998
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
1999
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2000
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2001
                        break;
2002
                    #endregion
2003
                    #region ArrowArc
2004
                    case "ArrowArc":
2005
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowArc";
2006
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcArrow;
2007
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2008
                        TaskMessage("ArcArrow 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
2009
                        break;
2010
                    #endregion
2011
                    #region ArrowMulti
2012
                    case "ArrowMulti":
2013
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
2014
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
2015
                        //HiddenAxisLock.Visibility = Visibility.Visible;
2016
                        break;
2017
                    #endregion
2018
                    #region Etc
2019
                    case "Etc":
2020
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
2021
                        break;
2022
                    #endregion
2023
                    #region Ink
2024
                    case "Ink":
2025
                        if (instanceToggle.Tag.ToString() == "EraserClear")
2026
                        {
2027
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2028
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
2029
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
2030
                        }
2031
                        else if (instanceToggle.Tag.ToString() == "Eraser")
2032
                        {
2033
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
2034
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
2035
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
2036
                        }
2037
                        else
2038
                        {
2039
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
2040
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
2041
                        }
2042

    
2043
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
2044

    
2045
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
2046
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
2047
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2048
                        break;
2049
                    #endregion
2050
                    #region Select
2051
                    case "Select":
2052
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2053
                        {
2054
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2055
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2056
                        }
2057
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2058
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2059
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2060
                        break;
2061
                    #endregion
2062
                    #region Image
2063
                    case "Image":
2064
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2065
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2066
                        ImageConverter(instanceToggle);
2067
                        break;
2068
                    #endregion
2069
                    #region Sign
2070
                    case "Sign":
2071
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2072
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2073
                        //강인구 추가
2074
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2075
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2076
                        //{
2077
                        //    if (ea.Result == null)
2078
                        //    {
2079

    
2080
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2081
                        //    }
2082
                        //    else
2083
                        //    {
2084
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2085
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2086
                        //        {
2087
                        //            BitmapImage im = new BitmapImage();
2088
                        //            im.SetSource(ms);
2089
                        //            instanceMain.DeepLayer.SignImage = im;
2090
                        //            ms.Close();
2091
                        //        }
2092
                        //    }
2093
                        //};
2094
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2095
                        break;
2096
                    #endregion
2097
                    #region Check
2098
                    case "Check":
2099
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2100
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2101
                        //강인구 추가
2102
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2103
                        break;
2104
                    #endregion
2105
                    #region Batch
2106
                    case "Batch":
2107
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2108
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2109
                        //강인구 추가
2110
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2111
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2112
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2113
                        break;
2114
                    #endregion
2115
                    #region Copy
2116
                    case "Copy":
2117
                        Copy_Start();
2118
                        instanceToggle.IsChecked = false;
2119
                        ViewerDataModel.Instance.SelectedControl = "";
2120
                        ViewerDataModel.Instance.ControlTag = null;
2121
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2122
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2123
                        break;
2124
                    #endregion
2125
                    #region Cut
2126
                    case "Cut":
2127
                        //Cut_Start();
2128
                        CutCommand.Instance.Execute();
2129
                        instanceToggle.IsChecked = false;
2130
                        ViewerDataModel.Instance.SelectedControl = "";
2131
                        ViewerDataModel.Instance.ControlTag = null;
2132
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2133
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2134
                        break;
2135
                    #endregion
2136
                    #region Paste
2137
                    case "Paste":
2138
                        Paste_Start();
2139
                        instanceToggle.IsChecked = false;
2140
                        ViewerDataModel.Instance.SelectedControl = "";
2141
                        ViewerDataModel.Instance.ControlTag = null;
2142
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2143
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2144
                        break;
2145
                    #endregion
2146
                    #region Delete
2147
                    case "Delete":
2148
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2149
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2150

    
2151
                        instanceToggle.IsChecked = false;
2152
                        ViewerDataModel.Instance.SelectedControl = "";
2153
                        ViewerDataModel.Instance.ControlTag = null;
2154
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2155
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2156
                        break;
2157
                    #endregion
2158
                    #region Undo
2159
                    case "Undo":
2160
                        UndoCommand.Instance.Execute();
2161
                        instanceToggle.IsChecked = false;
2162
                        ViewerDataModel.Instance.SelectedControl = "";
2163
                        ViewerDataModel.Instance.ControlTag = null;
2164
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2165
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2166
                        break;
2167
                    #endregion
2168
                    #region Redo
2169
                    case "Redo":
2170
                        RedoCommand.Instance.Execute();
2171
                        instanceToggle.IsChecked = false;
2172
                        ViewerDataModel.Instance.SelectedControl = "";
2173
                        ViewerDataModel.Instance.ControlTag = null;
2174
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2175
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2176
                        break;
2177
                    #endregion
2178
                    #region DragZoom
2179
                    case "DragZoom":
2180
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2181
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2182
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2183
                        break;
2184
                    #endregion
2185
                    #region Grouping
2186
                    case "Group":
2187
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2188
                        //foreach (var togle in GrouptoggleList)
2189
                        //{
2190
                        //    togle.IsChecked = false;
2191
                        //}
2192

    
2193
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2194
                        //{
2195
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2196
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2197
                        //}
2198
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2199
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2200
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2201
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2202
                        //{
2203
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2204
                        //}
2205
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2206
                        //{
2207
                        //    // string MarkupData = "";
2208
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2209
                        //    {
2210
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2211
                        //        {
2212
                        //            //MARKUP_DATA_GROUP INSERT
2213
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2214
                        //            {
2215
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2216
                        //                STATE = 0,
2217
                        //            };
2218
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2219
                        //            //Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2220
                        //            if (group_id > 0)
2221
                        //            {
2222
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2223
                        //                {
2224
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2225
                        //                    {
2226
                        //                        //MARKUP_DATA UPDATE
2227
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2228
                        //                        ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2229
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2230
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2231
                        //                    }
2232
                        //                }
2233
                        //            }
2234
                        //        }
2235
                        //    }
2236
                        //}
2237
                        break;
2238
                    case "UnGroup":
2239
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2240
                        //foreach (var togle in UnGrouptoggleList)
2241
                        //{
2242
                        //    togle.IsChecked = false;
2243
                        //}
2244
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2245
                        //{
2246
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2247
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2248
                        //}
2249
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2250
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2251
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2252

    
2253
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2254
                        //{
2255
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2256
                        //}
2257
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2258
                        //{
2259
                        //    // string MarkupData = "";
2260
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2261
                        //    {
2262
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2263
                        //        {
2264
                        //            //MARKUP_DATA UPDATE
2265
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2266
                        //            {
2267
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2268
                        //                {
2269
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2270
                        //                    //MARKUP_DATA UPDATE
2271
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2272
                        //                    ////Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2273
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2274
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2275

    
2276

    
2277
                        //                    //MARKUP_DATA_GROUP UPDATE
2278
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2279
                        //                    ////Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2280
                        //                }
2281
                        //            }
2282
                        //        }
2283
                        //    }
2284
                        //}
2285
                        break;
2286
                    #endregion
2287
                    #region Capture
2288
                    case "Capture":
2289
                        SyncInit();
2290
                        //   instanceToggle.IsChecked = false;
2291
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2292
                        foreach (var togle in CaptureList)
2293
                        {
2294
                            togle.IsChecked = false;
2295
                        }
2296

    
2297
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2298
                        {
2299
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2300
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2301
                        }
2302

    
2303
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2304
                   //     ViewerDataModel.Instance.ControlTag = null;
2305
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2306

    
2307
                        /*
2308
                        //캡쳐 하기 전에 코멘트 저장
2309
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2310
                        {
2311
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2312
                            menu.ReleaseAdorner();
2313
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2314
                            {
2315
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2316
                            }
2317
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2318
                            {
2319

    
2320
                            }
2321
                            else
2322
                            {
2323
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2324
                            }
2325
                        }*/
2326

    
2327
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2328
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2329
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2330
                        Application.Current.MainWindow.Focus();
2331
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2332
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2333
                        break;
2334
                    #endregion
2335
                    #region Cad
2336
                    case "Inside":
2337
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2338
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2339
                        Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2340
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2341
                        break;
2342
                    case "Overlap":
2343
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2344
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2345
                        Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2346
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2347
                        break;
2348
                    case "Clip":
2349
                        //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2350
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2351
                        Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2352
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2353
                        break;
2354
                    case "CadExport":
2355
                        //if (isClosed)
2356
                        //{
2357
                        //    //토글 및 마우스 상태 초기화
2358
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2359
                        //    foreach (var togle in toggleList)
2360
                        //    {
2361
                        //        togle.IsChecked = false;
2362
                        //    }
2363
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2364

    
2365
                        //    isClosed = false;
2366
                        //    //Control 파일 먼저 생성
2367
                        //    CollapsedButton_Click();
2368
                        //    CadViewer check = new CadViewer();
2369
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2370
                        //    check.Title = "Export Viewer";
2371
                        //    //check.Topmost = true;
2372
                        //    check.Show();
2373
                        //    check.Closed += Check_Closed;
2374
                        //    instanceToggle.IsChecked = false;
2375
                        //}
2376
                        //break;
2377
                    case "CadViewer":
2378
                        //if (isClosed)
2379
                        //{
2380
                        //    //토글 및 마우스 상태 초기화
2381
                        //    var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2382
                        //    foreach (var togle in toggleList)
2383
                        //    {
2384
                        //        togle.IsChecked = false;
2385
                        //    }
2386
                        //    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2387

    
2388
                        //    isClosed = false;
2389
                        //    CadResultViewer check = new CadResultViewer();
2390
                        //    check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2391
                        //    check.Title = "Viewer";
2392
                        //    check.Show();
2393

    
2394
                        //    check.Closed += Check_Closed;
2395

    
2396
                        //}
2397
                        break;
2398
                    #endregion
2399
                    default:
2400
                        break;
2401
                }
2402
                #endregion
2403
            }
2404
            else
2405
            {
2406

    
2407
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2408
                {
2409
                    instanceMain.dzMainMenu.IsSwingMode = false;
2410
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2411
                    Common.ViewerDataModel.Instance.ControlTag = null;
2412
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2413
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2414
                }
2415
            }
2416

    
2417
        }
2418

    
2419
        private void SyncInit()
2420
        {
2421
            try
2422
            {
2423
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2424
                {
2425
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2426
                    ViewerDataModel.Instance.PageBalanceMode = false;
2427
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2428
                    ViewerDataModel.Instance.PageNumber = 0;
2429
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2430
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2431
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2432
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2433
                }
2434
            }
2435
            catch (Exception ex)
2436
            {
2437
                //Logger.sendResLog("SyncInit", ex.Message, 0);
2438
            }
2439

    
2440
        }
2441

    
2442
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2443
        CommentUserInfo currentControl { get; set; }
2444
        private void Check_Closed(object sender, EventArgs e)
2445
        {
2446
            isClosed = true;
2447
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2448
            //토글 및 마우스 상태 초기화
2449
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2450
            foreach (var togle in toggleList)
2451
            {
2452
                togle.IsChecked = false;
2453
            }
2454
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2455
            ViewerDataModel.Instance.Capture_Opacity = 0;
2456

    
2457
        }
2458

    
2459
        /* public class test 
2460
         {
2461
             public double width { get; set; }
2462
             public double height { get; set; }
2463
         }
2464
         */
2465
        private async void CollapsedButton_Click()
2466
        {
2467
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2468

    
2469
            string[] data = new string[0];
2470

    
2471
            int cnt = 0;
2472
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2473

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

    
2476
            foreach (var item in gridSelectionItem)
2477
            {
2478
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2479
                {
2480
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2481
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2482
                    data = new string[instance.Count];
2483
                    foreach (var markup in instance)
2484
                    {
2485
                        data[cnt++] = await MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressStringAsync(markup.Data,ViewerDataModel.Instance.CancellationToken());
2486
                    }
2487
                }
2488
            }
2489

    
2490
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2491
            {
2492
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2493
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2494
                if (!File.Exists(FilePath))
2495
                {
2496
                    Directory.CreateDirectory(FilePath);
2497
                }
2498

    
2499
                if (!string.IsNullOrEmpty(FileName))
2500
                {
2501
                    //  File.WriteAllText(SaveDig.FileName, data);
2502
                    File.WriteAllLines(FileName, data);
2503
                }
2504
            }
2505
        }
2506

    
2507
        private double minHeight;
2508
        private double minWidth;
2509

    
2510
        private double maxHeight;
2511
        private double maxWidth;
2512

    
2513
        public bool CanVResize { get; private set; }
2514
        public bool CanHResize { get; private set; }
2515

    
2516
        public void DesignerComponent(FrameworkElement content)
2517
        {
2518
            this.InitializeComponent();
2519

    
2520
            if (!double.IsNaN(content.Width))
2521
            {
2522
                CanHResize = false;
2523
                this.Width = content.Width;
2524
            }
2525
            else
2526
            {
2527
                CanHResize = true;
2528
                this.Width = 23.0;
2529
            }
2530
            if (!double.IsNaN(content.Height))
2531
            {
2532
                CanVResize = false;
2533
                this.Height = content.Height; ;
2534
            }
2535
            else
2536
            {
2537
                CanVResize = true;
2538
                this.Height = 23.0;
2539
            }
2540

    
2541
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2542
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2543
            maxWidth = content.MaxWidth;
2544
            maxHeight = content.MaxHeight;
2545

    
2546
            double top = (double)content.GetValue(Canvas.TopProperty);
2547
            if (double.IsNaN(top))
2548
                top = 0.0;
2549
            double left = (double)content.GetValue(Canvas.LeftProperty);
2550
            if (double.IsNaN(left))
2551
                left = 0.0;
2552
            SetValue(Canvas.TopProperty, top);
2553
            SetValue(Canvas.LeftProperty, left);
2554

    
2555
            //Set the actual content. Note that "Content" property is a new property. See below
2556
            this.Content = content;
2557
        }
2558
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2559
        {
2560
            string name = ((Thumb)sender).Name;
2561
            if (name.Contains("Top"))
2562
            {
2563
                double newHeight = this.Height - e.VerticalChange;
2564
                if (newHeight >= minHeight && newHeight <= maxHeight)
2565
                {
2566
                    this.Height = newHeight;
2567
                    SetValue(Canvas.TopProperty,
2568
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2569
                }
2570
            }
2571
            if (name.Contains("Right"))
2572
            {
2573
                double newWidth = this.Width + e.HorizontalChange;
2574
                if (newWidth >= minWidth && newWidth <= maxWidth)
2575
                    this.Width = newWidth;
2576
            }
2577
            if (name.Contains("Bottom"))
2578
            {
2579
                double newHeight = this.Height + e.VerticalChange;
2580
                if (newHeight >= minHeight && newHeight <= maxHeight)
2581
                    this.Height = newHeight;
2582
            }
2583
            if (name.Contains("Left"))
2584
            {
2585
                double newWidth = this.Width - e.HorizontalChange;
2586
                if (newWidth >= minWidth && newWidth <= maxWidth)
2587
                {
2588
                    this.Width = newWidth;
2589
                    SetValue(Canvas.LeftProperty,
2590
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2591
                }
2592
            }
2593
        }
2594

    
2595
        private void drawControlBorder(object sender)
2596
        {
2597
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2598
        }
2599

    
2600
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2601
        {
2602
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2603
            if (designerItem != null)
2604
            {
2605
                double deltaVertical, deltaHorizontal;
2606

    
2607
                switch (VerticalAlignment)
2608
                {
2609
                    case VerticalAlignment.Bottom:
2610
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2611
                        designerItem.Height -= deltaVertical;
2612
                        break;
2613
                    case VerticalAlignment.Top:
2614
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2615
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2616
                        designerItem.Height -= deltaVertical;
2617
                        break;
2618
                    default:
2619
                        break;
2620
                }
2621

    
2622
                switch (HorizontalAlignment)
2623
                {
2624
                    case HorizontalAlignment.Left:
2625
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2626
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2627
                        designerItem.Width -= deltaHorizontal;
2628
                        break;
2629
                    case HorizontalAlignment.Right:
2630
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2631
                        designerItem.Width -= deltaHorizontal;
2632
                        break;
2633
                    default:
2634
                        break;
2635
                }
2636
            }
2637
            e.Handled = true;
2638
        }
2639

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

    
2642
        void ExportMethod()
2643
        {
2644
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2645
            SaveDig.Filter = "PDF file format|*.pdf";
2646
            SaveDig.Title = "Save an DWG File";
2647
            SaveDig.ShowDialog();
2648
        }
2649

    
2650
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2651
        {            
2652
            if (cbAutoSave.IsChecked == true)
2653
            {
2654
                SaveTime(true, (int)cbSaveInterval.Value);
2655
            }
2656
            else
2657
            {
2658
                SaveTime(false, (int)cbSaveInterval.Value);
2659
            }
2660
        }
2661
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2662
        {
2663
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2664
            {
2665
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2666
            }
2667
            if (cbAutoSave.IsChecked == true)
2668
            {
2669
                SaveTime(true, (int)cbSaveInterval.Value);
2670
            }
2671

    
2672
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2673
            Properties.Settings.Default.Save();
2674
        }
2675
        //강인구 자동 저장 추가
2676
        private void AutoSave(object sender, RoutedEventArgs e)
2677
        {
2678
            RadToggleButton instanceToggle = sender as RadToggleButton;
2679

    
2680
            if(instanceToggle.IsChecked == true)
2681
            {
2682
                SaveTime(true);
2683
            }
2684
            else
2685
            {
2686
                SaveTime(false);
2687
            }
2688
        }
2689

    
2690
        public void Copy_Start()
2691
        {
2692
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2693
            {
2694
                string MarkupData = "";
2695

    
2696
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2697
                {
2698
                    if (item.GetType().Name == "AdornerFinal")
2699
                    {
2700
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2701

    
2702
                        {
2703
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2704
                            {
2705
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2706
                                MarkupData += "|OR|" + res.ConvertData;
2707
                            }
2708
                        }
2709
                        Clipboard.SetDataObject(MarkupData);
2710
                    }
2711
                }
2712
            }
2713
        }
2714

    
2715
        public void Cut_Start()
2716
        {
2717
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2718
            {
2719
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2720
                {
2721
                    string MarkupData = "";
2722

    
2723
                    if (item.GetType().Name == "AdornerFinal")
2724
                    {
2725
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2726
                        {
2727
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2728
                            {
2729
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2730
                                MarkupData += "|OR|" + res.ConvertData;
2731
                            }
2732
                        }
2733
                        //클립보드에 넣음
2734
                        Clipboard.SetDataObject(MarkupData);
2735
                    }
2736
                }
2737
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2738
            }
2739
        }
2740

    
2741
        public async void Paste_Start()
2742
        {
2743
            //마크업 붙여넣기
2744
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2745
            {
2746
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2747

    
2748
                string[] delimiterChars = { "|OR|" };
2749
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2750

    
2751
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2752

    
2753
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2754

    
2755
                //강인구 Undo/Redo 보류
2756
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2757
                {
2758
                    IsUndo = false,
2759
                    Event = Event_Type.Create,
2760
                    EventTime = DateTime.Now,
2761
                    Markup_List = new List<Multi_Undo_data>()
2762
                };
2763

    
2764
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2765
                {
2766
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2767
                });
2768

    
2769
                foreach (string parse in data)
2770
                {
2771
                    if (parse != "")
2772
                    {
2773
                        System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(ViewerDataModel.Instance.CancellationToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2774
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2775

    
2776
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2777
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2778

    
2779
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2780

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

    
2783
                        UndoData.Markup_List.Add(multi_Undo_Data);
2784
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2785
                    }
2786
                }
2787
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2788

    
2789
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2790
                {
2791
                    Canvas.SetLeft(final, 0);
2792
                    Canvas.SetTop(final, 0);
2793
                }
2794
                else
2795
                {
2796
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2797
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2798
                    final.TranslateItems(realPointX, realPointY);
2799

    
2800
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2801
                    {
2802
                        final.TranslateItems(0.001, 0.001); //dummy
2803
                    }
2804
                }
2805

    
2806
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2807
            }
2808
            //외부 이미지 붙여넣기
2809
            else if (Clipboard.GetImage() != null)
2810
            {
2811
                try
2812
                {
2813
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2814

    
2815
                    //강인구 Undo/Redo 보류
2816
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2817
                    {
2818
                        IsUndo = false,
2819
                        Event = Event_Type.Create,
2820
                        EventTime = DateTime.Now,
2821
                        Markup_List = new List<Multi_Undo_data>()
2822
                    };
2823

    
2824

    
2825
                    string temppath = System.IO.Path.GetTempPath();
2826
                    //string filename = KCOM.Events.Save.shortCommentKey();
2827
                    string filename = Commons.shortFileKey();
2828

    
2829
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2830
                    clipboardImage.Save(temppath + "\\" + filename);
2831

    
2832
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2833
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2834
                    long numByte = fileInfo.Length;
2835
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2836
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2837

    
2838
                    if (dLen < 4)
2839
                    {
2840
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2841
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2842
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2843
                        byte[] data = br.ReadBytes((int)numByte);
2844

    
2845
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2846
                        Check_Uri.UriCheck(filename);
2847
                        br.Close();
2848
                        fStream.Close();
2849
                        fStream.Dispose();
2850
                    }
2851
                    else
2852
                    {
2853
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2854
                        return;
2855
                    }
2856

    
2857
                    fileInfo.Delete();
2858

    
2859
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2860
                    IntPtr hBitmap = bmp.GetHbitmap();
2861
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2862
                    Image img = new Image();
2863
                    if (filename.Contains(".svg"))
2864
                    {
2865
                        byte[] imageData = null;
2866
                        DrawingImage image = null;
2867
                        using (System.Net.WebClient web = new System.Net.WebClient())
2868
                        {
2869
                            imageData = web.DownloadData(new Uri(filename));
2870
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2871
                            image = SvgReader.Load(stream);
2872
                        }
2873
                        img.Source = image;
2874
                    }
2875
                    else
2876
                    {
2877
                        img.Source = new BitmapImage(new Uri(filename));
2878
                    }
2879

    
2880
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2881
                    {
2882
                        PointSet = new List<Point>(),
2883
                        FilePath = filename,
2884
                        ImageData = img.Source,
2885
                        StartPoint = new Point(100, 100),
2886
                        EndPoint = new Point(200, 200),
2887
                        TopRightPoint = new Point(100, 200),
2888
                        LeftBottomPoint = new Point(200, 100)
2889
                    };
2890

    
2891
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2892
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2893
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2894

    
2895
                    currentControl.PointSet = new List<Point>
2896
                                        {
2897
                                            currentControl.StartPoint,
2898
                                            currentControl.LeftBottomPoint,
2899
                                            currentControl.EndPoint,
2900
                                            currentControl.TopRightPoint,
2901
                                        };
2902

    
2903
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2904
                    UndoData.Markup_List.Add(multi_Undo_Data);
2905
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2906

    
2907
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2908
                    currentControl.CommentID = Commons.shortGuid();
2909

    
2910
                    currentControl.ApplyTemplate();
2911
                    currentControl.SetImage();
2912

    
2913
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2914
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2915
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2916

    
2917
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2918
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2919
                    final.TranslateItems(realPointX, realPointY);
2920
                }
2921
                catch(Exception ex)
2922
                {
2923
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2924
                }
2925
            }
2926
        }
2927
    }
2928
}
클립보드 이미지 추가 (최대 크기: 500 MB)