프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 999c9e40

이력 | 보기 | 이력해설 | 다운로드 (113 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
                //Console.WriteLine("세이브 실시");
245

    
246
                SaveEvent(null, null);
247
            }
248

    
249
        }
250

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

    
260
            if (IsRun)
261
            {
262
                SaveTimer.Start();
263
            }
264
            else
265
            {
266
                SaveTimer.Stop();
267
            }
268
        }
269

    
270
        public void SaveEvent(object sender, RoutedEventArgs e)
271
        {
272
            this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
273

    
274
            this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
275

    
276
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
277

    
278
            //콘솔리 데잇일 경우 
279
            //if (ViewerDataModel.Instance.IsConsolidate && menu.gridViewMarkup.SelectedItems.Count > 1)
280
            if (ViewerDataModel.Instance.IsConsolidate)
281
            {
282
                ViewerDataModel.Instance.IsConsolidate = false;
283
                return;
284
            }
285

    
286
            //코멘트가 없을 경우
287
            //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0)
288
            //{
289
            //    foreach (var item in menu.gridViewMarkup.SelectedItems)
290
            //    {
291
            //        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
292
            //        {
293
            //            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
294
            //            return;
295
            //        }
296
            //    }
297
            //}
298

    
299
            //코멘트가 없을 경우
300
            if (ViewerDataModel.Instance.MarkupList_USER.Count == 0)
301
            {
302
                foreach (var item in menu.gridViewMarkup.SelectedItems)
303
                {
304
                    if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
305
                    {
306
                        this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
307
                        return;
308
                    }
309
                }
310
            }
311

    
312
            //코멘트가 없을 경우
313
            //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0)
314
            //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0 && menu.gridViewMarkup.SelectedItems.Count == 0)
315
            //{
316
            //    foreach (var item in menu.gridViewMarkup.SelectedItems)
317
            //    {
318
            //        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
319
            //        {
320
            //            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
321
            //            return;
322
            //        }
323
            //    }
324
            //}
325

    
326
            menu.ChangeCommentReact();
327

    
328
            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
329
            {
330
                RefactoryCommentReact(menu);
331
            }
332
            else if(menu.gridViewMarkup.SelectedItems.Count == 0)
333
            {
334
                this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
335
                return;
336
            }
337
            //else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as  IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
338
            //{
339
            //    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
340
            //    return;
341
            //}
342
            //강인구 변경
343
            else
344
            {
345
                foreach (var item in menu.gridViewMarkup.SelectedItems)
346
                {
347
                    if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
348
                    {
349
                        RefactoryCommentReact(menu);
350
                        ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
351

    
352
                        menu.gridViewMarkup.ItemsSource = null;
353
                        menu.gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
354
                        menu.gridViewMarkup.SelectedItem = item;
355

    
356
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
357
                        return;
358
                    }
359
                }
360
                ////강인구 변경
361
                //this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
362
            }
363
            this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
364
        }
365

    
366
		public void RefactoryCommentReact(MainMenu menu)
367
        {
368
            this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
369

    
370
            Save save = new Save();
371

    
372
            //강인구 추가
373
            List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
374

    
375
            foreach(var item in menu.gridViewMarkup.SelectedItems)
376
            {
377
                if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
378
                {
379
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
380
                }
381
            }
382

    
383
            //MySelectItem = (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
384

    
385

    
386
            save.Project_No = App.ViewInfo.ProjectNO;
387
            save.document_id = App.ViewInfo.DocumentItemID;
388
            save.user_id = App.ViewInfo.UserID;
389
            save.page_no = Convert.ToInt32(tlcurrentPage.Text);
390

    
391
            try
392
            {
393
                menu.ChangeCommentReact();
394
                if (menu.PreviewUserMarkupInfoItem != null) //신규 코멘트인지(MarkupInfo가 없는 경우)
395
                {
396
                    if (menu.gridViewMarkup.SelectedItems.FirstOrDefault() != null) //복수 페이지 혹은 저장한 경우
397
                    {
398
                        foreach(var item in MySelectItem)
399
                        {
400
                            save.MarkupSave(item);
401
                        }
402
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
403
                    }
404
                    else  //단일 페이지인 경우
405
                    {
406
                        //menu.ChangeCommentReact();
407
                        foreach (var item in MySelectItem)
408
                        {
409
                            save.MarkupSave(item);
410
                        }
411
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
412
                    }
413
                }
414
                else //기존 코멘트에 작업하는 경우
415
                {
416
                    if (menu.gridViewMarkup.SelectedItems.FirstOrDefault() != null)
417
                    {
418
                        foreach (var item in MySelectItem)
419
                        {
420
                            save.MarkupSave(item);
421
                        }
422
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
423
                    }
424
                }
425
                using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
426
                {
427
                    KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE();
428

    
429

    
430
                    ViewerDataModel.Instance.Document_Info.OrderBy(i => i.PAGE_NUMBER).ToList().ForEach(data =>
431
                    {
432
                        _docpage = (from info in Entity.DOCPAGE
433
                                    where info.ID == data.ID
434
                                    select info).FirstOrDefault();
435

    
436
                        if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE)
437
                        {
438
                            _docpage.PAGE_ANGLE = data.PAGE_ANGLE;
439
                        }
440
                    });
441

    
442
                    Entity.SaveChanges();
443
                }
444
            }
445
            catch (Exception ex)
446
            {
447
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("세이브 실패", "Alert");
448
                //MessageBox.Show("세이브 실패 : " + ex.Message);
449
            }
450
        }
451

    
452
        //강인구 추가
453
        public void Print_Start(string Type)
