프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 537f4cd8

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

1
using KCOM.Common;
2
using KCOM.Common.Converter;
3
using KCOM.Controls;
4
using KCOM.Events;
5
using MarkupToPDF.Common;
6
using System;
7
using System.Collections.Generic;
8
using System.Linq;
9
using System.Text;
10
using System.Windows;
11
using System.Windows.Controls;
12
using System.Windows.Input;
13
using System.Windows.Media;
14
using Telerik.Windows.Controls;
15

    
16
namespace KCOM.Views
17
{
18
    public partial class TopMenu : UserControl
19
    {
20
        public int rotateOffSet = 0;
21
        private double[] rotateValue = { 0, 90, 180, 270 };
22
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
23
        public bool isClosed = true;
24
        public RadWindow CheckPop;
25
        public MarkupToPDF.Common.Undo_data UndoData;
26
        MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn();
27
        MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl();
28

    
29
        /// <summary>
30
        /// TaskBar에 메시지를 입력합니다
31
        /// </summary>
32
        /// <param name="message"></param>
33
        /// <param name="type"></param>
34
        public void TaskMessage(string message, TaskMessageType type)
35
        {
36
            //if (taskBar != null)
37
            //{
38
            //    string color = "";
39
            //    taskBar.Content = message;
40
            //    DicTaskMessage.TryGetValue(type, out color);
41
            //    taskBar.Foreground = new SolidColorBrush(StringToColorConverter.Parse(color));
42
            //}
43
        }
44

    
45
        /// <summary>
46
        /// Task Type명을 Key값으로 지정합니다
47
        /// </summary>
48
        public enum TaskMessageType
49
        {
50
            Normal,
51
            Caption,
52
            Error,
53
        }
54

    
55
        private void CheckShapeState()
56
        {
57

    
58

    
59
            if (cbHatchShape.IsChecked == true)
60
            {
61
                cbFillShape.IsChecked = false;
62
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
63
            }
64
            else if(cbFillShape.IsChecked == true)
65
            {
66
                cbHatchShape.IsChecked = false;
67
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
68
            }
69
            else
70
            {
71
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
72
            }
73
        }
74

    
75
        //강인구 추가(Undo End)
76
        private void SetPaintEvent()
77
        {
78
            List<AdornerMember> AdonerList = GetAdornerItem();
79

    
80
            if (AdonerList.Count > 0)
81
            {
82
                Undo_data UndoData = new Undo_data()
83
                {
84
                    IsUndo = false,
85
                    Event = Event_Type.Option,
86
                    EventTime = DateTime.Now,
87
                    paint = ViewerDataModel.Instance.paintSet,
88
                    Markup_List = new List<Multi_Undo_data>()
89
                };
90
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
91

    
92
                foreach (AdornerMember InnerItem in AdonerList)
93
                {
94
                    multi_Undo_Data.PointSet = new List<Point>();
95

    
96
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
97
                    {
98
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
99
                    }
100

    
101
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
102
                    UndoData.Markup_List.Add(multi_Undo_Data);
103
                    multi_Undo_Data = new Multi_Undo_data();
104
                }
105

    
106
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
107
                {
108
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
109
                });
110
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
111
            }
112

    
113
        }
114

    
115
        private void SetHighlightEvent()
116
        {
117
            List<AdornerMember> AdonerList = GetAdornerItem();
118

    
119
            if (AdonerList.Count > 0)
120
            {
121
                foreach (AdornerMember InnerItem in AdonerList)
122
                {
123
                    switch (InnerItem.DrawingData.GetType().Name)
124
                    {
125
                        case ("TextControl"):
126
                            {
127
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
128
                            }
129
                            break;
130
                        case ("ArrowTextControl"):
131
                            {
132
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
133
                            }
134
                            break;
135
                    }
136
                }
137
            }
138

    
139
        }
140

    
141
        private void FillShapeEvent(object sender, RoutedEventArgs e)
142
        {
143
            #region 주석
144
            //if ((sender as CheckBox).IsChecked.Value)
145
            //{
146
            //    cbHatchShape.IsChecked = false;
147
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Fill.png", UriKind.Relative));
148
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Fill.png", UriKind.Relative));
149
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle_Fill.png", UriKind.Relative));
150
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon.png", UriKind.Relative));
151
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon.png", UriKind.Relative));
152
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_Fill.png", UriKind.Relative));
153
            //    TaskMessage("채우기 옵션이 적용되었습니다", TaskMessageType.Normal);
154
            //}
155
            //else
156
            //{
157

    
158
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
159
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
160
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
161
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
162
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
163
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
164
            //    TaskMessage("채우기 옵션이 해제되었습니다", TaskMessageType.Caption);
165
            //}
166
            #endregion
167
            ViewerDataModel.Instance.checkFillShape = (sender as CheckBox).IsChecked.Value;
168

    
169
            if (ViewerDataModel.Instance.checkFillShape)
170
            {
171
                cbHatchShape.IsChecked = false;
172
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
173
            }
174
            else
175
            {
176
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
177
            }
178
            SetPaintEvent();
179
        }
180

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

    
212
            //강인구 추가
213
            ViewerDataModel.Instance.checkHatchShape = (sender as CheckBox).IsChecked.Value;
214
            if (ViewerDataModel.Instance.checkHatchShape)
215
            {
216
                cbFillShape.IsChecked = false;
217
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
218
            }
219
            else
220
            {
221
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;  
222
            }
223
            SetPaintEvent();
224
        }
225

    
226
 		//강인구 추가
227
        private string SetColor(string ID)
228
        {
229
            try
230
            {
231
                return ViewerDataModel.Instance._markupInfoList.Where(info => info.MarkupInfoID == ID).First().DisplayColor;
232
            }
233
            catch (Exception)
234
            {
235
                return "#FFFFFF";
236
            }
237
        }
238

    
239
        void SaveTimer_Tick(object sender, EventArgs e)
240
        {
241
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
242
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
243
            {
244
                SaveEvent(null, null);
245
            }
246

    
247
        }
248

    
249
        private void SaveTime(bool IsRun)