454
        {
455

    
456
            if(ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
457
            {
458
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
459
                menu.ReleaseAdorner();
460
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
461
                {
462
                    RefactoryCommentReact(menu);
463
                }
464
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
465
                {
466

    
467
                }
468
                else
469
                {
470
                    RefactoryCommentReact(menu);
471
                }
472
            }
473

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

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

    
488
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
489

    
490
            using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
491
            {
492
                var docinfo = from info in Entity.DOCINFO
493
                              where info.DOCUMENT_ID == App.ViewInfo.DocumentItemID
494
                              && info.PROJECT_NO == App.ViewInfo.ProjectNO
495
                              select info;
496

    
497
                var docitem = docinfo.First();
498

    
499
                foreach (KCOMDataModel.DataModel.MARKUP_INFO markinfo in docitem.MARKUP_INFO)
500
                {
501
                    var member = (from mem in Entity.MEMBER
502
                                  where mem.ID == markinfo.USER_ID
503
                                  select mem).First();
504

    
505
                    _result = new IKCOM.MarkupInfoItem
506
                    {
507
                        MarkupInfoID = markinfo.ID,
508
                        Consolidate = markinfo.CONSOLIDATE,
509
                        CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME,
510
                        DisplayColor = SetColor(markinfo.ID),
511
                        UserID = markinfo.USER_ID,
512
                        UserName = member.NAME,
513
                        Depatment = member.DEPARTMENT,
514
                    };
515

    
516
                    _result.MarkupList = new List<IKCOM.MarkupItem>();
517
                    var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First();
518

    
519
                    foreach (KCOMDataModel.DataModel.MARKUP_DATA markdata in markup_Version.MARKUP_DATA)
520
                    {
521
                        IKCOM.MarkupItem markitem = new IKCOM.MarkupItem()
522
                        {
523
                            ID = markdata.ID,
524
                            PageNumber = markdata.PAGENUMBER,
525
                        };
526
                        _result.MarkupList.Add(markitem);
527
                    }
528

    
529
                    _result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count();
530

    
531
                    markupinfo.Add(_result);
532
                }
533

    
534

    
535
                
536
                //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);
537

    
538
                //강인구 추가 
539
                var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/", 
540
                    App.SystemInfo.HostName,
541
                    App.ViewInfo.ProjectNO,
542
                    (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
543
                    App.ViewInfo.DocumentItemID
544
                    );
545

    
546

    
547
                PrintWindow.Content = new KCOM.Control.PrintControl(
548
                          Tile_Url,
549
                          docitem.PROJECT_NO,
550
                          docitem, markupinfo,
551
                          this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
552
                          docitem.DOCUMENT_ID,
553
                          this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
554
                          docitem.ORIGINAL_FILE, isprint);
555

    
556
                //http://cloud.devdoftech.co.kr:5977/TileSource/000000_Tile/111111/11111111/1.jpg
557
            }
558

    
559
            //프린트 팝업 옵션
560
            //PrintWindow.BorderThickness = new Thickness(3);
561
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
562
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
563
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
564
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
565
            PrintWindow.Background.Opacity = 0.6;
566

    
567
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
568
            //Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.Office2013Theme());
569
            PrintWindow.ShowDialog();
570
        }
571

    
572
        //강인구 추가
573
        private void PrintEvent(object sender, RoutedEventArgs e)
574
        {
575
            RadRibbonButton button = sender as RadRibbonButton;
576
            Print_Start(button.Content.ToString());
577
        }
578

    
579
        private List<AdornerMember> GetAdornerItem()
580
        {
581
            List<AdornerMember> AdonerList = new List<AdornerMember>();
582

    
583
            if (this.ParentOfType<MainWindow>() != null)
584
            {
585
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
586
                {
587
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
588
                    {
589
                        if (item.GetType().Name == "AdornerFinal")
590
                        {
591
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
592
                            {
593
                                AdonerList.Add(InnerItem);
594
                            }
595
                        }
596
                    }
597
                }
598
            }
599
            return AdonerList;
600
        }
601
        /// <summary>
602
        /// 투명도
603
        /// </summary>
604
        /// <param name="sender"></param>
605
        /// <param name="e"></param>
606
        //강인구 추가(Undo End)
607
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
608
        {
609
            List<AdornerMember> AdonerList = GetAdornerItem();
610
            if(AdonerList.Count > 0)
611
            {
612
                Undo_data UndoData = new Undo_data()
613
                {
614
                    IsUndo = false,
615
                    Event = Event_Type.Option,
616
                    EventTime = DateTime.Now,
617
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
618
                    Markup_List = new List<Multi_Undo_data>()
619
                };
620
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
621

    
622
                foreach (AdornerMember InnerItem in AdonerList)
623
                {
624
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
625
                  
626
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
627
                    UndoData.Markup_List.Add(multi_Undo_Data);
628
                    multi_Undo_Data = new Multi_Undo_data();
629
                }
630

    
631
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
632
                {
633
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
634
                });
635
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
636
            }
637
        }
638

    
639
        //강인구 추가(Undo End)