250
        {
251
            if(SaveTimer == null)
252
            {
253
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
254
                SaveTimer.Interval = new TimeSpan(0, 0, 5);
255
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
256
            }
257

    
258
            if (IsRun)
259
            {
260
                SaveTimer.Start();
261
            }
262
            else
263
            {
264
                SaveTimer.Stop();
265
            }
266
        }
267
        private void SaveTime(bool IsRun,int timeinterval)
268
        {
269
            if (SaveTimer == null)
270
            {
271
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
272
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
273
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
274
            }
275
            else
276
            {
277
                SaveTimer.Stop();
278
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
279
            }
280

    
281
            if (IsRun)
282
            {
283
                SaveTimer.Start();
284
            }
285
            else
286
            {
287
                SaveTimer.Stop();
288
            }
289
        }
290
        /// <summary>
291
        /// enable busy indicator and then call _SaveEvent method.
292
        /// </summary>
293
        /// <param name="sender"></param>
294
        /// <param name="e"></param>
295
        public void SaveEvent(object sender, RoutedEventArgs e)
296
        {
297
            if (this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy == true) return;
298

    
299
            this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
300

    
301
            System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
302
            {
303
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
304
            }).ContinueWith(task =>
305
            {
306
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
307
            });
308
        }
309

    
310
        /// <summary>
311
        /// save document
312
        /// </summary>
313
        /// <param name="sender"></param>
314
        /// <param name="e"></param>
315
        public void _SaveEvent(object sender, RoutedEventArgs e)
316
        {
317
            try
318
            {
319
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
320

    
321
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
322

    
323
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
324

    
325
                //콘솔리 데잇일 경우 
326
                //if (ViewerDataModel.Instance.IsConsolidate && menu.gridViewMarkup.SelectedItems.Count > 1)
327
                //if (ViewerDataModel.Instance.IsConsolidate)
328
                //{
329
                //    ViewerDataModel.Instance.IsConsolidate = false;
330
                //    return;
331
                //}
332

    
333
                //코멘트가 없을 경우
334
                //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0)
335
                //{
336
                //    foreach (var item in menu.gridViewMarkup.SelectedItems)
337
                //    {
338
                //        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
339
                //        {
340
                //            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
341
                //            return;
342
                //        }
343
                //    }
344
                //}
345

    
346
                //코멘트가 없을 경우
347
                if (ViewerDataModel.Instance.MarkupList_USER.Count == 0)
348
                {
349
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
350
                    {
351
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
352
                        {
353
                            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
354
                            return;
355
                        }
356
                    }
357
                }
358

    
359
                //코멘트가 없을 경우
360
                //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0)
361
                //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0 && menu.gridViewMarkup.SelectedItems.Count == 0)
362
                //{
363
                //    foreach (var item in menu.gridViewMarkup.SelectedItems)
364
                //    {
365
                //        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
366
                //        {
367
                //            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
368
                //            return;
369
                //        }
370
                //    }
371
                //}
372

    
373
                menu.ChangeCommentReact();
374

    
375
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
376
                {
377
                    RefactoryCommentReact(menu);
378
                }
379
                else if (menu.gridViewMarkup.SelectedItems.Count == 0)
380
                {
381
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
382
                    return;
383
                }
384
                //else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as  IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
385
                //{
386
                //    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
387
                //    return;
388
                //}
389
                //강인구 변경
390
                else
391
                {
392
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
393
                    {
394
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
395
                        {
396
                            RefactoryCommentReact(menu);
397
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
398

    
399
                            if (ViewerDataModel.Instance.IsConsolidate)
400
                            {
401
                                return;
402
                            }
403
                            menu.gridViewMarkup.ItemsSource = null;
404
                            menu.gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
405
                            menu.gridViewMarkup.SelectedItem = item;
406

    
407
                            if (sender != null)
408
                            {
409
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
410
                            }
411
                            return;
412
                        }
413
                    }
414
                    ////강인구 변경
415
                    //this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
416
                }
417
                if (sender != null)
418
                {
419
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
420
                }
421
            }
422
            finally
423
            {
424
            }
425
        }
426

    
427
		public void RefactoryCommentReact(MainMenu menu)
428
        {
429
            this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
430

    
431
            Save save = new Save();
432

    
433
            //강인구 추가
434
            List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
435

    
436
            foreach(var item in menu.gridViewMarkup.SelectedItems)
437
            {
438
                if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
439
                {
440
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
441
                }
442
            }
443

    
444
            //MySelectItem = (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
445

    
446

    
447
            save.Project_No = App.ViewInfo.ProjectNO;
448
            save.document_id = App.ViewInfo.DocumentItemID;
449
            save.user_id = App.ViewInfo.UserID;
450
            save.page_no = Convert.ToInt32(tlcurrentPage.Text);
451

    
452
            try
453
            {
454
                menu.ChangeCommentReact();
455
                if (menu.PreviewUserMarkupInfoItem != null) //신규 코멘트인지(MarkupInfo가 없는 경우)
456
                {
457
                    if (menu.gridViewMarkup.SelectedItems.FirstOrDefault() != null) //복수 페이지 혹은 저장한 경우
458
                    {
459
                        foreach(var item in MySelectItem)
460
                        {
461
                            save.MarkupSave(item);
462
                        }
463
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
464
                    }
465
                    else  //단일 페이지인 경우
466
                    {
467
                        //menu.ChangeCommentReact();
468
                        foreach (var item in MySelectItem)
469
                        {
470
                            save.MarkupSave(item);
471
                        }
472
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
473
                    }
474
                }
475
                else //기존 코멘트에 작업하는 경우
476
                {
477
                    if (menu.gridViewMarkup.SelectedItems.FirstOrDefault() != null)
478
                    {
479
                        foreach (var item in MySelectItem)
480
                        {
481
                            save.MarkupSave(item);
482
                        }
483
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
484
                    }
485
                }
486
                using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
487
                {
488
                    KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE();
489

    
490

    
491
                    ViewerDataModel.Instance.Document_Info.OrderBy(i => i.PAGE_NUMBER).ToList().ForEach(data =>
492
                    {
493
                        _docpage = (from info in Entity.DOCPAGE
494
                                    where info.ID == data.ID
495
                                    select info).FirstOrDefault();
496

    
497
                        if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE)
498
                        {
499
                            _docpage.PAGE_ANGLE = data.PAGE_ANGLE;
500
                        }
501
                    });
502

    
503
                    Entity.SaveChanges();
504
                }
505
            }