640
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
641
        {
642
            List<AdornerMember> AdonerList = GetAdornerItem();
643
            if (AdonerList.Count > 0)
644
            {
645
                Undo_data UndoData = new Undo_data()
646
                {
647
                    IsUndo = false,
648
                    Event = Event_Type.Option,
649
                    EventTime = DateTime.Now,
650
                    LineSize = ViewerDataModel.Instance.LineSize,
651
                    Markup_List = new List<Multi_Undo_data>()
652
                };
653
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
654

    
655
                foreach (AdornerMember InnerItem in AdonerList)
656
                {
657
                    switch (InnerItem.DrawingData.GetType().Name)
658
                    {
659
                        case ("LineControl"):
660
                            {
661
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
662
                            }
663
                            break;
664
                        case ("ArcControl"):
665
                            {
666
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
667
                            }
668
                            break;
669
                        case ("ArrowControl_Multi"):
670
                            {
671
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
672
                            }
673
                            break;
674
                        case ("CloudControl"):
675
                            {
676
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
677
                            }
678
                            break;
679
                        case ("PolygonControl"):
680
                            {
681
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
682
                            }
683
                            break;
684
                        case ("RectangleControl"):
685
                            {
686
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
687
                            }
688
                            break;
689
                        case ("RectCloudControl"):
690
                            {
691
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
692
                            }
693
                            break;
694
                        case ("TriControl"):
695
                            {
696
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
697
                            }
698
                            break;
699
                        case ("CircleControl"):
700
                            {
701
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
702
                            }
703
                            break;
704
                    }
705
                    
706

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

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

    
720

    
721
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
722
        {
723
            List<AdornerMember> AdonerList = GetAdornerItem();
724
            if (AdonerList.Count > 0)
725
            {
726

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

    
737
                foreach (AdornerMember InnerItem in AdonerList)
738
                {
739
                    switch (InnerItem.DrawingData.GetType().Name)
740
                    {
741
                        case ("LineControl"):
742
                            {
743
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
744

    
745
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
746
                                UndoData.Markup_List.Add(multi_Undo_Data);
747
                                multi_Undo_Data = new Multi_Undo_data();
748
                            }
749
                            break;
750
                    }
751
                }
752

    
753
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
754
                {
755
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
756
                });
757
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
758
            }
759
        }
760

    
761
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
762
        {
763
            List<AdornerMember> AdonerList = GetAdornerItem();
764
            if (AdonerList.Count > 0)
765
            {
766

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

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

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

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

    
802
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
803
                //{
804
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
805
                //});
806
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
807
            }
808
        }
809

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

    
829
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
830
                    {
831
                        if (item.GetType().Name == "AdornerFinal")
832
                        {
833
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
834
                            {
835
                                switch (InnerItem.DrawingData.GetType().Name)
836
                                {
837
                                    case ("LineControl"):
838
                                        {
839
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
840
                                        }
841
                                        break;
842
                                    case ("ArcControl"):
843
                                        {
844
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
845
                                        }
846
                                        break;
847
                                    case ("ArrowControl_Multi"):
848
                                        {
849
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
850
                                        }
851
                                        break;
852
                                    case ("CloudControl"):
853
                                        {
854
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
855
                                        }
856
                                        break;
857
                                    case ("PolygonControl"):
858
                                        {
859
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
860
                                        }
861
                                        break;
862
                                    case ("RectangleControl"):
863
                                        {
864
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
865
                                        }
866
                                        break;
867
                                    case ("RectCloudControl"):
868
                                        {
869
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
870
                                        }
871
                                        break;
872
                                    case ("TriControl"):
873
                                        {
874
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
875
                                        }
876
                                        break;
877
                                    case ("CircleControl"):
878
                                        {
879
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
880
                                        }
881
                                        break;
882
                                }
883

    
884
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
885
                                UndoData.Markup_List.Add(multi_Undo_Data);
886
                                multi_Undo_Data = new Multi_Undo_data();
887
                            }
888

    
889
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
890
                            {
891
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
892
                            });
893
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
894
                        }
895
                    }
896
                }
897
            }
898
        }
899

    
900
        //강인구 추가
901
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
902
        {
903
            //if (this.ParentOfType<MainWindow>() != null)
904
            //{
905
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
906
            //    {
907
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
908
            //        {
909
            //            if (item.GetType().Name == "AdornerFinal")
910
            //            {
911
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
912
            //                {
913
            //                    switch (InnerItem.DrawingData.GetType().Name)
914
            //                    {
915
            //                        case ("TextControl"):
916
            //                            {
917
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
918
            //                            }
919
            //                            break;
920
            //                        case ("ArrowTextControl"):
921
            //                            {
922
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
923
            //                            }
924
            //                            break;
925
            //                    }
926
            //                }
927
            //            }
928
            //        }
929
            //    }
930
            //}
931
        }
932

    
933
        //강인구 추가
934
        private void btnBold_Checked(object sender, RoutedEventArgs e)
935
        {
936
            if (this.ParentOfType<MainWindow>() != null)
937
            {
938
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
939
                {
940
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
941
                    {
942
                        if (item.GetType().Name == "AdornerFinal")
943
                        {
944
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
945
                            {
946
                                switch (InnerItem.DrawingData.GetType().Name)
947
                                {
948
                                    case ("TextControl"):
949
                                        {
950
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
951
                                            {
952
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
953
                                            }
954
                                            else
955
                                            {
956
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
957
                                            }
958

    
959
                                        }
960
                                        break;
961
                                    case ("ArrowTextControl"):
962
                                        {
963
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
964
                                            {
965
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
966
                                            }
967
                                            else
968
                                            {
969
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
970
                                            }
971
                                        }
972
                                        break;
973
                                }
974
                            }
975
                        }
976
                    }
977
                }
978
            }
979
        }
980

    
981
        //강인구 추가
982
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
983
        {
984
            if (this.ParentOfType<MainWindow>() != null)
985
            {
986
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
987
                {
988
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
989
                    {
990
                        if (item.GetType().Name == "AdornerFinal")
991
                        {
992
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
993
                            {
994
                                switch (InnerItem.DrawingData.GetType().Name)
995
                                {
996
                                    case ("TextControl"):
997
                                        {
998
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
999
                                            {
1000
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1001
                                            }
1002
                                            else
1003
                                            {
1004
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1005
                                            }
1006

    
1007
                                        }
1008
                                        break;
1009
                                    case ("ArrowTextControl"):
1010
                                        {
1011
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1012
                                            {
1013
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1014
                                            }
1015
                                            else
1016
                                            {
1017
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1018
                                            }
1019
                                        }
1020
                                        break;
1021
                                }
1022
                            }
1023
                        }
1024
                    }
1025
                }
1026
            }
1027
        }
1028

    
1029
        //강인구 추가
1030
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1031
        {
1032
            if (this.ParentOfType<MainWindow>() != null)
1033
            {
1034
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1035
                {
1036
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1037
                    {
1038
                        if (item.GetType().Name == "AdornerFinal")
1039
                        {
1040
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1041
                            {
1042
                                switch (InnerItem.DrawingData.GetType().Name)
1043
                                {
1044
                                    case ("TextControl"):
1045
                                        {
1046
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1047
                                            {
1048
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1049
                                            }
1050
                                            else
1051
                                            {
1052
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1053
                                            }
1054
                                        }
1055
                                        break;
1056
                                    case ("ArrowTextControl"):
1057
                                        {
1058
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1059
                                            {
1060
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1061
                                            }
1062
                                            else
1063
                                            {
1064
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1065
                                            }
1066
                                        }
1067
                                        break;
1068
                                }
1069
                            }
1070
                        }
1071
                    }
1072
                }
1073
            }
1074
        }