506
            catch (Exception ex)
507
            {
508
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("세이브 실패", "Alert");
509
            }
510
        }
511

    
512
        //강인구 추가
513
        public void Print_Start(string Type)
514
        {
515

    
516
            if(ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
517
            {
518
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
519
                menu.ReleaseAdorner();
520
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
521
                {
522
                    RefactoryCommentReact(menu);
523
                }
524
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
525
                {
526

    
527
                }
528
                else
529
                {
530
                    RefactoryCommentReact(menu);
531
                }
532
            }
533

    
534
            bool isprint = false;
535
            if (Type == "Print")
536
            {
537
                isprint = true;
538
            }
539

    
540
            RadWindow PrintWindow = new RadWindow();
541
            IKCOM.MarkupInfoItem _result = null;
542
            PrintWindow.Width = 850;
543
            PrintWindow.Height = 600;
544
            //PrintWindow.Width = 650;
545
            //PrintWindow.Height = 550;
546
            PrintWindow.Header = Type;
547

    
548
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
549

    
550
            using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
551
            {
552
                var docinfo = from info in Entity.DOCINFO
553
                              where info.DOCUMENT_ID == App.ViewInfo.DocumentItemID
554
                              && info.PROJECT_NO == App.ViewInfo.ProjectNO
555
                              select info;
556

    
557
                var docitem = docinfo.First();
558

    
559
                foreach (KCOMDataModel.DataModel.MARKUP_INFO markinfo in docitem.MARKUP_INFO)
560
                {
561
                    var member = (from mem in Entity.MEMBER
562
                                  where mem.ID == markinfo.USER_ID
563
                                  select mem).First();
564

    
565
                    _result = new IKCOM.MarkupInfoItem
566
                    {
567
                        MarkupInfoID = markinfo.ID,
568
                        Consolidate = markinfo.CONSOLIDATE,
569
                        CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME,
570
                        DisplayColor = SetColor(markinfo.ID),
571
                        UserID = markinfo.USER_ID,
572
                        UserName = member.NAME,
573
                        Depatment = member.DEPARTMENT,
574
                    };
575

    
576
                    _result.MarkupList = new List<IKCOM.MarkupItem>();
577
                    var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First();
578

    
579
                    foreach (KCOMDataModel.DataModel.MARKUP_DATA markdata in markup_Version.MARKUP_DATA)
580
                    {
581
                        IKCOM.MarkupItem markitem = new IKCOM.MarkupItem()
582
                        {
583
                            ID = markdata.ID,
584
                            PageNumber = markdata.PAGENUMBER,
585
                        };
586
                        _result.MarkupList.Add(markitem);
587
                    }
588

    
589
                    _result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count();
590

    
591
                    markupinfo.Add(_result);
592
                }
593

    
594

    
595
                
596
                //PrintWindow.Content = new KCOM.Control.PrintControl(@"http://honeyhead.net/Pages/000000/111111/11111111/", docitem.PROJECT_NO, docitem, markupinfo, 1, docitem.DOCUMENT_ID, "VP-001-001", "http://honeyhead.net/Ensemble/000000_app/VPCS_DOCLIB/100/001/TEST_C.pdf", isprint);
597

    
598
                //강인구 추가 
599
                var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/", 
600
                    App.SystemInfo.HostName,
601
                    App.ViewInfo.ProjectNO,
602
                    (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
603
                    App.ViewInfo.DocumentItemID
604
                    );
605

    
606

    
607
                PrintWindow.Content = new KCOM.Control.PrintControl(
608
                          Tile_Url,
609
                          docitem.PROJECT_NO,
610
                          docitem, markupinfo,
611
                          this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
612
                          docitem.DOCUMENT_ID,
613
                          this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
614
                          docitem.ORIGINAL_FILE, isprint);
615

    
616
                //http://cloud.devdoftech.co.kr:5977/TileSource/000000_Tile/111111/11111111/1.jpg
617
            }
618

    
619
            //프린트 팝업 옵션
620
            //PrintWindow.BorderThickness = new Thickness(3);
621
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
622
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
623
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
624
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
625
            PrintWindow.Background.Opacity = 0.6;
626

    
627
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
628
            //Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.Office2013Theme());
629
            PrintWindow.ShowDialog();
630
        }
631

    
632
        //강인구 추가
633
        private void PrintEvent(object sender, RoutedEventArgs e)
634
        {
635
            RadRibbonButton button = sender as RadRibbonButton;
636
            Print_Start(button.Content.ToString());
637
        }
638

    
639
        private List<AdornerMember> GetAdornerItem()
640
        {
641
            List<AdornerMember> AdonerList = new List<AdornerMember>();
642

    
643
            if (this.ParentOfType<MainWindow>() != null)
644
            {
645
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
646
                {
647
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
648
                    {
649
                        if (item.GetType().Name == "AdornerFinal")
650
                        {
651
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
652
                            {
653
                                AdonerList.Add(InnerItem);
654
                            }
655
                        }
656
                    }
657
                }
658
            }
659
            return AdonerList;
660
        }
661
        /// <summary>
662
        /// 투명도
663
        /// </summary>
664
        /// <param name="sender"></param>
665
        /// <param name="e"></param>
666
        //강인구 추가(Undo End)
667
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
668
        {
669
            List<AdornerMember> AdonerList = GetAdornerItem();
670
            if(AdonerList.Count > 0)
671
            {
672
                Undo_data UndoData = new Undo_data()
673
                {
674
                    IsUndo = false,
675
                    Event = Event_Type.Option,
676
                    EventTime = DateTime.Now,
677
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
678
                    Markup_List = new List<Multi_Undo_data>()
679
                };
680
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
681

    
682
                foreach (AdornerMember InnerItem in AdonerList)
683
                {
684
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
685
                  
686
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
687
                    UndoData.Markup_List.Add(multi_Undo_Data);
688
                    multi_Undo_Data = new Multi_Undo_data();
689
                }
690

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

    
699
        //강인구 추가(Undo End)
700
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
701
        {
702
            List<AdornerMember> AdonerList = GetAdornerItem();
703
            if (AdonerList.Count > 0)
704
            {
705
                Undo_data UndoData = new Undo_data()
706
                {
707
                    IsUndo = false,
708
                    Event = Event_Type.Option,
709
                    EventTime = DateTime.Now,
710
                    LineSize = ViewerDataModel.Instance.LineSize,
711
                    Markup_List = new List<Multi_Undo_data>()
712
                };
713
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
714

    
715
                foreach (AdornerMember InnerItem in AdonerList)
716
                {
717
                    switch (InnerItem.DrawingData.GetType().Name)
718
                    {
719
                        case ("LineControl"):
720
                            {
721
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
722
                            }
723
                            break;
724
                        case ("ArcControl"):
725
                            {
726
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
727
                            }
728
                            break;
729
                        case ("ArrowControl_Multi"):
730
                            {
731
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
732
                            }
733
                            break;
734
                        case ("CloudControl"):
735
                            {
736
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
737
                            }
738
                            break;
739
                        case ("PolygonControl"):
740
                            {
741
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
742
                            }
743
                            break;
744
                        case ("RectangleControl"):
745
                            {
746
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
747
                            }
748
                            break;
749
                        case ("RectCloudControl"):
750
                            {
751
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
752
                            }
753
                            break;
754
                        case ("TriControl"):
755
                            {
756
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
757
                            }
758
                            break;
759
                        case ("CircleControl"):
760
                            {
761
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
762
                            }
763
                            break;
764
                    }
765
                    
766

    
767
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
768
                    UndoData.Markup_List.Add(multi_Undo_Data);
769
                    multi_Undo_Data = new Multi_Undo_data();
770
                }
771

    
772
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
773
                {
774
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
775
                });
776
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
777
            }
778
        }
779

    
780

    
781
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
782
        {
783
            List<AdornerMember> AdonerList = GetAdornerItem();
784
            if (AdonerList.Count > 0)
785
            {
786

    
787
                Undo_data UndoData = new Undo_data()
788
                {
789
                    IsUndo = false,
790
                    Event = Event_Type.Option,
791
                    EventTime = DateTime.Now,
792
                    Interval = ViewerDataModel.Instance.Interval,
793
                    Markup_List = new List<Multi_Undo_data>()
794
                };
795
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
796

    
797
                foreach (AdornerMember InnerItem in AdonerList)
798
                {
799
                    switch (InnerItem.DrawingData.GetType().Name)
800
                    {
801
                        case ("LineControl"):
802
                            {
803
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
804

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

    
813
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
814
                {
815
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
816
                });
817
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
818
            }
819
        }
820
        
821
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
822
        {
823
            List<AdornerMember> AdonerList = GetAdornerItem();
824
            if (AdonerList.Count > 0)
825
            {
826

    
827
                //Undo_data UndoData = new Undo_data()
828
                //{
829
                //    IsUndo = false,
830
                //    Event = Event_Type.Option,
831
                //    EventTime = DateTime.Now,
832
                //    Interval = ViewerDataModel.Instance.Interval,
833
                //    Markup_List = new List<Multi_Undo_data>()
834
                //};
835
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
836

    
837
                foreach (AdornerMember InnerItem in AdonerList)
838
                {
839
                    switch (InnerItem.DrawingData.GetType().Name)
840
                    {
841
                        case ("RectCloudControl"):
842
                            {
843
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
844

    
845
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
846
                                //UndoData.Markup_List.Add(multi_Undo_Data);
847
                                //multi_Undo_Data = new Multi_Undo_data();
848
                            }
849
                            break;
850
                        case ("CloudControl"):
851
                            {
852
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
853

    
854
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
855
                                //UndoData.Markup_List.Add(multi_Undo_Data);
856
                                //multi_Undo_Data = new Multi_Undo_data();
857
                            }
858
                            break;
859
                    }
860
                }
861

    
862
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
863
                //{
864
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
865
                //});
866
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
867
            }
868
        }
869

    
870
        //강인구 추가(Undo End)
871
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
872
        {
873
            //강인구 추가
874
            if (this.ParentOfType<MainWindow>() != null)
875
            {
876
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
877
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
878
                {
879
                    Undo_data UndoData = new Undo_data()
880
                    {
881
                        IsUndo = false,
882
                        Event = Event_Type.Option,
883
                        EventTime = DateTime.Now,
884
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
885
                        Markup_List = new List<Multi_Undo_data>()
886
                    };
887
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
888

    
889
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
890
                    {
891
                        if (item.GetType().Name == "AdornerFinal")
892
                        {
893
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
894
                            {
895
                                switch (InnerItem.DrawingData.GetType().Name)
896
                                {
897
                                    case ("LineControl"):
898
                                        {
899
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
900
                                        }
901
                                        break;
902
                                    case ("ArcControl"):
903
                                        {
904
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
905
                                        }
906
                                        break;
907
                                    case ("ArrowControl_Multi"):
908
                                        {
909
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
910
                                        }
911
                                        break;
912
                                    case ("CloudControl"):
913
                                        {
914
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
915
                                        }
916
                                        break;
917
                                    case ("PolygonControl"):
918
                                        {
919
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
920
                                        }
921
                                        break;
922
                                    case ("RectangleControl"):
923
                                        {
924
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
925
                                        }
926
                                        break;
927
                                    case ("RectCloudControl"):
928
                                        {
929
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
930
                                        }
931
                                        break;
932
                                    case ("TriControl"):
933
                                        {
934
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
935
                                        }
936
                                        break;
937
                                    case ("CircleControl"):
938
                                        {
939
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
940
                                        }
941
                                        break;
942
                                }
943

    
944
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
945
                                UndoData.Markup_List.Add(multi_Undo_Data);
946
                                multi_Undo_Data = new Multi_Undo_data();
947
                            }
948

    
949
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
950
                            {
951
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
952
                            });
953
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
954
                        }
955
                    }
956
                }
957
            }
958
        }
959

    
960
        //강인구 추가
961
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
962
        {
963
            //if (this.ParentOfType<MainWindow>() != null)
964
            //{
965
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
966
            //    {
967
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
968
            //        {
969
            //            if (item.GetType().Name == "AdornerFinal")
970
            //            {
971
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
972
            //                {
973
            //                    switch (InnerItem.DrawingData.GetType().Name)
974
            //                    {
975
            //                        case ("TextControl"):
976
            //                            {
977
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
978
            //                            }
979
            //                            break;
980
            //                        case ("ArrowTextControl"):
981
            //                            {
982
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
983
            //                            }
984
            //                            break;
985
            //                    }
986
            //                }
987
            //            }
988
            //        }
989
            //    }
990
            //}
991
        }
992

    
993
        //강인구 추가
994
        private void btnBold_Checked(object sender, RoutedEventArgs e)
995
        {
996
            if (this.ParentOfType<MainWindow>() != null)
997
            {
998
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
999
                {
1000
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1001
                    {
1002
                        if (item.GetType().Name == "AdornerFinal")
1003
                        {
1004
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1005
                            {
1006
                                switch (InnerItem.DrawingData.GetType().Name)
1007
                                {
1008
                                    case ("TextControl"):
1009
                                        {
1010
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
1011
                                            {
1012
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
1013
                                            }
1014
                                            else
1015
                                            {
1016
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
1017
                                            }
1018

    
1019
                                        }
1020
                                        break;
1021
                                    case ("ArrowTextControl"):
1022
                                        {
1023
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1024
                                            {
1025
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1026
                                            }
1027
                                            else
1028
                                            {
1029
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1030
                                            }
1031
                                        }
1032
                                        break;
1033
                                }
1034
                            }
1035
                        }
1036
                    }
1037
                }
1038
            }
1039
        }
1040

    
1041
        //강인구 추가
1042
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1043
        {
1044
            if (this.ParentOfType<MainWindow>() != null)
1045
            {
1046
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1047
                {
1048
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1049
                    {
1050
                        if (item.GetType().Name == "AdornerFinal")
1051
                        {
1052
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1053
                            {
1054
                                switch (InnerItem.DrawingData.GetType().Name)
1055
                                {
1056
                                    case ("TextControl"):
1057
                                        {
1058
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1059
                                            {
1060
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1061
                                            }
1062
                                            else
1063
                                            {
1064
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1065
                                            }
1066

    
1067
                                        }
1068
                                        break;
1069
                                    case ("ArrowTextControl"):
1070
                                        {
1071
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1072
                                            {
1073
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1074
                                            }
1075
                                            else
1076
                                            {
1077
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1078
                                            }
1079
                                        }
1080
                                        break;
1081
                                }
1082
                            }
1083
                        }
1084
                    }
1085
                }
1086
            }
1087
        }
1088

    
1089
        //강인구 추가
1090
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1091
        {
1092
            if (this.ParentOfType<MainWindow>() != null)
1093
            {
1094
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1095
                {
1096
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1097
                    {
1098
                        if (item.GetType().Name == "AdornerFinal")
1099
                        {
1100
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1101
                            {
1102
                                switch (InnerItem.DrawingData.GetType().Name)
1103
                                {
1104
                                    case ("TextControl"):
1105
                                        {
1106
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1107
                                            {
1108
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1109
                                            }
1110
                                            else
1111
                                            {
1112
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1113
                                            }
1114
                                        }
1115
                                        break;
1116
                                    case ("ArrowTextControl"):
1117
                                        {
1118
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1119
                                            {
1120
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1121
                                            }
1122
                                            else
1123
                                            {
1124
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1125
                                            }
1126
                                        }
1127
                                        break;
1128
                                }
1129
                            }
1130
                        }
1131
                    }
1132
                }
1133
            }
1134
        }
1135

    
1136
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1137
        {
1138
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1139
        }
1140

    
1141
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1142
        {
1143
            if (this.ParentOfType<MainWindow>() != null)
1144
            {
1145
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1146
                {
1147
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1148
                    {
1149
                        if (item.GetType().Name == "AdornerFinal")
1150
                        {
1151
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1152
                            {
1153
                                switch (InnerItem.DrawingData.GetType().Name)
1154
                                {
1155
                                    case ("TextControl"):
1156
                                        {
1157
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1158
                                        }
1159
                                        break;
1160
                                    case ("ArrowTextControl"):
1161
                                        {
1162
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1163
                                        }
1164
                                        break;
1165
                                }
1166
                            }
1167
                        }
1168
                    }
1169
                }
1170
            }
1171
        }
1172

    
1173
        //강인구 추가
1174
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1175
        {
1176
            if (this.ParentOfType<MainWindow>() != null)
1177
            {
1178
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1179
                {
1180
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1181
                    {
1182
                        if (item.GetType().Name == "AdornerFinal")
1183
                        {
1184
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1185
                            {
1186
                                switch (InnerItem.DrawingData.GetType().Name)
1187
                                {
1188
                                    case ("TextControl"):
1189
                                        {
1190
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1191
                                            //{
1192
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily = new FontFamily(comboFontFamily.Text);
1193
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1194
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1195
                                            //}
1196
                                            //else
1197
                                            //{
1198
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1199
                                            //}
1200
                                        }
1201
                                        break;
1202
                                    case ("ArrowTextControl"):
1203
                                        {
1204
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1205
                                            //{
1206
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1207
                                            //}
1208
                                            //else
1209
                                            //{
1210
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1211
                                            //}
1212
                                        }
1213
                                        break;
1214
                                }
1215
                            }
1216
                        }
1217
                    }
1218
                }
1219
            }
1220
        }
1221

    
1222
        /// <summary>
1223
        /// 텍스트 컨트롤 하일라이트 처리
1224
        /// </summary>
1225
        /// <param name="sender"></param>
1226
        /// <param name="e"></param>
1227
        private void HighlightEvent(object sender, RoutedEventArgs e)
1228
        {
1229

    
1230
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1231
            SetHighlightEvent();
1232
            //if ((sender as CheckBox).IsChecked.Value)
1233
            //{
1234
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1235
            //}
1236
            //else
1237
            //{
1238
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1239
            //}
1240
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1241
            //{
1242
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1243
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1244
            //    instance.SetText();
1245
            //}
1246
        }
1247

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

    
1272
        public event EventHandler<WindowClosedEventArgs> Closed;
1273

    
1274
        //private void CheckEvent(object sender, RoutedEventArgs e)
1275
        //{
1276
        //    RadWindow CheckPop = new RadWindow();
1277
        //    test check = new test();
1278

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

    
1291
        //    CheckPop.Closed += CheckPop_Closed;
1292
        //    CheckPop.ShowDialog();
1293
        //}
1294

    
1295
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1296
        {
1297
            PanoramaShow();
1298
        }
1299

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

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

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

    
1345
                isClosed = false;
1346

    
1347
                
1348
                CheckList check = new CheckList();
1349

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

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

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

    
1417
        private void viewEvent(object sender, RoutedEventArgs e)
1418
        {
1419
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1420
            var instanceMain = this.ParentOfType<MainWindow>();
1421

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

    
1424
            //if ((sender as RadRibbonToggleButton) != null)
1425
            //{
1426
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1427
            //    instanceToggle = (sender as RadRibbonToggleButton);
1428
            //}
1429

    
1430
            //instanceToggle.IsChecked = false;
1431

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

    
1473
                    }
1474
                    break;
1475
                case "Rotate_M":
1476
                    {
1477
                        drawingPannelRotate(false);
1478
                        viewButton.IsChecked = false;
1479
                    }
1480
                    break;
1481
                case "Rotate_P":
1482
                    {
1483
                        drawingPannelRotate(true);
1484
                        viewButton.IsChecked = false;
1485
                    }
1486
                    break;
1487
                case "Rotate_half":
1488
                    {
1489
                        drawingPannelRotate(true);
1490
                        drawingPannelRotate(true);
1491
                        viewButton.IsChecked = false;
1492
                    }
1493
                    break;
1494
            }
1495
        }
1496

    
1497
        private void Control_Event(object sender, RoutedEventArgs e)
1498
        {
1499

    
1500
        }
1501

    
1502
        #region 대기
1503

    
1504
        public void drawingPannelRotate(bool Flag)
1505
        {
1506
            var instanceMain = this.ParentOfType<MainWindow>();
1507

    
1508
            //if (rotateOffSet > 3)
1509
            //    rotateOffSet = 0;
1510

    
1511
            //if (rotateOffSet < 0)
1512
            //    rotateOffSet = 3;
1513

    
1514
            if(Flag)
1515
            {
1516
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1517
                {
1518
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1519
                }
1520
                else
1521
                {
1522
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1523
                }
1524
            }
1525
            else
1526
            {
1527
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1528
                {
1529
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1530
                }
1531
                else
1532
                {
1533
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1534
                }
1535
            }
1536
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1537
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1538
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1539

    
1540
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1541
            {
1542
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1543
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1544
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1545
            }
1546
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1547
            {
1548
                instanceMain.dzMainMenu.translate.X = 0;
1549
                instanceMain.dzMainMenu.translate.Y = 0;
1550
            }
1551
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1552
            {
1553
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1554
                instanceMain.dzMainMenu.translate.Y = 0;
1555
            }
1556
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1557
            {
1558
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1559
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1560
            }
1561
            else
1562
            {
1563
                instanceMain.dzMainMenu.translate.X = 0;
1564
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1565
            }
1566

    
1567
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1568
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1569
            //대기(강인구)
1570
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1571

    
1572

    
1573
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1574
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1575
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1576

    
1577

    
1578
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1579
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1580
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1581
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1582
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1583
            //ViewerDataModel.Instance.Document_Info.Clear();
1584
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1585
            //{
1586
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1587
            //});
1588

    
1589

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

    
1595
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1596
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1597
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1598

    
1599
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1600
            });