1075

    
1076
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1077
        {
1078
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1079
        }
1080

    
1081
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1082
        {
1083
            if (this.ParentOfType<MainWindow>() != null)
1084
            {
1085
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1086
                {
1087
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1088
                    {
1089
                        if (item.GetType().Name == "AdornerFinal")
1090
                        {
1091
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1092
                            {
1093
                                switch (InnerItem.DrawingData.GetType().Name)
1094
                                {
1095
                                    case ("TextControl"):
1096
                                        {
1097
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1098
                                        }
1099
                                        break;
1100
                                    case ("ArrowTextControl"):
1101
                                        {
1102
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1103
                                        }
1104
                                        break;
1105
                                }
1106
                            }
1107
                        }
1108
                    }
1109
                }
1110
            }
1111
        }
1112

    
1113
        //강인구 추가
1114
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1115
        {
1116
            if (this.ParentOfType<MainWindow>() != null)
1117
            {
1118
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1119
                {
1120
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1121
                    {
1122
                        if (item.GetType().Name == "AdornerFinal")
1123
                        {
1124
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1125
                            {
1126
                                switch (InnerItem.DrawingData.GetType().Name)
1127
                                {
1128
                                    case ("TextControl"):
1129
                                        {
1130
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1131
                                            //{
1132
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily = new FontFamily(comboFontFamily.Text);
1133
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1134
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1135
                                            //}
1136
                                            //else
1137
                                            //{
1138
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1139
                                            //}
1140
                                        }
1141
                                        break;
1142
                                    case ("ArrowTextControl"):
1143
                                        {
1144
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1145
                                            //{
1146
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1147
                                            //}
1148
                                            //else
1149
                                            //{
1150
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1151
                                            //}
1152
                                        }
1153
                                        break;
1154
                                }
1155
                            }
1156
                        }
1157
                    }
1158
                }
1159
            }
1160
        }
1161

    
1162
        /// <summary>
1163
        /// 텍스트 컨트롤 하일라이트 처리
1164
        /// </summary>
1165
        /// <param name="sender"></param>
1166
        /// <param name="e"></param>
1167
        private void HighlightEvent(object sender, RoutedEventArgs e)
1168
        {
1169

    
1170
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1171
            SetHighlightEvent();
1172
            //if ((sender as CheckBox).IsChecked.Value)
1173
            //{
1174
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1175
            //}
1176
            //else
1177
            //{
1178
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1179
            //}
1180
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1181
            //{
1182
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1183
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1184
            //    instance.SetText();
1185
            //}
1186
        }
1187

    
1188
        //강인구 추가페이지 이동 엔터
1189
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1190
        {
1191
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1192
            if (e.Key == Key.Enter)
1193
            {
1194
                try
1195
                {
1196
                    var instanceMain = this.ParentOfType<MainWindow>();
1197
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1198
                }
1199
                catch (Exception)
1200
                {
1201
                    RadWindow.Alert(new DialogParameters
1202
                    {
1203
                        Theme = new VisualStudio2013Theme(),
1204
                        Header = "안내",
1205
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1206
                    });
1207
                }
1208
                
1209
            }
1210
        }
1211

    
1212
        public event EventHandler<WindowClosedEventArgs> Closed;
1213

    
1214
        //private void CheckEvent(object sender, RoutedEventArgs e)
1215
        //{
1216
        //    RadWindow CheckPop = new RadWindow();
1217
        //    test check = new test();
1218

    
1219
        //    CheckPop = new RadWindow
1220
        //    {
1221
        //        Width = 1700,
1222
        //        Height = 510,
1223
        //        Header = "My Check List",
1224
        //        Content = check,
1225
        //        Owner = this,
1226
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1227
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1228
        //    };
1229
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1230

    
1231
        //    CheckPop.Closed += CheckPop_Closed;
1232
        //    CheckPop.ShowDialog();
1233
        //}
1234

    
1235
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1236
        {
1237
            PanoramaShow();
1238
        }
1239

    
1240
        public void PanoramaShow()
1241
        {
1242
            Panorama check = new Panorama();
1243
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1244
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1245
            //double windowWidth = this.Width;
1246
            //double windowHeight = this.Height;
1247

    
1248
            var PanoramaPop = new RadWindow
1249
            {
1250
                //MinWidth = 600,
1251
                //MinHeight = 400,
1252
                //Header = "My Check List",
1253
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1254
                Content = check,
1255
                Owner = this,
1256
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1257
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1258
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1259
                IsTopmost = false,
1260
                //Left = (screenWidth / 2) - (windowWidth / 2),
1261
                //Top = (screenHeight / 2) - (windowHeight / 2),
1262
                //Left = (screenWidth / 2),
1263
                //Top = (screenHeight / 2),
1264
                Width = screenWidth * 0.4,
1265
                Height = screenHeight * 0.4,
1266
            };
1267
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1268
            //CheckPop.ShowDialog();
1269
            PanoramaPop.Show();
1270
        }
1271

    
1272
        private void CheckEvent(object sender, RoutedEventArgs e)
1273
        {
1274
            //창이 떠있을 경우 재 실행 방지
1275
            if (isClosed)
1276
            {
1277
                //토글 및 마우스 상태 초기화
1278
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1279
                foreach(var togle in toggleList)
1280
                {
1281
                    togle.IsChecked = false;
1282
                }
1283
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1284

    
1285
                isClosed = false;
1286

    
1287
                
1288
                CheckList check = new CheckList();
1289

    
1290
                CheckPop = new RadWindow
1291
                {
1292
                    MinWidth = 1200,
1293
                    MinHeight = 500,
1294
                    //Header = "My Check List",
1295
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1296
                    Content = check,
1297
                    //Owner = this,
1298
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1299
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1300
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1301
                    IsTopmost = true,
1302
                };
1303
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1304
                CheckPop.Closed += CheckPop_Closed;
1305
                
1306
                //CheckPop.ShowDialog();
1307
                CheckPop.Show();
1308
            }
1309
        }
1310

    
1311
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1312
        {
1313
            isClosed = true;
1314
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1315
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1316
            ViewerDataModel.Instance.Capture_Opacity = 0;
1317
        }
1318

    
1319
        private void PageGoEvent(object sender, RoutedEventArgs e)
1320
        {
1321
            RadButton button = sender as RadButton;
1322
            var instanceMain = this.ParentOfType<MainWindow>();
1323
            
1324
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1325
            try
1326
            {
1327
                switch (button.CommandParameter.ToString())
1328
                {
1329
                    case "Down":
1330
                        {
1331
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1332
                        }
1333
                        break;
1334
                    case "Up":
1335
                        {
1336
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1337
                        }
1338
                        break;
1339
                }
1340
            }
1341
            catch (Exception)
1342
            {
1343
                RadWindow.Alert(new DialogParameters
1344
                {
1345
                    Theme = new VisualStudio2013Theme(),
1346
                    Header = "안내",
1347
                    Content = "페이지 번호를 정확하게 입력해 주세요",
1348
                });
1349
            }
1350
        }
1351

    
1352
        private void viewEvent(object sender, RoutedEventArgs e)
1353
        {
1354
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1355
            var instanceMain = this.ParentOfType<MainWindow>();
1356

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

    
1359
            //if ((sender as RadRibbonToggleButton) != null)
1360
            //{
1361
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1362
            //    instanceToggle = (sender as RadRibbonToggleButton);
1363
            //}
1364

    
1365
            //instanceToggle.IsChecked = false;
1366

    
1367
            switch (viewButton.CommandParameter.ToString())
1368
            {
1369
                case "zoomout":
1370
                    {
1371
                        //장원
1372
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1373
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1374
                        viewButton.IsChecked = false;
1375
                        //Common.ViewerDataModel.Instance.zom
1376
                    }
1377
                    break;
1378
                case "zoomin":
1379
                    {
1380
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1381
                        viewButton.IsChecked = false;
1382
                    }
1383
                    break;
1384
                case "fullscreen":
1385
                    {
1386
                        instanceMain.WindowState = WindowState.Maximized;
1387
                        //Sizemode 대기(강인구)
1388
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1389
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1390
                        viewButton.IsChecked = false;
1391
                    }
1392
                    break;
1393
                case "fitWidth":
1394
                    {
1395
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1396
                        viewButton.IsChecked = false;
1397
                    }
1398
                    break;
1399
                case "fitHeight":
1400
                    {
1401
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1402
                        viewButton.IsChecked = false;
1403
                    }
1404
                    break;
1405
                case "boundzoom":
1406
                    {
1407

    
1408
                    }
1409
                    break;
1410
                case "Rotate_M":
1411
                    {
1412
                        drawingPannelRotate(false);
1413
                        viewButton.IsChecked = false;
1414
                    }
1415
                    break;
1416
                case "Rotate_P":
1417
                    {
1418
                        drawingPannelRotate(true);
1419
                        viewButton.IsChecked = false;
1420
                    }
1421
                    break;
1422
                case "Rotate_half":
1423
                    {
1424
                        drawingPannelRotate(true);
1425
                        drawingPannelRotate(true);
1426
                        viewButton.IsChecked = false;
1427
                    }
1428
                    break;
1429
            }
1430
        }
1431

    
1432
        private void Control_Event(object sender, RoutedEventArgs e)
1433
        {
1434

    
1435
        }
1436

    
1437
        #region 대기
1438

    
1439
        public void drawingPannelRotate(bool Flag)
1440
        {
1441
            var instanceMain = this.ParentOfType<MainWindow>();
1442

    
1443
            //if (rotateOffSet > 3)
1444
            //    rotateOffSet = 0;
1445

    
1446
            //if (rotateOffSet < 0)
1447
            //    rotateOffSet = 3;
1448

    
1449
            if(Flag)
1450
            {
1451
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1452
                {
1453
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1454
                }
1455
                else
1456
                {
1457
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1458
                }
1459
            }
1460
            else
1461
            {
1462
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1463
                {
1464
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1465
                }
1466
                else
1467
                {
1468
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1469
                }
1470
            }
1471
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1472
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1473
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1474

    
1475
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1476
            {
1477
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1478
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1479
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1480
            }
1481
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1482
            {
1483
                instanceMain.dzMainMenu.translate.X = 0;
1484
                instanceMain.dzMainMenu.translate.Y = 0;
1485
            }
1486
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1487
            {
1488
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1489
                instanceMain.dzMainMenu.translate.Y = 0;
1490
            }
1491
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1492
            {
1493
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1494
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1495
            }
1496
            else
1497
            {
1498
                instanceMain.dzMainMenu.translate.X = 0;
1499
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1500
            }
1501

    
1502
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1503
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1504
            //대기(강인구)
1505
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1506

    
1507

    
1508
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1509
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1510
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1511

    
1512

    
1513
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1514
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1515
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1516
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1517
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1518
            //ViewerDataModel.Instance.Document_Info.Clear();
1519
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1520
            //{
1521
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1522
            //});
1523

    
1524

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

    
1530
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1531
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1532
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1533

    
1534
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1535
            });
1536
        }
1537
        #endregion
1538

    
1539
        private void ImageConverter()