1601
        }
1602
        #endregion
1603

    
1604
        private void ImageConverter()
1605
        {
1606
            var instanceMain = this.ParentOfType<MainWindow>();
1607
            //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1608

    
1609

    
1610
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1611
            dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1612
            Nullable<bool> result = dlg.ShowDialog();
1613
            if (result == true)
1614
            {
1615
                instanceMain.dzMainMenu.filename = dlg.FileName;
1616
                instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1617

    
1618
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1619
                String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1620
                long numByte = fileInfo.Length;
1621
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1622
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1623

    
1624
                if (dLen < 4)
1625
                {
1626
                    System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1627
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1628
                    byte[] data = br.ReadBytes((int)numByte);
1629
                    br.Close();
1630

    
1631
                    instanceMain.dzMainMenu.filename = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1632
                    fStream.Close();
1633
                    fStream.Dispose();
1634
                }
1635
                else
1636
                {
1637
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1638
                }
1639
            }
1640
        }
1641

    
1642
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1643
        {
1644

    
1645
        }
1646

    
1647
        private void ControlEvent(object sender, RoutedEventArgs e)
1648
        {
1649
            RadToggleButton instanceToggle = sender as RadToggleButton;
1650
            var instanceMain = this.ParentOfType<MainWindow>();
1651

    
1652
            #region Ctrl + A 눌렀을 때 대처 방법 
1653
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1654
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1655
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1656
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1657
            {
1658
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1659
                //foreach (var item in lstItem)
1660
                //{
1661
                //    foreach (var member in item.MemberSet)
1662
                //    {
1663
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1664
                //        {
1665
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1666
                //        }
1667
                //    }
1668
                //}
1669
            }
1670
            #endregion
1671

    
1672
            //if (!instanceMain.IsFreeSelectionMode)
1673
            //{
1674
            //    instanceMain.IsSwingMode = true;
1675
            //}
1676

    
1677
            #region 다른 컨트롤 버튼 선택 해제
1678
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1679
            {
1680
                if (ControlState == null)
1681
                {
1682
                    instanceToggle.IsChecked = false;
1683
                    HiddenControlHide();
1684
                }
1685
            });