1540
        {
1541
            var instanceMain = this.ParentOfType<MainWindow>();
1542
            //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1543

    
1544

    
1545
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1546
            dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1547
            Nullable<bool> result = dlg.ShowDialog();
1548
            if (result == true)
1549
            {
1550
                instanceMain.dzMainMenu.filename = dlg.FileName;
1551
                instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1552

    
1553
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1554
                String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1555
                long numByte = fileInfo.Length;
1556
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1557
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1558

    
1559
                if (dLen < 4)
1560
                {
1561
                    System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1562
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1563
                    byte[] data = br.ReadBytes((int)numByte);
1564
                    br.Close();
1565

    
1566
                    instanceMain.dzMainMenu.filename = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1567
                    fStream.Close();
1568
                    fStream.Dispose();
1569
                }
1570
                else
1571
                {
1572
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1573
                }
1574
            }
1575
        }
1576

    
1577
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1578
        {
1579

    
1580
        }
1581

    
1582
        private void ControlEvent(object sender, RoutedEventArgs e)
1583
        {
1584
            RadToggleButton instanceToggle = sender as RadToggleButton;
1585
            var instanceMain = this.ParentOfType<MainWindow>();
1586

    
1587
            #region Ctrl + A 눌렀을 때 대처 방법 
1588
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1589
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1590
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1591
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1592
            {
1593
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1594
                //foreach (var item in lstItem)
1595
                //{
1596
                //    foreach (var member in item.MemberSet)
1597
                //    {
1598
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1599
                //        {
1600
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1601
                //        }
1602
                //    }
1603
                //}
1604
            }
1605
            #endregion
1606

    
1607
            //if (!instanceMain.IsFreeSelectionMode)
1608
            //{
1609
            //    instanceMain.IsSwingMode = true;
1610
            //}
1611

    
1612
            #region 다른 컨트롤 버튼 선택 해제
1613
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1614
            {
1615
                if (ControlState == null)
1616
                {
1617
                    instanceToggle.IsChecked = false;
1618
                    HiddenControlHide();
1619
                }
1620
            });
1621
            #endregion
1622

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

    
1625
            if (instanceToggle != null)
1626
            {
1627
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1628
            }
1629
            else if ((sender as RadRibbonToggleButton) != null)
1630
            {
1631
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1632
                instanceToggle = (sender as RadRibbonToggleButton);
1633
            }
1634
            else if ((sender as RadRibbonButton) != null)
1635
            {
1636
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1637
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1638
            }
1639
            else
1640
            {
1641
                RadButton instanceButton = sender as RadButton;
1642
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1643
            }
1644

    
1645

    
1646

    
1647
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1648
            {
1649
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1650
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1651
                {
1652
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1653
                });
1654
            });
1655
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1656

    
1657
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1658

    
1659
            if (instanceToggle.IsChecked != false)