1686
            #endregion
1687

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

    
1690
            if (instanceToggle != null)
1691
            {
1692
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1693
            }
1694
            else if ((sender as RadRibbonToggleButton) != null)
1695
            {
1696
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1697
                instanceToggle = (sender as RadRibbonToggleButton);
1698
            }
1699
            else if ((sender as RadRibbonButton) != null)
1700
            {
1701
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1702
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1703
            }
1704
            else
1705
            {
1706
                RadButton instanceButton = sender as RadButton;
1707
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1708
            }
1709

    
1710

    
1711

    
1712
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1713
            {
1714
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1715
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1716
                {
1717
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1718
                });
1719
            });
1720
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1721

    
1722
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1723

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

    
1941
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1942

    
1943
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
1944
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
1945
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
1946
                        break;
1947
                    #endregion
1948
                    #region Select
1949
                    case "Select":
1950
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
1951
                        {
1952
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
1953
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
1954
                        }
1955
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
1956
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1957
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
1958
                        break;
1959
                    #endregion
1960
                    #region Image
1961
                    case "Image":
1962
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
1963
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1964
                        ImageConverter();
1965
                        break;
1966
                    #endregion
1967
                    #region Sign
1968
                    case "Sign":
1969
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
1970
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
1971
                        //강인구 추가
1972
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
1973
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
1974
                        //{
1975
                        //    if (ea.Result == null)
1976
                        //    {
1977

    
1978
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
1979
                        //    }
1980
                        //    else
1981
                        //    {
1982
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
1983
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
1984
                        //        {
1985
                        //            BitmapImage im = new BitmapImage();
1986
                        //            im.SetSource(ms);
1987
                        //            instanceMain.DeepLayer.SignImage = im;
1988
                        //            ms.Close();
1989
                        //        }
1990
                        //    }
1991
                        //};
1992
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
1993
                        break;
1994
                    #endregion
1995
                    #region Check
1996
                    case "Check":
1997
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
1998
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
1999
                        //강인구 추가
2000
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2001
                        break;
2002
                    #endregion
2003
                    #region Batch
2004
                    case "Batch":
2005
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2006
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2007
                        //강인구 추가
2008
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2009
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2010
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2011
                        break;
2012
                    #endregion
2013
                    #region Copy
2014
                    case "Copy":
2015
                        Copy_Start();
2016
                        instanceToggle.IsChecked = false;
2017
                        ViewerDataModel.Instance.SelectedControl = "";
2018
                        ViewerDataModel.Instance.ControlTag = null;
2019
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2020
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2021
                        break;
2022
                    #endregion