1660
            {
1661
                #region 컨트롤이 체크되었다면
1662
                switch (instanceToggle.CommandParameter.ToString())
1663
                {
1664
                    #region Line
1665
                    case "Line":
1666
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
1667
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1668
                        if (instanceToggle.Tag.ToString() == "LineDelete")
1669
                        {
1670
                            //HiddenInterval.Visibility = Visibility.Visible;
1671
                        }
1672
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
1673
                        break;
1674
                    #endregion
1675
                    #region ChainLine
1676
                    case "ChainLine":
1677
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
1678
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1679
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
1680
                        break;
1681
                    #endregion
1682
                    #region DimLine
1683
                    case "DimLine":
1684
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
1685
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1686
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
1687
                        break;
1688
                    #endregion
1689
                    #region TwinLine
1690
                    case "TwinLine":
1691
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
1692
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1693
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
1694
                        break;
1695
                    #endregion
1696
                    #region CancelLine
1697
                    case "CancelLine":
1698
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
1699
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1700
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
1701
                        break;
1702
                    #endregion
1703
                    #region PolygonCloud
1704
                    case "PolygonCloud":
1705
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
1706
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1707
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
1708
                        break;
1709
                    #endregion
1710
                    #region RectCloud
1711
                    case "RectCloud":
1712
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
1713
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1714
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
1715
                        break;
1716
                    #endregion
1717
                    #region Rectangle
1718
                    case "Rectangle":
1719
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
1720
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1721
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
1722
                        break;
1723
                    #endregion
1724
                    #region Triangle
1725
                    case "Triangle":
1726
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
1727
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1728
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
1729
                        break;
1730
                    #endregion
1731
                    #region RectCloud
1732
                    case "Circle":
1733
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
1734
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1735
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
1736
                        break;
1737
                    #endregion
1738
                    #region Symbol
1739
                    case "Symbol":
1740
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
1741
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1742
                        break;
1743
                    #endregion
1744
                    #region SymbolN
1745
                    case "SymbolN":
1746
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
1747
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
1748
                        break;
1749
                    #endregion
1750
                    #region Text
1751
                    case "Text":
1752
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
1753
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1754
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
1755
                        break;
1756
                    #endregion
1757
                    #region TextBorder
1758
                    case "TextBorder":
1759
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
1760
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1761
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
1762
                        break;
1763
                    #endregion
1764
                    #region TextCloud
1765
                    case "TextCloud":
1766
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
1767
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1768
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
1769
                        break;
1770
                    #endregion
1771
                    #region Date
1772
                    case "Date":
1773
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
1774
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
1775
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
1776
                        break;
1777
                    #endregion
1778
                    #region ArrowText
1779
                    case "ArrowText":
1780
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
1781
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
1782
                        {
1783
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
1784
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
1785
                        }
1786
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
1787
                        {
1788
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
1789
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
1790
                        }
1791
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
1792
                        {
1793
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
1794
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
1795
                        }
1796
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
1797
                        {
1798
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
1799
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
1800
                        }
1801
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
1802
                        {
1803
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
1804
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
1805
                        }
1806
                        else
1807
                        {
1808
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
1809
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
1810
                            //HiddenAxisLock.Visibility = Visibility.Visible;
1811
                        }
1812
                        break;
1813
                    #endregion
1814
                    #region Arrow
1815
                    case "Arrow":
1816
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
1817
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1818
                        //HiddenDimSize.Visibility = Visibility.Visible;
1819
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
1820
                        break;
1821
                    #endregion
1822
                    #region Shape
1823
                    case "Shape":
1824
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
1825
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
1826
                        break;
1827
                    #endregion
1828
                    #region Polygon
1829
                    case "Polygon":
1830
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
1831
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
1832
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1833
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
1834
                        break;
1835
                    #endregion
1836
                    #region Arc
1837
                    case "Arc":
1838
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
1839
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
1840
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1841
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1842
                        break;
1843
                    #endregion
1844
                    #region ArrowMulti
1845
                    case "ArrowMulti":
1846
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
1847
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
1848
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1849
                        break;
1850
                    #endregion
1851
                    #region Etc
1852
                    case "Etc":
1853
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
1854
                        break;
1855
                    #endregion
1856
                    #region Ink
1857
                    case "Ink":
1858
                        if (instanceToggle.Tag.ToString() == "EraserClear")
1859
                        {
1860
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1861
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
1862
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
1863
                        }
1864
                        else if (instanceToggle.Tag.ToString() == "Eraser")
1865
                        {
1866
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1867
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
1868
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
1869
                        }
1870
                        else
1871
                        {
1872
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
1873
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
1874
                        }
1875

    
1876
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1877

    
1878
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
1879
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
1880
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
1881
                        break;
1882
                    #endregion
1883
                    #region Select
1884
                    case "Select":
1885
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
1886
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1887
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
1888
                        break;
1889
                    #endregion
1890
                    #region Image
1891
                    case "Image":
1892
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
1893
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1894
                        ImageConverter();
1895
                        break;
1896
                    #endregion
1897
                    #region Sign
1898
                    case "Sign":
1899
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
1900
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
1901
                        //강인구 추가
1902
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
1903
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
1904
                        //{
1905
                        //    if (ea.Result == null)
1906
                        //    {
1907

    
1908
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
1909
                        //    }
1910
                        //    else
1911
                        //    {
1912
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
1913
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
1914
                        //        {
1915
                        //            BitmapImage im = new BitmapImage();
1916
                        //            im.SetSource(ms);
1917
                        //            instanceMain.DeepLayer.SignImage = im;
1918
                        //            ms.Close();
1919
                        //        }
1920
                        //    }
1921
                        //};
1922
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
1923
                        break;
1924
                    #endregion
1925
                    #region Check
1926
                    case "Check":
1927
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
1928
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
1929
                        //강인구 추가
1930
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
1931
                        break;
1932
                    #endregion
1933
                    #region Batch
1934
                    case "Batch":
1935
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
1936
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
1937
                        //강인구 추가
1938
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
1939
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
1940
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
1941
                        break;
1942
                    #endregion
1943
                    #region Copy
1944
                    case "Copy":
1945
                        Copy_Start();
1946
                        instanceToggle.IsChecked = false;
1947
                        ViewerDataModel.Instance.SelectedControl = "";
1948
                        ViewerDataModel.Instance.ControlTag = null;
1949
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1950
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1951
                        break;
1952
                    #endregion
1953
                    #region Cut
1954
                    case "Cut":
1955
                        Cut_Start();
1956
                        instanceToggle.IsChecked = false;
1957
                        ViewerDataModel.Instance.SelectedControl = "";
1958
                        ViewerDataModel.Instance.ControlTag = null;
1959
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1960
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1961
                        break;
1962
                    #endregion
1963
                    #region Paste
1964
                    case "Paste":
1965
                        Paste_Start();
1966
                        instanceToggle.IsChecked = false;
1967
                        ViewerDataModel.Instance.SelectedControl = "";
1968
                        ViewerDataModel.Instance.ControlTag = null;
1969
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1970
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1971
                        break;
1972
                    #endregion
1973
                    #region Delete
1974
                    case "Delete":
1975
                        Delete_Start();
1976
                        instanceToggle.IsChecked = false;
1977
                        ViewerDataModel.Instance.SelectedControl = "";
1978
                        ViewerDataModel.Instance.ControlTag = null;
1979
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1980
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1981
                        break;
1982
                    #endregion
1983
                    #region Undo
1984
                    case "Undo":
1985
                        this.ParentOfType<MainWindow>().dzMainMenu.Undo();
1986
                        instanceToggle.IsChecked = false;
1987
                        ViewerDataModel.Instance.SelectedControl = "";
1988
                        ViewerDataModel.Instance.ControlTag = null;
1989
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1990
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1991
                        break;
1992
                    #endregion
1993
                    #region Redo
1994
                    case "Redo":
1995
                        this.ParentOfType<MainWindow>().dzMainMenu.Redo();
1996
                        instanceToggle.IsChecked = false;
1997
                        ViewerDataModel.Instance.SelectedControl = "";
1998
                        ViewerDataModel.Instance.ControlTag = null;
1999
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2000
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2001
                        break;
2002
                    #endregion
2003
                    #region DragZoom
2004
                    case "DragZoom":
2005
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2006
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2007
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2008
                        break;
2009
                    #endregion
2010

    
2011
                    default:
2012
                        break;
2013
                }
2014
                #endregion
2015
            }
2016
            else
2017
            {
2018

    
2019
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2020
                {
2021
                    instanceMain.dzMainMenu.IsSwingMode = false;
2022
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2023
                    Common.ViewerDataModel.Instance.ControlTag = null;
2024
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2025
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2026
                }
2027
            }
2028
        }
2029

    
2030
        //강인구 자동 저장 추가
2031
        private void AutoSave(object sender, RoutedEventArgs e)
2032
        {
2033
            RadToggleButton instanceToggle = sender as RadToggleButton;
2034

    
2035
            if(instanceToggle.IsChecked == true)
2036
            {
2037
                SaveTime(true);
2038
            }
2039
            else
2040
            {
2041
                SaveTime(false);
2042
            }
2043
        }
2044

    
2045
        public void Copy_Start()
2046
        {
2047
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2048
            {
2049
                string MarkupData = "";
2050

    
2051
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2052
                {
2053
                    if (item.GetType().Name == "AdornerFinal")
2054
                    {
2055
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2056

    
2057
                        {
2058
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2059
                            {
2060
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2061
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2062
                            }
2063
                        }
2064
                        Clipboard.SetText(MarkupData);
2065
                    }
2066
                }
2067
            }
2068
        }