2023
                    #region Cut
2024
                    case "Cut":
2025
                        Cut_Start();
2026
                        instanceToggle.IsChecked = false;
2027
                        ViewerDataModel.Instance.SelectedControl = "";
2028
                        ViewerDataModel.Instance.ControlTag = null;
2029
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2030
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2031
                        break;
2032
                    #endregion
2033
                    #region Paste
2034
                    case "Paste":
2035
                        Paste_Start();
2036
                        instanceToggle.IsChecked = false;
2037
                        ViewerDataModel.Instance.SelectedControl = "";
2038
                        ViewerDataModel.Instance.ControlTag = null;
2039
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2040
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2041
                        break;
2042
                    #endregion
2043
                    #region Delete
2044
                    case "Delete":
2045
                        Delete_Start();
2046
                        instanceToggle.IsChecked = false;
2047
                        ViewerDataModel.Instance.SelectedControl = "";
2048
                        ViewerDataModel.Instance.ControlTag = null;
2049
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2050
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2051
                        break;
2052
                    #endregion
2053
                    #region Undo
2054
                    case "Undo":
2055
                        this.ParentOfType<MainWindow>().dzMainMenu.Undo();
2056
                        instanceToggle.IsChecked = false;
2057
                        ViewerDataModel.Instance.SelectedControl = "";
2058
                        ViewerDataModel.Instance.ControlTag = null;
2059
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2060
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2061
                        break;
2062
                    #endregion
2063
                    #region Redo
2064
                    case "Redo":
2065
                        this.ParentOfType<MainWindow>().dzMainMenu.Redo();
2066
                        instanceToggle.IsChecked = false;
2067
                        ViewerDataModel.Instance.SelectedControl = "";
2068
                        ViewerDataModel.Instance.ControlTag = null;
2069
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2070
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2071
                        break;
2072
                    #endregion
2073
                    #region DragZoom
2074
                    case "DragZoom":
2075
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2076
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2077
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2078
                        break;
2079
                    #endregion
2080

    
2081
                    default:
2082
                        break;
2083
                }
2084
                #endregion
2085
            }
2086
            else
2087
            {
2088

    
2089
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2090
                {
2091
                    instanceMain.dzMainMenu.IsSwingMode = false;
2092
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2093
                    Common.ViewerDataModel.Instance.ControlTag = null;
2094
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2095
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2096
                }
2097
            }
2098
        }
2099

    
2100
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2101
        {
2102
            if(cbAutoSave.IsChecked == true)
2103
            {
2104
                SaveTime(true, (int)cbSaveInterval.Value);
2105
            }
2106
            else
2107
            {
2108
                SaveTime(false, (int)cbSaveInterval.Value);
2109
            }
2110
        }
2111
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2112
        {
2113
            if (cbAutoSave.IsChecked == true)
2114
            {
2115
                SaveTime(true, (int)cbSaveInterval.Value);
2116
            }            
2117
        }
2118
        //강인구 자동 저장 추가
2119
        private void AutoSave(object sender, RoutedEventArgs e)
2120
        {
2121
            RadToggleButton instanceToggle = sender as RadToggleButton;
2122

    
2123
            if(instanceToggle.IsChecked == true)
2124
            {
2125
                SaveTime(true);
2126
            }
2127
            else
2128
            {
2129
                SaveTime(false);
2130
            }
2131
        }
2132

    
2133
        public void Copy_Start()
2134
        {
2135
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2136
            {
2137
                string MarkupData = "";
2138

    
2139
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2140
                {
2141
                    if (item.GetType().Name == "AdornerFinal")
2142
                    {
2143
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2144

    
2145
                        {
2146
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2147
                            {
2148
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2149
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2150
                            }
2151
                        }
2152
                        Clipboard.SetText(MarkupData);
2153
                    }
2154
                }
2155
            }
2156
        }