2069

    
2070
        public void Cut_Start()
2071
        {
2072
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2073
            {
2074
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2075
                {
2076
                    string MarkupData = "";
2077

    
2078
                    if (item.GetType().Name == "AdornerFinal")
2079
                    {
2080
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2081
                        {
2082
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2083
                            {
2084
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2085
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2086
                            }
2087
                        }
2088
                        Clipboard.SetText(MarkupData);
2089
                    }
2090
                }
2091
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2092
            }
2093
        }
2094

    
2095
        public void Paste_Start()
2096
        {
2097
            //마크업 붙여넣기
2098
            //if (Clipboard.GetText().Contains("|DZ|"))
2099
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2100
            {
2101
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2102

    
2103
                string[] delimiterChars = { "|OR|" };
2104
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2105

    
2106
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
2107

    
2108
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2109

    
2110
                //강인구 Undo/Redo 보류
2111
                UndoData = new Undo_data()
2112
                {
2113
                    IsUndo = false,
2114
                    Event = Event_Type.Create,
2115
                    EventTime = DateTime.Now,
2116
                    Markup_List = new List<Multi_Undo_data>()
2117
                };
2118

    
2119
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2120
                {
2121
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2122
                });
2123

    
2124
                foreach (string parse in data)
2125
                {
2126
                    if (parse != "")
2127
                    {
2128
                        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
2129
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
2130

    
2131
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2132
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2133

    
2134
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2135

    
2136
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2137
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2138

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

    
2141
                        UndoData.Markup_List.Add(multi_Undo_Data);
2142
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2143
                    }
2144
                }
2145
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2146

    
2147
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2148
                {
2149
                    Canvas.SetLeft(final, 0);
2150
                    Canvas.SetTop(final, 0);
2151
                }
2152
                else
2153
                {
2154
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2155
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2156
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2157

    
2158
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2159
                    {
2160
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2161
                    }
2162
                }
2163
                
2164

    
2165
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2166

    
2167
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2168
                //Canvas.SetLeft(final, 50);
2169
                //Canvas.SetTop(final, 50);
2170
            }
2171
            //외부 이미지 붙여넣기
2172
            else if (Clipboard.GetImage() != null)
2173
            {
2174
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2175

    
2176
                //강인구 Undo/Redo 보류
2177
                UndoData = new Undo_data()
2178
                {
2179
                    IsUndo = false,
2180
                    Event = Event_Type.Create,
2181
                    EventTime = DateTime.Now,
2182
                    Markup_List = new List<Multi_Undo_data>()
2183
                };
2184

    
2185

    
2186
                string temppath = System.IO.Path.GetTempPath();
2187
                //string filename = KCOM.Events.Save.shortCommentKey();
2188
                string filename = KCOM.Events.Save.shortFileKey();
2189

    
2190
                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2191
                clipboardImage.Save(temppath + "\\" + filename);
2192

    
2193
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2194
                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2195
                long numByte = fileInfo.Length;
2196
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2197
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2198

    
2199
                if (dLen < 4)
2200
                {
2201
                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2202
                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
2203
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2204
                    byte[] data = br.ReadBytes((int)numByte);
2205

    
2206
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2207
                    br.Close();
2208
                    fStream.Close();
2209
                    fStream.Dispose();
2210
                }
2211
                else
2212
                {
2213
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2214
                    return;
2215
                }
2216

    
2217
                fileInfo.Delete();
2218

    
2219
                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2220
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2221
                IntPtr hBitmap = bmp.GetHbitmap();
2222
                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2223
                Image img = new Image();
2224
                img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2225

    
2226

    
2227

    
2228

    
2229

    
2230
                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2231
                {
2232
                    PointSet = new List<Point>(),
2233
                    FilePath = img.Source.ToString(),
2234
                    ImageData = img.Source,
2235
                    StartPoint = new Point(100, 100),
2236
                    EndPoint = new Point(200, 200),
2237
                    TopRightPoint = new Point(100, 200),
2238
                    LeftBottomPoint = new Point(200, 100)
2239
                };
2240

    
2241
                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2242
                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2243
                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2244

    
2245
                currentControl.PointSet = new List<Point>
2246
                                        {
2247
                                            currentControl.StartPoint,
2248
                                            currentControl.LeftBottomPoint,
2249
                                            currentControl.EndPoint,
2250
                                            currentControl.TopRightPoint,
2251
                                        };
2252

    
2253
                multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2254
                UndoData.Markup_List.Add(multi_Undo_Data);
2255
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2256

    
2257
                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2258
                currentControl.CommentID = Events.Save.shortGuid();
2259

    
2260
                currentControl.ApplyTemplate();
2261
                currentControl.SetImage();
2262

    
2263
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2264
                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2265
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2266

    
2267
                double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2268
                double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2269
                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2270
            }
2271
        }
2272

    
2273
        public void Delete_Start()
2274
        {
2275
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2276
            {
2277
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2278

    
2279
                UndoData = new Undo_data()
2280
                {
2281
                    IsUndo = false,
2282
                    Event = Event_Type.Delete,
2283
                    EventTime = DateTime.Now,
2284
                    Markup_List = new List<Multi_Undo_data>()
2285
                };
2286

    
2287
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2288
                {
2289
                    if (item.GetType().Name == "AdornerFinal")
2290
                    {
2291
                        (item as Controls.AdornerFinal).unRegister();
2292

    
2293
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2294
                        {
2295
                            //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2296
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
2297
                            {
2298

    
2299
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
2300
                                UndoData.Markup_List.Add(multi_Undo_Data);
2301
                                multi_Undo_Data = new Multi_Undo_data();
2302

    
2303
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
2304

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

    
2307
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
2308
                            }
2309
                        }
2310
                    }
2311

    
2312
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2313
                    {
2314
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2315
                    });
2316
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2317
                }
2318
            }
2319
            this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2320
        }
2321

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