2157

    
2158
        public void Cut_Start()
2159
        {
2160
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2161
            {
2162
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2163
                {
2164
                    string MarkupData = "";
2165

    
2166
                    if (item.GetType().Name == "AdornerFinal")
2167
                    {
2168
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2169
                        {
2170
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2171
                            {
2172
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2173
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2174
                            }
2175
                        }
2176
                        Clipboard.SetText(MarkupData);
2177
                    }
2178
                }
2179
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2180
            }
2181
        }
2182

    
2183
        public void Paste_Start()
2184
        {
2185
            //마크업 붙여넣기
2186
            //if (Clipboard.GetText().Contains("|DZ|"))
2187
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2188
            {
2189
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2190

    
2191
                string[] delimiterChars = { "|OR|" };
2192
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2193

    
2194
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
2195

    
2196
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2197

    
2198
                //강인구 Undo/Redo 보류
2199
                UndoData = new Undo_data()
2200
                {
2201
                    IsUndo = false,
2202
                    Event = Event_Type.Create,
2203
                    EventTime = DateTime.Now,
2204
                    Markup_List = new List<Multi_Undo_data>()
2205
                };
2206

    
2207
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2208
                {
2209
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2210
                });
2211

    
2212
                foreach (string parse in data)
2213
                {
2214
                    if (parse != "")
2215
                    {
2216
                        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
2217
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
2218

    
2219
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2220
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2221

    
2222
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2223

    
2224
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2225
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2226

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

    
2229
                        UndoData.Markup_List.Add(multi_Undo_Data);
2230
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2231
                    }
2232
                }
2233
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2234

    
2235
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2236
                {
2237
                    Canvas.SetLeft(final, 0);
2238
                    Canvas.SetTop(final, 0);
2239
                }
2240
                else
2241
                {
2242
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2243
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2244
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2245

    
2246
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2247
                    {
2248
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2249
                    }
2250
                }
2251
                
2252

    
2253
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2254

    
2255
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2256
                //Canvas.SetLeft(final, 50);
2257
                //Canvas.SetTop(final, 50);
2258
            }
2259
            //외부 이미지 붙여넣기
2260
            else if (Clipboard.GetImage() != null)
2261
            {
2262
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2263

    
2264
                //강인구 Undo/Redo 보류
2265
                UndoData = new Undo_data()
2266
                {
2267
                    IsUndo = false,
2268
                    Event = Event_Type.Create,
2269
                    EventTime = DateTime.Now,
2270
                    Markup_List = new List<Multi_Undo_data>()
2271
                };
2272

    
2273

    
2274
                string temppath = System.IO.Path.GetTempPath();
2275
                //string filename = KCOM.Events.Save.shortCommentKey();
2276
                string filename = KCOM.Events.Save.shortFileKey();
2277

    
2278
                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2279
                clipboardImage.Save(temppath + "\\" + filename);
2280

    
2281
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2282
                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2283
                long numByte = fileInfo.Length;
2284
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2285
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2286

    
2287
                if (dLen < 4)
2288
                {
2289
                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2290
                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
2291
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2292
                    byte[] data = br.ReadBytes((int)numByte);
2293

    
2294
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2295
                    br.Close();
2296
                    fStream.Close();
2297
                    fStream.Dispose();
2298
                }
2299
                else
2300
                {
2301
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2302
                    return;
2303
                }
2304

    
2305
                fileInfo.Delete();
2306

    
2307
                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2308
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2309
                IntPtr hBitmap = bmp.GetHbitmap();
2310
                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2311
                Image img = new Image();
2312
                img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2313

    
2314

    
2315

    
2316

    
2317

    
2318
                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2319
                {
2320
                    PointSet = new List<Point>(),
2321
                    FilePath = img.Source.ToString(),
2322
                    ImageData = img.Source,
2323
                    StartPoint = new Point(100, 100),
2324
                    EndPoint = new Point(200, 200),
2325
                    TopRightPoint = new Point(100, 200),
2326
                    LeftBottomPoint = new Point(200, 100)
2327
                };
2328

    
2329
                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2330
                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2331
                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2332

    
2333
                currentControl.PointSet = new List<Point>
2334
                                        {
2335
                                            currentControl.StartPoint,
2336
                                            currentControl.LeftBottomPoint,
2337
                                            currentControl.EndPoint,
2338
                                            currentControl.TopRightPoint,
2339
                                        };
2340

    
2341
                multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2342
                UndoData.Markup_List.Add(multi_Undo_Data);
2343
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2344

    
2345
                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2346
                currentControl.CommentID = Events.Save.shortGuid();
2347

    
2348
                currentControl.ApplyTemplate();
2349
                currentControl.SetImage();
2350

    
2351
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2352
                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2353
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2354

    
2355
                double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2356
                double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2357
                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2358
            }
2359
        }
2360

    
2361
        public void Delete_Start()
2362
        {
2363
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2364
            {
2365
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2366

    
2367
                UndoData = new Undo_data()
2368
                {
2369
                    IsUndo = false,
2370
                    Event = Event_Type.Delete,
2371
                    EventTime = DateTime.Now,
2372
                    Markup_List = new List<Multi_Undo_data>()
2373
                };
2374

    
2375
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2376
                {
2377
                    if (item.GetType().Name == "AdornerFinal")
2378
                    {
2379
                        (item as Controls.AdornerFinal).unRegister();
2380

    
2381
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2382
                        {
2383
                            //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2384
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
2385
                            {
2386

    
2387
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
2388
                                UndoData.Markup_List.Add(multi_Undo_Data);
2389
                                multi_Undo_Data = new Multi_Undo_data();
2390

    
2391
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
2392

    
2393
                                var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
2394

    
2395
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
2396
                            }
2397
                        }
2398
                    }
2399

    
2400
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2401
                    {
2402
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2403
                    });
2404
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2405
                }
2406
            }
2407
            this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2408
        }
2409

    
2410
    }
2411
}
클립보드 이미지 추가 (최대 크기: 500 MB)