프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 64f6713a

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

1 787a4489 KangIngu
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 d4b0c723 KangIngu
        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 787a4489 KangIngu
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 532d83ef humkyung
        /// <summary>
271
        /// enable busy indicator and then call _SaveEvent method.
272
        /// </summary>
273
        /// <param name="sender"></param>
274
        /// <param name="e"></param>
275 787a4489 KangIngu
        public void SaveEvent(object sender, RoutedEventArgs e)
276
        {
277 532d83ef humkyung
            if (this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy == true) return;
278 787a4489 KangIngu
279 532d83ef humkyung
            this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
280 787a4489 KangIngu
281 532d83ef humkyung
            System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
282
            {
283
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
284
            }).ContinueWith(task =>
285
            {
286
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
287
            });
288
        }
289 787a4489 KangIngu
290 532d83ef humkyung
        /// <summary>
291
        /// save document
292
        /// </summary>
293
        /// <param name="sender"></param>
294
        /// <param name="e"></param>
295
        public void _SaveEvent(object sender, RoutedEventArgs e)
296
        {
297
            try
298 787a4489 KangIngu
            {
299 532d83ef humkyung
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
300 787a4489 KangIngu
301 532d83ef humkyung
                this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
302 787a4489 KangIngu
303 532d83ef humkyung
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
304
305
                //콘솔리 데잇일 경우 
306
                //if (ViewerDataModel.Instance.IsConsolidate && menu.gridViewMarkup.SelectedItems.Count > 1)
307 7b312426 KangIngu
                //if (ViewerDataModel.Instance.IsConsolidate)
308
                //{
309
                //    ViewerDataModel.Instance.IsConsolidate = false;
310
                //    return;
311
                //}
312 532d83ef humkyung
313
                //코멘트가 없을 경우
314
                //if (ViewerDataModel.Instance.MarkupControls_USER.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
                //코멘트가 없을 경우
327
                if (ViewerDataModel.Instance.MarkupList_USER.Count == 0)
328
                {
329
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
330 787a4489 KangIngu
                    {
331 532d83ef humkyung
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
332
                        {
333
                            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
334
                            return;
335
                        }
336 787a4489 KangIngu
                    }
337
                }
338
339 532d83ef humkyung
                //코멘트가 없을 경우
340
                //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0)
341
                //if (ViewerDataModel.Instance.MarkupControls_USER.Count == 0 && menu.gridViewMarkup.SelectedItems.Count == 0)
342
                //{
343
                //    foreach (var item in menu.gridViewMarkup.SelectedItems)
344
                //    {
345
                //        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
346
                //        {
347
                //            this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
348
                //            return;
349
                //        }
350
                //    }
351
                //}
352 787a4489 KangIngu
353 532d83ef humkyung
                menu.ChangeCommentReact();
354 787a4489 KangIngu
355 532d83ef humkyung
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
356
                {
357
                    RefactoryCommentReact(menu);
358
                }
359
                else if (menu.gridViewMarkup.SelectedItems.Count == 0)
360 787a4489 KangIngu
                {
361 532d83ef humkyung
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
362
                    return;
363
                }
364
                //else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as  IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
365
                //{
366
                //    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
367
                //    return;
368
                //}
369
                //강인구 변경
370
                else
371
                {
372
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
373 787a4489 KangIngu
                    {
374 532d83ef humkyung
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
375
                        {
376
                            RefactoryCommentReact(menu);
377
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
378 992a98b4 KangIngu
379 7b312426 KangIngu
                            if (ViewerDataModel.Instance.IsConsolidate)
380
                            {
381
                                return;
382
                            }
383 532d83ef humkyung
                            menu.gridViewMarkup.ItemsSource = null;
384
                            menu.gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
385
                            menu.gridViewMarkup.SelectedItem = item;
386 992a98b4 KangIngu
387 532d83ef humkyung
                            if (sender != null)
388
                            {
389
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
390
                            }
391
                            return;
392 316d0f5c KangIngu
                        }
393 787a4489 KangIngu
                    }
394 532d83ef humkyung
                    ////강인구 변경
395
                    //this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
396
                }
397
                if (sender != null)
398
                {
399
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
400 787a4489 KangIngu
                }
401
            }
402 532d83ef humkyung
            finally
403 316d0f5c KangIngu
            {
404
            }
405 787a4489 KangIngu
        }
406
407
		public void RefactoryCommentReact(MainMenu menu)
408
        {
409
            this.ParentOfType<MainWindow>().dzMainMenu.InkControl_Convert();
410
411
            Save save = new Save();
412
413
            //강인구 추가
414
            List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>();
415
416
            foreach(var item in menu.gridViewMarkup.SelectedItems)
417
            {
418
                if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
419
                {
420
                    MySelectItem.Add(item as IKCOM.MarkupInfoItem);
421
                }
422
            }
423
424
            //MySelectItem = (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
425
426
427
            save.Project_No = App.ViewInfo.ProjectNO;
428
            save.document_id = App.ViewInfo.DocumentItemID;
429
            save.user_id = App.ViewInfo.UserID;
430
            save.page_no = Convert.ToInt32(tlcurrentPage.Text);
431
432
            try
433
            {
434
                menu.ChangeCommentReact();
435
                if (menu.PreviewUserMarkupInfoItem != null) //신규 코멘트인지(MarkupInfo가 없는 경우)
436
                {
437
                    if (menu.gridViewMarkup.SelectedItems.FirstOrDefault() != null) //복수 페이지 혹은 저장한 경우
438
                    {
439
                        foreach(var item in MySelectItem)
440
                        {
441
                            save.MarkupSave(item);
442
                        }
443
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
444
                    }
445
                    else  //단일 페이지인 경우
446
                    {
447
                        //menu.ChangeCommentReact();
448
                        foreach (var item in MySelectItem)
449
                        {
450
                            save.MarkupSave(item);
451
                        }
452
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
453
                    }
454
                }
455
                else //기존 코멘트에 작업하는 경우
456
                {
457
                    if (menu.gridViewMarkup.SelectedItems.FirstOrDefault() != null)
458
                    {
459
                        foreach (var item in MySelectItem)
460
                        {
461
                            save.MarkupSave(item);
462
                        }
463
                        //save.MarkupSave(menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem);
464
                    }
465
                }
466
                using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
467
                {
468
                    KCOMDataModel.DataModel.DOCPAGE _docpage = new KCOMDataModel.DataModel.DOCPAGE();
469
470
471
                    ViewerDataModel.Instance.Document_Info.OrderBy(i => i.PAGE_NUMBER).ToList().ForEach(data =>
472
                    {
473
                        _docpage = (from info in Entity.DOCPAGE
474
                                    where info.ID == data.ID
475
                                    select info).FirstOrDefault();
476
477
                        if (_docpage.PAGE_ANGLE != data.PAGE_ANGLE)
478
                        {
479
                            _docpage.PAGE_ANGLE = data.PAGE_ANGLE;
480
                        }
481
                    });
482
483
                    Entity.SaveChanges();
484
                }
485
            }
486
            catch (Exception ex)
487
            {
488
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("세이브 실패", "Alert");
489
            }
490
        }
491
492
        //강인구 추가
493
        public void Print_Start(string Type)
494
        {
495
496
            if(ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
497
            {
498
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
499
                menu.ReleaseAdorner();
500
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
501
                {
502
                    RefactoryCommentReact(menu);
503
                }
504
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
505
                {
506
507
                }
508
                else
509
                {
510
                    RefactoryCommentReact(menu);
511
                }
512
            }
513
514
            bool isprint = false;
515
            if (Type == "Print")
516
            {
517
                isprint = true;
518
            }
519
520
            RadWindow PrintWindow = new RadWindow();
521
            IKCOM.MarkupInfoItem _result = null;
522
            PrintWindow.Width = 850;
523
            PrintWindow.Height = 600;
524
            //PrintWindow.Width = 650;
525
            //PrintWindow.Height = 550;
526
            PrintWindow.Header = Type;
527
528
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
529
530
            using (KCOMDataModel.DataModel.CIEntities Entity = new KCOMDataModel.DataModel.CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(App.ViewInfo.ProjectNO).ToString()))
531
            {
532
                var docinfo = from info in Entity.DOCINFO
533
                              where info.DOCUMENT_ID == App.ViewInfo.DocumentItemID
534
                              && info.PROJECT_NO == App.ViewInfo.ProjectNO
535
                              select info;
536
537
                var docitem = docinfo.First();
538
539
                foreach (KCOMDataModel.DataModel.MARKUP_INFO markinfo in docitem.MARKUP_INFO)
540
                {
541
                    var member = (from mem in Entity.MEMBER
542
                                  where mem.ID == markinfo.USER_ID
543
                                  select mem).First();
544
545
                    _result = new IKCOM.MarkupInfoItem
546
                    {
547
                        MarkupInfoID = markinfo.ID,
548
                        Consolidate = markinfo.CONSOLIDATE,
549
                        CreateTime = markinfo.UPDATE_TIME.HasValue ? markinfo.UPDATE_TIME.Value : markinfo.CREATE_TIME,
550
                        DisplayColor = SetColor(markinfo.ID),
551
                        UserID = markinfo.USER_ID,
552
                        UserName = member.NAME,
553
                        Depatment = member.DEPARTMENT,
554
                    };
555
556
                    _result.MarkupList = new List<IKCOM.MarkupItem>();
557
                    var markup_Version = markinfo.MARKUP_INFO_VERSION.OrderByDescending(p => p.CREATE_DATE).First();
558
559
                    foreach (KCOMDataModel.DataModel.MARKUP_DATA markdata in markup_Version.MARKUP_DATA)
560
                    {
561
                        IKCOM.MarkupItem markitem = new IKCOM.MarkupItem()
562
                        {
563
                            ID = markdata.ID,
564
                            PageNumber = markdata.PAGENUMBER,
565
                        };
566
                        _result.MarkupList.Add(markitem);
567
                    }
568
569
                    _result.PageCount = _result.MarkupList.GroupBy(i => i.PageNumber).Count();
570
571
                    markupinfo.Add(_result);
572
                }
573
574
575
                
576
                //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);
577
578
                //강인구 추가 
579
                var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/", 
580
                    App.SystemInfo.HostName,
581
                    App.ViewInfo.ProjectNO,
582
                    (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
583
                    App.ViewInfo.DocumentItemID
584
                    );
585
586
587
                PrintWindow.Content = new KCOM.Control.PrintControl(
588
                          Tile_Url,
589
                          docitem.PROJECT_NO,
590
                          docitem, markupinfo,
591
                          this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
592
                          docitem.DOCUMENT_ID,
593
                          this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
594
                          docitem.ORIGINAL_FILE, isprint);
595
596
                //http://cloud.devdoftech.co.kr:5977/TileSource/000000_Tile/111111/11111111/1.jpg
597
            }
598
599
            //프린트 팝업 옵션
600
            //PrintWindow.BorderThickness = new Thickness(3);
601
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
602
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
603
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
604
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
605
            PrintWindow.Background.Opacity = 0.6;
606
607
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
608
            //Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.Office2013Theme());
609
            PrintWindow.ShowDialog();
610
        }
611
612
        //강인구 추가
613
        private void PrintEvent(object sender, RoutedEventArgs e)
614
        {
615
            RadRibbonButton button = sender as RadRibbonButton;
616
            Print_Start(button.Content.ToString());
617
        }
618
619
        private List<AdornerMember> GetAdornerItem()
620
        {
621
            List<AdornerMember> AdonerList = new List<AdornerMember>();
622
623
            if (this.ParentOfType<MainWindow>() != null)
624
            {
625
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
626
                {
627
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
628
                    {
629
                        if (item.GetType().Name == "AdornerFinal")
630
                        {
631
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
632
                            {
633
                                AdonerList.Add(InnerItem);
634
                            }
635
                        }
636
                    }
637
                }
638
            }
639
            return AdonerList;
640
        }
641
        /// <summary>
642
        /// 투명도
643
        /// </summary>
644
        /// <param name="sender"></param>
645
        /// <param name="e"></param>
646
        //강인구 추가(Undo End)
647
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
648
        {
649
            List<AdornerMember> AdonerList = GetAdornerItem();
650
            if(AdonerList.Count > 0)
651
            {
652
                Undo_data UndoData = new Undo_data()
653
                {
654
                    IsUndo = false,
655
                    Event = Event_Type.Option,
656
                    EventTime = DateTime.Now,
657
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
658
                    Markup_List = new List<Multi_Undo_data>()
659
                };
660
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
661
662
                foreach (AdornerMember InnerItem in AdonerList)
663
                {
664
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
665
                  
666
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
667
                    UndoData.Markup_List.Add(multi_Undo_Data);
668
                    multi_Undo_Data = new Multi_Undo_data();
669
                }
670
671
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
672
                {
673
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
674
                });
675
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
676
            }
677
        }
678
679
        //강인구 추가(Undo End)
680
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
681
        {
682
            List<AdornerMember> AdonerList = GetAdornerItem();
683
            if (AdonerList.Count > 0)
684
            {
685
                Undo_data UndoData = new Undo_data()
686
                {
687
                    IsUndo = false,
688
                    Event = Event_Type.Option,
689
                    EventTime = DateTime.Now,
690
                    LineSize = ViewerDataModel.Instance.LineSize,
691
                    Markup_List = new List<Multi_Undo_data>()
692
                };
693
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
694
695
                foreach (AdornerMember InnerItem in AdonerList)
696
                {
697
                    switch (InnerItem.DrawingData.GetType().Name)
698
                    {
699
                        case ("LineControl"):
700
                            {
701
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
702
                            }
703
                            break;
704
                        case ("ArcControl"):
705
                            {
706
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
707
                            }
708
                            break;
709
                        case ("ArrowControl_Multi"):
710
                            {
711
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
712
                            }
713
                            break;
714
                        case ("CloudControl"):
715
                            {
716
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
717
                            }
718
                            break;
719
                        case ("PolygonControl"):
720
                            {
721
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
722
                            }
723
                            break;
724
                        case ("RectangleControl"):
725
                            {
726
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
727
                            }
728
                            break;
729
                        case ("RectCloudControl"):
730
                            {
731
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
732
                            }
733
                            break;
734
                        case ("TriControl"):
735
                            {
736
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
737
                            }
738
                            break;
739
                        case ("CircleControl"):
740
                            {
741
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
742
                            }
743
                            break;
744
                    }
745
                    
746
747
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
748
                    UndoData.Markup_List.Add(multi_Undo_Data);
749
                    multi_Undo_Data = new Multi_Undo_data();
750
                }
751
752
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
753
                {
754
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
755
                });
756
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
757
            }
758
        }
759
760 5ce56a3a KangIngu
761
        private void cbIntervalSize_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 ("LineControl"):
782
                            {
783
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
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
                    }
791
                }
792
793
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
794
                {
795
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
796
                });
797
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
798
            }
799
        }
800
801 9f473fb7 KangIngu
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
802
        {
803
            List<AdornerMember> AdonerList = GetAdornerItem();
804
            if (AdonerList.Count > 0)
805
            {
806
807
                //Undo_data UndoData = new Undo_data()
808
                //{
809
                //    IsUndo = false,
810
                //    Event = Event_Type.Option,
811
                //    EventTime = DateTime.Now,
812
                //    Interval = ViewerDataModel.Instance.Interval,
813
                //    Markup_List = new List<Multi_Undo_data>()
814
                //};
815
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
816
817
                foreach (AdornerMember InnerItem in AdonerList)
818
                {
819
                    switch (InnerItem.DrawingData.GetType().Name)
820
                    {
821
                        case ("RectCloudControl"):
822
                            {
823
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
824
825
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
826
                                //UndoData.Markup_List.Add(multi_Undo_Data);
827
                                //multi_Undo_Data = new Multi_Undo_data();
828
                            }
829
                            break;
830
                        case ("CloudControl"):
831
                            {
832
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
833
834
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
835
                                //UndoData.Markup_List.Add(multi_Undo_Data);
836
                                //multi_Undo_Data = new Multi_Undo_data();
837
                            }
838
                            break;
839
                    }
840
                }
841
842
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
843
                //{
844
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
845
                //});
846
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
847
            }
848
        }
849
850 787a4489 KangIngu
        //강인구 추가(Undo End)
851
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
852
        {
853
            //강인구 추가
854
            if (this.ParentOfType<MainWindow>() != null)
855
            {
856
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
857
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
858
                {
859
                    Undo_data UndoData = new Undo_data()
860
                    {
861
                        IsUndo = false,
862
                        Event = Event_Type.Option,
863
                        EventTime = DateTime.Now,
864
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
865
                        Markup_List = new List<Multi_Undo_data>()
866
                    };
867
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
868
869
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
870
                    {
871
                        if (item.GetType().Name == "AdornerFinal")
872
                        {
873
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
874
                            {
875
                                switch (InnerItem.DrawingData.GetType().Name)
876
                                {
877
                                    case ("LineControl"):
878
                                        {
879
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
880
                                        }
881
                                        break;
882
                                    case ("ArcControl"):
883
                                        {
884
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
885
                                        }
886
                                        break;
887
                                    case ("ArrowControl_Multi"):
888
                                        {
889
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
890
                                        }
891
                                        break;
892
                                    case ("CloudControl"):
893
                                        {
894
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
895
                                        }
896
                                        break;
897
                                    case ("PolygonControl"):
898
                                        {
899
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
900
                                        }
901
                                        break;
902
                                    case ("RectangleControl"):
903
                                        {
904
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
905
                                        }
906
                                        break;
907
                                    case ("RectCloudControl"):
908
                                        {
909
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
910
                                        }
911
                                        break;
912
                                    case ("TriControl"):
913
                                        {
914
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
915
                                        }
916
                                        break;
917
                                    case ("CircleControl"):
918
                                        {
919
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
920
                                        }
921
                                        break;
922
                                }
923
924
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
925
                                UndoData.Markup_List.Add(multi_Undo_Data);
926
                                multi_Undo_Data = new Multi_Undo_data();
927
                            }
928
929
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
930
                            {
931
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
932
                            });
933
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
934
                        }
935
                    }
936
                }
937
            }
938
        }
939
940
        //강인구 추가
941
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
942
        {
943 d4b0c723 KangIngu
            //if (this.ParentOfType<MainWindow>() != null)
944
            //{
945
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
946
            //    {
947
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
948
            //        {
949
            //            if (item.GetType().Name == "AdornerFinal")
950
            //            {
951
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
952
            //                {
953
            //                    switch (InnerItem.DrawingData.GetType().Name)
954
            //                    {
955
            //                        case ("TextControl"):
956
            //                            {
957
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
958
            //                            }
959
            //                            break;
960
            //                        case ("ArrowTextControl"):
961
            //                            {
962
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
963
            //                            }
964
            //                            break;
965
            //                    }
966
            //                }
967
            //            }
968
            //        }
969
            //    }
970
            //}
971 787a4489 KangIngu
        }
972
973
        //강인구 추가
974
        private void btnBold_Checked(object sender, RoutedEventArgs e)
975
        {
976
            if (this.ParentOfType<MainWindow>() != null)
977
            {
978
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
979
                {
980
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
981
                    {
982
                        if (item.GetType().Name == "AdornerFinal")
983
                        {
984
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
985
                            {
986
                                switch (InnerItem.DrawingData.GetType().Name)
987
                                {
988
                                    case ("TextControl"):
989
                                        {
990 d4b0c723 KangIngu
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
991 787a4489 KangIngu
                                            {
992
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
993
                                            }
994
                                            else
995
                                            {
996 d4b0c723 KangIngu
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
997 787a4489 KangIngu
                                            }
998
999
                                        }
1000
                                        break;
1001
                                    case ("ArrowTextControl"):
1002
                                        {
1003 d4b0c723 KangIngu
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
1004 787a4489 KangIngu
                                            {
1005
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
1006
                                            }
1007
                                            else
1008
                                            {
1009 d4b0c723 KangIngu
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
1010 787a4489 KangIngu
                                            }
1011
                                        }
1012
                                        break;
1013
                                }
1014
                            }
1015
                        }
1016
                    }
1017
                }
1018
            }
1019
        }
1020
1021
        //강인구 추가
1022
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
1023
        {
1024
            if (this.ParentOfType<MainWindow>() != null)
1025
            {
1026
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1027
                {
1028
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1029
                    {
1030
                        if (item.GetType().Name == "AdornerFinal")
1031
                        {
1032
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1033
                            {
1034
                                switch (InnerItem.DrawingData.GetType().Name)
1035
                                {
1036
                                    case ("TextControl"):
1037
                                        {
1038
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
1039
                                            {
1040
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
1041
                                            }
1042
                                            else
1043
                                            {
1044
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
1045
                                            }
1046
1047
                                        }
1048
                                        break;
1049
                                    case ("ArrowTextControl"):
1050
                                        {
1051
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1052
                                            {
1053
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1054
                                            }
1055
                                            else
1056
                                            {
1057
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1058
                                            }
1059
                                        }
1060
                                        break;
1061
                                }
1062
                            }
1063
                        }
1064
                    }
1065
                }
1066
            }
1067
        }
1068
1069
        //강인구 추가
1070
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1071
        {
1072
            if (this.ParentOfType<MainWindow>() != null)
1073
            {
1074
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1075
                {
1076
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1077
                    {
1078
                        if (item.GetType().Name == "AdornerFinal")
1079
                        {
1080
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1081
                            {
1082
                                switch (InnerItem.DrawingData.GetType().Name)
1083
                                {
1084
                                    case ("TextControl"):
1085
                                        {
1086
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1087
                                            {
1088
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1089
                                            }
1090
                                            else
1091
                                            {
1092
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1093
                                            }
1094
                                        }
1095
                                        break;
1096
                                    case ("ArrowTextControl"):
1097
                                        {
1098
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1099
                                            {
1100
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1101
                                            }
1102
                                            else
1103
                                            {
1104
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1105
                                            }
1106
                                        }
1107
                                        break;
1108
                                }
1109
                            }
1110
                        }
1111
                    }
1112
                }
1113
            }
1114
        }
1115 5ce56a3a KangIngu
1116
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1117
        {
1118
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1119
        }
1120
1121 d4b0c723 KangIngu
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1122
        {
1123
            if (this.ParentOfType<MainWindow>() != null)
1124
            {
1125
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1126
                {
1127
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1128
                    {
1129
                        if (item.GetType().Name == "AdornerFinal")
1130
                        {
1131
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1132
                            {
1133
                                switch (InnerItem.DrawingData.GetType().Name)
1134
                                {
1135
                                    case ("TextControl"):
1136
                                        {
1137
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1138
                                        }
1139
                                        break;
1140
                                    case ("ArrowTextControl"):
1141
                                        {
1142
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1143
                                        }
1144
                                        break;
1145
                                }
1146
                            }
1147
                        }
1148
                    }
1149
                }
1150
            }
1151
        }
1152
1153 787a4489 KangIngu
        //강인구 추가
1154
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1155
        {
1156
            if (this.ParentOfType<MainWindow>() != null)
1157
            {
1158
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1159
                {
1160
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1161
                    {
1162
                        if (item.GetType().Name == "AdornerFinal")
1163
                        {
1164
                            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
1165
                            {
1166
                                switch (InnerItem.DrawingData.GetType().Name)
1167
                                {
1168
                                    case ("TextControl"):
1169
                                        {
1170
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1171
                                            //{
1172
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily = new FontFamily(comboFontFamily.Text);
1173
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1174
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1175
                                            //}
1176
                                            //else
1177
                                            //{
1178
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1179
                                            //}
1180
                                        }
1181
                                        break;
1182
                                    case ("ArrowTextControl"):
1183
                                        {
1184
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1185
                                            //{
1186
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1187
                                            //}
1188
                                            //else
1189
                                            //{
1190
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1191
                                            //}
1192
                                        }
1193
                                        break;
1194
                                }
1195
                            }
1196
                        }
1197
                    }
1198
                }
1199
            }
1200
        }
1201
1202
        /// <summary>
1203
        /// 텍스트 컨트롤 하일라이트 처리
1204
        /// </summary>
1205
        /// <param name="sender"></param>
1206
        /// <param name="e"></param>
1207
        private void HighlightEvent(object sender, RoutedEventArgs e)
1208
        {
1209
1210
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1211
            SetHighlightEvent();
1212
            //if ((sender as CheckBox).IsChecked.Value)
1213
            //{
1214
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1215
            //}
1216
            //else
1217
            //{
1218
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1219
            //}
1220
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1221
            //{
1222
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1223
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1224
            //    instance.SetText();
1225
            //}
1226
        }
1227
1228
        //강인구 추가페이지 이동 엔터
1229
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1230
        {
1231
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1232
            if (e.Key == Key.Enter)
1233
            {
1234
                try
1235
                {
1236
                    var instanceMain = this.ParentOfType<MainWindow>();
1237
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1238
                }
1239
                catch (Exception)
1240
                {
1241
                    RadWindow.Alert(new DialogParameters
1242
                    {
1243
                        Theme = new VisualStudio2013Theme(),
1244
                        Header = "안내",
1245
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1246
                    });
1247
                }
1248
                
1249
            }
1250
        }
1251
1252
        public event EventHandler<WindowClosedEventArgs> Closed;
1253
1254
        //private void CheckEvent(object sender, RoutedEventArgs e)
1255
        //{
1256
        //    RadWindow CheckPop = new RadWindow();
1257
        //    test check = new test();
1258
1259
        //    CheckPop = new RadWindow
1260
        //    {
1261
        //        Width = 1700,
1262
        //        Height = 510,
1263
        //        Header = "My Check List",
1264
        //        Content = check,
1265
        //        Owner = this,
1266
        //        ResizeMode = System.Windows.ResizeMode.NoResize,
1267
        //        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1268
        //    };
1269
        //    StyleManager.SetTheme(CheckPop, new VisualStudio2013Theme());
1270
1271
        //    CheckPop.Closed += CheckPop_Closed;
1272
        //    CheckPop.ShowDialog();
1273
        //}
1274
1275
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1276
        {
1277
            PanoramaShow();
1278
        }
1279
1280
        public void PanoramaShow()
1281
        {
1282
            Panorama check = new Panorama();
1283
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1284
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1285
            //double windowWidth = this.Width;
1286
            //double windowHeight = this.Height;
1287
1288
            var PanoramaPop = new RadWindow
1289
            {
1290
                //MinWidth = 600,
1291
                //MinHeight = 400,
1292
                //Header = "My Check List",
1293
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1294
                Content = check,
1295
                Owner = this,
1296
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1297
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1298
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1299
                IsTopmost = false,
1300
                //Left = (screenWidth / 2) - (windowWidth / 2),
1301
                //Top = (screenHeight / 2) - (windowHeight / 2),
1302
                //Left = (screenWidth / 2),
1303
                //Top = (screenHeight / 2),
1304
                Width = screenWidth * 0.4,
1305
                Height = screenHeight * 0.4,
1306
            };
1307
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1308
            //CheckPop.ShowDialog();
1309
            PanoramaPop.Show();
1310
        }
1311 d4b0c723 KangIngu
1312 787a4489 KangIngu
        private void CheckEvent(object sender, RoutedEventArgs e)
1313
        {
1314
            //창이 떠있을 경우 재 실행 방지
1315
            if (isClosed)
1316
            {
1317
                //토글 및 마우스 상태 초기화
1318
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1319
                foreach(var togle in toggleList)
1320
                {
1321
                    togle.IsChecked = false;
1322
                }
1323
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1324
1325
                isClosed = false;
1326
1327
                
1328
                CheckList check = new CheckList();
1329
1330
                CheckPop = new RadWindow
1331
                {
1332
                    MinWidth = 1200,
1333
                    MinHeight = 500,
1334
                    //Header = "My Check List",
1335
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1336
                    Content = check,
1337
                    //Owner = this,
1338
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1339
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1340
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1341
                    IsTopmost = true,
1342
                };
1343
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1344
                CheckPop.Closed += CheckPop_Closed;
1345
                
1346
                //CheckPop.ShowDialog();
1347
                CheckPop.Show();
1348
            }
1349
        }
1350
1351
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1352
        {
1353
            isClosed = true;
1354
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1355
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1356
            ViewerDataModel.Instance.Capture_Opacity = 0;
1357
        }
1358
1359 64f6713a humkyung
        /// <summary>
1360
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1361
        /// </summary>
1362
        /// <param name="sender"></param>
1363
        /// <param name="e"></param>
1364 787a4489 KangIngu
        private void PageGoEvent(object sender, RoutedEventArgs e)
1365
        {
1366
            RadButton button = sender as RadButton;
1367
            var instanceMain = this.ParentOfType<MainWindow>();
1368
            
1369
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1370
            try
1371
            {
1372
                switch (button.CommandParameter.ToString())
1373
                {
1374
                    case "Down":
1375
                        {
1376
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1377
                        }
1378
                        break;
1379
                    case "Up":
1380
                        {
1381
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1382
                        }
1383
                        break;
1384
                }
1385
            }
1386
            catch (Exception)
1387
            {
1388
                RadWindow.Alert(new DialogParameters
1389
                {
1390
                    Theme = new VisualStudio2013Theme(),
1391
                    Header = "안내",
1392
                    Content = "페이지 번호를 정확하게 입력해 주세요",
1393
                });
1394
            }
1395
        }
1396
1397
        private void viewEvent(object sender, RoutedEventArgs e)
1398
        {
1399 9f473fb7 KangIngu
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1400 787a4489 KangIngu
            var instanceMain = this.ParentOfType<MainWindow>();
1401
1402
            Point point = new Point(instanceMain.dzMainMenu.zoomAndPanCanvas.Width / 2, instanceMain.dzMainMenu.zoomAndPanCanvas.Height / 2);
1403
1404 9f473fb7 KangIngu
            //if ((sender as RadRibbonToggleButton) != null)
1405
            //{
1406
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1407
            //    instanceToggle = (sender as RadRibbonToggleButton);
1408
            //}
1409
1410
            //instanceToggle.IsChecked = false;
1411
1412 787a4489 KangIngu
            switch (viewButton.CommandParameter.ToString())
1413
            {
1414
                case "zoomout":
1415
                    {
1416
                        //장원
1417
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1418
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1419 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1420 787a4489 KangIngu
                        //Common.ViewerDataModel.Instance.zom
1421
                    }
1422
                    break;
1423
                case "zoomin":
1424
                    {
1425
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1426 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1427 787a4489 KangIngu
                    }
1428
                    break;
1429
                case "fullscreen":
1430
                    {
1431
                        instanceMain.WindowState = WindowState.Maximized;
1432
                        //Sizemode 대기(강인구)
1433
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1434
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1435 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1436 787a4489 KangIngu
                    }
1437
                    break;
1438
                case "fitWidth":
1439
                    {
1440
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1441 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1442 787a4489 KangIngu
                    }
1443
                    break;
1444
                case "fitHeight":
1445
                    {
1446
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1447 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1448 787a4489 KangIngu
                    }
1449
                    break;
1450
                case "boundzoom":
1451
                    {
1452 9f473fb7 KangIngu
1453 787a4489 KangIngu
                    }
1454
                    break;
1455
                case "Rotate_M":
1456
                    {
1457
                        drawingPannelRotate(false);
1458 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1459 787a4489 KangIngu
                    }
1460
                    break;
1461
                case "Rotate_P":
1462
                    {
1463
                        drawingPannelRotate(true);
1464 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1465 787a4489 KangIngu
                    }
1466
                    break;
1467
                case "Rotate_half":
1468
                    {
1469
                        drawingPannelRotate(true);
1470
                        drawingPannelRotate(true);
1471 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1472 787a4489 KangIngu
                    }
1473
                    break;
1474
            }
1475
        }
1476
1477 d4b0c723 KangIngu
        private void Control_Event(object sender, RoutedEventArgs e)
1478
        {
1479
1480
        }
1481
1482 787a4489 KangIngu
        #region 대기
1483
1484
        public void drawingPannelRotate(bool Flag)
1485
        {
1486
            var instanceMain = this.ParentOfType<MainWindow>();
1487
1488
            //if (rotateOffSet > 3)
1489
            //    rotateOffSet = 0;
1490
1491
            //if (rotateOffSet < 0)
1492
            //    rotateOffSet = 3;
1493
1494
            if(Flag)
1495
            {
1496
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1497
                {
1498
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1499
                }
1500
                else
1501
                {
1502
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1503
                }
1504
            }
1505
            else
1506
            {
1507
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1508
                {
1509
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1510
                }
1511
                else
1512
                {
1513
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1514
                }
1515
            }
1516
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1517
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1518
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1519
1520
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1521
            {
1522
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1523
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1524
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1525
            }
1526
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1527
            {
1528
                instanceMain.dzMainMenu.translate.X = 0;
1529
                instanceMain.dzMainMenu.translate.Y = 0;
1530
            }
1531
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1532
            {
1533
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1534
                instanceMain.dzMainMenu.translate.Y = 0;
1535
            }
1536
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1537
            {
1538
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1539
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1540
            }
1541
            else
1542
            {
1543
                instanceMain.dzMainMenu.translate.X = 0;
1544
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1545
            }
1546
1547
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1548
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1549
            //대기(강인구)
1550
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1551
1552
1553
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1554
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1555
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1556
1557
1558
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1559
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1560
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1561
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1562
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1563
            //ViewerDataModel.Instance.Document_Info.Clear();
1564
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1565
            //{
1566
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1567
            //});
1568
1569
1570
            //이미지 각도 변경 시 실시간 Thumbnail 각도 변경(강인구 추가)
1571
            instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(data =>
1572
            {
1573
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1574
1575
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1576
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1577
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1578
1579
                instanceMain.dzMainMenu.pageNavigator.setPageChange(data);
1580
            });
1581
        }
1582
        #endregion
1583
1584
        private void ImageConverter()
1585
        {
1586
            var instanceMain = this.ParentOfType<MainWindow>();
1587
            //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1588
1589
1590
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1591
            dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1592
            Nullable<bool> result = dlg.ShowDialog();
1593
            if (result == true)
1594
            {
1595
                instanceMain.dzMainMenu.filename = dlg.FileName;
1596
                instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1597
1598
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1599
                String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1600
                long numByte = fileInfo.Length;
1601
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1602
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1603
1604
                if (dLen < 4)
1605
                {
1606
                    System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1607
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1608
                    byte[] data = br.ReadBytes((int)numByte);
1609
                    br.Close();
1610
1611
                    instanceMain.dzMainMenu.filename = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1612
                    fStream.Close();
1613
                    fStream.Dispose();
1614
                }
1615
                else
1616
                {
1617
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1618
                }
1619
            }
1620
        }
1621
1622 d4b0c723 KangIngu
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1623
        {
1624
1625
        }
1626
1627 787a4489 KangIngu
        private void ControlEvent(object sender, RoutedEventArgs e)
1628
        {
1629
            RadToggleButton instanceToggle = sender as RadToggleButton;
1630
            var instanceMain = this.ParentOfType<MainWindow>();
1631
1632
            #region Ctrl + A 눌렀을 때 대처 방법 
1633
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1634
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1635
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1636
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1637
            {
1638
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1639
                //foreach (var item in lstItem)
1640
                //{
1641
                //    foreach (var member in item.MemberSet)
1642
                //    {
1643
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1644
                //        {
1645
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1646
                //        }
1647
                //    }
1648
                //}
1649
            }
1650
            #endregion
1651
1652
            //if (!instanceMain.IsFreeSelectionMode)
1653
            //{
1654
            //    instanceMain.IsSwingMode = true;
1655
            //}
1656
1657 d4b0c723 KangIngu
            #region 다른 컨트롤 버튼 선택 해제
1658
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1659
            {
1660
                if (ControlState == null)
1661
                {
1662
                    instanceToggle.IsChecked = false;
1663
                    HiddenControlHide();
1664
                }
1665
            });
1666
            #endregion
1667
1668 787a4489 KangIngu
            Release_ToggleButton(sender); //-> 해당 컨트롤을 제외한 모든 컨트롤에 대해 해제 처리
1669 d4b0c723 KangIngu
1670 787a4489 KangIngu
            if (instanceToggle != null)
1671
            {
1672
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1673
            }
1674
            else if ((sender as RadRibbonToggleButton) != null)
1675
            {
1676
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1677
                instanceToggle = (sender as RadRibbonToggleButton);
1678
            }
1679
            else if ((sender as RadRibbonButton) != null)
1680
            {
1681
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1682
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1683
            }
1684
            else
1685
            {
1686
                RadButton instanceButton = sender as RadButton;
1687
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1688
            }
1689
1690
1691
1692
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1693
            {
1694
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1695
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1696
                {
1697
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1698
                });
1699
            });
1700
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1701
1702
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1703
1704
            if (instanceToggle.IsChecked != false)
1705
            {
1706
                #region 컨트롤이 체크되었다면
1707
                switch (instanceToggle.CommandParameter.ToString())
1708
                {
1709
                    #region Line
1710
                    case "Line":
1711
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
1712
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1713
                        if (instanceToggle.Tag.ToString() == "LineDelete")
1714
                        {
1715
                            //HiddenInterval.Visibility = Visibility.Visible;
1716
                        }
1717
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
1718
                        break;
1719
                    #endregion
1720
                    #region ChainLine
1721
                    case "ChainLine":
1722
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
1723
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1724
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
1725
                        break;
1726
                    #endregion
1727
                    #region DimLine
1728
                    case "DimLine":
1729
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
1730
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1731
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
1732
                        break;
1733
                    #endregion
1734
                    #region TwinLine
1735
                    case "TwinLine":
1736
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
1737
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1738
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
1739
                        break;
1740
                    #endregion
1741
                    #region CancelLine
1742
                    case "CancelLine":
1743
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
1744
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1745
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
1746
                        break;
1747
                    #endregion
1748
                    #region PolygonCloud
1749
                    case "PolygonCloud":
1750
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
1751
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1752
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
1753
                        break;
1754
                    #endregion
1755
                    #region RectCloud
1756
                    case "RectCloud":
1757
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
1758
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1759
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
1760
                        break;
1761
                    #endregion
1762 4318fdeb KangIngu
                    #region Rectangle
1763 787a4489 KangIngu
                    case "Rectangle":
1764
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
1765
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1766
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
1767
                        break;
1768
                    #endregion
1769 4318fdeb KangIngu
                    #region Triangle
1770 787a4489 KangIngu
                    case "Triangle":
1771
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
1772
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1773
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
1774
                        break;
1775
                    #endregion
1776
                    #region RectCloud
1777
                    case "Circle":
1778
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
1779
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1780
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
1781
                        break;
1782
                    #endregion
1783
                    #region Symbol
1784
                    case "Symbol":
1785
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
1786
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1787
                        break;
1788
                    #endregion
1789
                    #region SymbolN
1790
                    case "SymbolN":
1791
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
1792
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
1793
                        break;
1794
                    #endregion
1795
                    #region Text
1796
                    case "Text":
1797
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
1798
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1799
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
1800
                        break;
1801
                    #endregion
1802
                    #region TextBorder
1803
                    case "TextBorder":
1804
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
1805
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1806
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
1807
                        break;
1808
                    #endregion
1809
                    #region TextCloud
1810
                    case "TextCloud":
1811
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
1812
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1813
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
1814
                        break;
1815
                    #endregion
1816
                    #region Date
1817
                    case "Date":
1818
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
1819
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
1820
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
1821
                        break;
1822
                    #endregion
1823
                    #region ArrowText
1824
                    case "ArrowText":
1825
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
1826
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
1827
                        {
1828
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
1829
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
1830
                        }
1831
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
1832
                        {
1833
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
1834
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
1835
                        }
1836
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
1837
                        {
1838
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
1839
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
1840
                        }
1841
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
1842
                        {
1843
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
1844
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
1845
                        }
1846
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
1847
                        {
1848
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
1849
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
1850
                        }
1851
                        else
1852
                        {
1853
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
1854
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
1855
                            //HiddenAxisLock.Visibility = Visibility.Visible;
1856
                        }
1857
                        break;
1858
                    #endregion
1859
                    #region Arrow
1860
                    case "Arrow":
1861
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
1862
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1863
                        //HiddenDimSize.Visibility = Visibility.Visible;
1864
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
1865
                        break;
1866
                    #endregion
1867
                    #region Shape
1868
                    case "Shape":
1869
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
1870
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
1871
                        break;
1872
                    #endregion
1873
                    #region Polygon
1874
                    case "Polygon":
1875
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
1876
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
1877
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1878
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
1879
                        break;
1880
                    #endregion
1881
                    #region Arc
1882
                    case "Arc":
1883
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
1884
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
1885
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1886
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1887
                        break;
1888
                    #endregion
1889
                    #region ArrowMulti
1890
                    case "ArrowMulti":
1891
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
1892
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
1893
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1894
                        break;
1895
                    #endregion
1896
                    #region Etc
1897
                    case "Etc":
1898
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
1899
                        break;
1900
                    #endregion
1901
                    #region Ink
1902
                    case "Ink":
1903
                        if (instanceToggle.Tag.ToString() == "EraserClear")
1904
                        {
1905
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1906
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
1907
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
1908
                        }
1909
                        else if (instanceToggle.Tag.ToString() == "Eraser")
1910
                        {
1911
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1912
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
1913
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
1914
                        }
1915
                        else
1916
                        {
1917
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
1918
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
1919
                        }
1920
1921
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1922
1923
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
1924
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
1925
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
1926
                        break;
1927
                    #endregion
1928
                    #region Select
1929
                    case "Select":
1930 65246dc9 KangIngu
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
1931
                        {
1932
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
1933
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
1934
                        }
1935 787a4489 KangIngu
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
1936
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1937 9f473fb7 KangIngu
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
1938 787a4489 KangIngu
                        break;
1939
                    #endregion
1940
                    #region Image
1941
                    case "Image":
1942
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
1943
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1944
                        ImageConverter();
1945
                        break;
1946
                    #endregion
1947
                    #region Sign
1948
                    case "Sign":
1949
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
1950
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
1951
                        //강인구 추가
1952
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
1953
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
1954
                        //{
1955
                        //    if (ea.Result == null)
1956
                        //    {
1957
1958
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
1959
                        //    }
1960
                        //    else
1961
                        //    {
1962
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
1963
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
1964
                        //        {
1965
                        //            BitmapImage im = new BitmapImage();
1966
                        //            im.SetSource(ms);
1967
                        //            instanceMain.DeepLayer.SignImage = im;
1968
                        //            ms.Close();
1969
                        //        }
1970
                        //    }
1971
                        //};
1972
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
1973
                        break;
1974
                    #endregion
1975
                    #region Check
1976
                    case "Check":
1977
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
1978
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
1979
                        //강인구 추가
1980
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
1981
                        break;
1982
                    #endregion
1983
                    #region Batch
1984
                    case "Batch":
1985
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
1986
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
1987
                        //강인구 추가
1988
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
1989
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
1990 999c9e40 humkyung
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
1991 787a4489 KangIngu
                        break;
1992 d4b0c723 KangIngu
                    #endregion
1993
                    #region Copy
1994
                    case "Copy":
1995
                        Copy_Start();
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 Cut
2004
                    case "Cut":
2005
                        Cut_Start();
2006
                        instanceToggle.IsChecked = false;
2007
                        ViewerDataModel.Instance.SelectedControl = "";
2008
                        ViewerDataModel.Instance.ControlTag = null;
2009
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2010
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2011
                        break;
2012
                    #endregion
2013
                    #region Paste
2014
                    case "Paste":
2015
                        Paste_Start();
2016
                        instanceToggle.IsChecked = false;
2017
                        ViewerDataModel.Instance.SelectedControl = "";
2018
                        ViewerDataModel.Instance.ControlTag = null;
2019
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2020
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2021
                        break;
2022
                    #endregion
2023
                    #region Delete
2024
                    case "Delete":
2025
                        Delete_Start();
2026
                        instanceToggle.IsChecked = false;
2027
                        ViewerDataModel.Instance.SelectedControl = "";
2028
                        ViewerDataModel.Instance.ControlTag = null;
2029
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2030
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2031
                        break;
2032
                    #endregion
2033
                    #region Undo
2034
                    case "Undo":
2035
                        this.ParentOfType<MainWindow>().dzMainMenu.Undo();
2036
                        instanceToggle.IsChecked = false;
2037
                        ViewerDataModel.Instance.SelectedControl = "";
2038
                        ViewerDataModel.Instance.ControlTag = null;
2039
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2040
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2041
                        break;
2042
                    #endregion
2043
                    #region Redo
2044
                    case "Redo":
2045
                        this.ParentOfType<MainWindow>().dzMainMenu.Redo();
2046
                        instanceToggle.IsChecked = false;
2047
                        ViewerDataModel.Instance.SelectedControl = "";
2048
                        ViewerDataModel.Instance.ControlTag = null;
2049
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2050
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2051 9f473fb7 KangIngu
                        break;
2052
                    #endregion
2053
                    #region DragZoom
2054
                    case "DragZoom":
2055
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2056
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2057
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2058
                        break;
2059 d4b0c723 KangIngu
                    #endregion
2060 9f473fb7 KangIngu
2061 787a4489 KangIngu
                    default:
2062
                        break;
2063
                }
2064
                #endregion
2065
            }
2066
            else
2067
            {
2068 992a98b4 KangIngu
2069 787a4489 KangIngu
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2070
                {
2071
                    instanceMain.dzMainMenu.IsSwingMode = false;
2072
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2073
                    Common.ViewerDataModel.Instance.ControlTag = null;
2074
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2075
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2076
                }
2077
            }
2078
        }
2079
2080
        //강인구 자동 저장 추가
2081
        private void AutoSave(object sender, RoutedEventArgs e)
2082
        {
2083
            RadToggleButton instanceToggle = sender as RadToggleButton;
2084
2085
            if(instanceToggle.IsChecked == true)
2086
            {
2087
                SaveTime(true);
2088
            }
2089
            else
2090
            {
2091
                SaveTime(false);
2092
            }
2093
        }
2094
2095 d4b0c723 KangIngu
        public void Copy_Start()
2096
        {
2097
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2098
            {
2099
                string MarkupData = "";
2100
2101
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2102
                {
2103
                    if (item.GetType().Name == "AdornerFinal")
2104
                    {
2105
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2106
2107
                        {
2108
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2109
                            {
2110
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2111
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2112
                            }
2113
                        }
2114
                        Clipboard.SetText(MarkupData);
2115
                    }
2116
                }
2117
            }
2118
        }
2119
2120
        public void Cut_Start()
2121
        {
2122
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2123
            {
2124
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2125
                {
2126
                    string MarkupData = "";
2127
2128
                    if (item.GetType().Name == "AdornerFinal")
2129
                    {
2130
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2131
                        {
2132
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2133
                            {
2134
                                markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2135
                                MarkupData += "|OR|" + markupReturn.ConvertData;
2136
                            }
2137
                        }
2138
                        Clipboard.SetText(MarkupData);
2139
                    }
2140
                }
2141
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2142
            }
2143
        }
2144
2145
        public void Paste_Start()
2146
        {
2147
            //마크업 붙여넣기
2148
            //if (Clipboard.GetText().Contains("|DZ|"))
2149
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2150
            {
2151
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2152
2153
                string[] delimiterChars = { "|OR|" };
2154
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2155
2156
                this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
2157
2158
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2159
2160
                //강인구 Undo/Redo 보류
2161
                UndoData = new Undo_data()
2162
                {
2163
                    IsUndo = false,
2164
                    Event = Event_Type.Create,
2165
                    EventTime = DateTime.Now,
2166
                    Markup_List = new List<Multi_Undo_data>()
2167
                };
2168
2169
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2170
                {
2171
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2172
                });
2173
2174
                foreach (string parse in data)
2175
                {
2176
                    if (parse != "")
2177
                    {
2178
                        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
2179
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
2180
2181
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2182
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2183
2184
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2185
2186
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2187
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2188
2189
                        multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
2190
2191
                        UndoData.Markup_List.Add(multi_Undo_Data);
2192
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2193
                    }
2194
                }
2195
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2196
2197
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2198
                {
2199
                    Canvas.SetLeft(final, 0);
2200
                    Canvas.SetTop(final, 0);
2201
                }
2202
                else
2203
                {
2204
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2205
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2206
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2207
2208
                    if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2209
                    {
2210
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
2211
                    }
2212
                }
2213
                
2214
2215
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2216
2217
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2218
                //Canvas.SetLeft(final, 50);
2219
                //Canvas.SetTop(final, 50);
2220
            }
2221
            //외부 이미지 붙여넣기
2222
            else if (Clipboard.GetImage() != null)
2223
            {
2224
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2225
2226
                //강인구 Undo/Redo 보류
2227
                UndoData = new Undo_data()
2228
                {
2229
                    IsUndo = false,
2230
                    Event = Event_Type.Create,
2231
                    EventTime = DateTime.Now,
2232
                    Markup_List = new List<Multi_Undo_data>()
2233
                };
2234
2235
2236
                string temppath = System.IO.Path.GetTempPath();
2237
                //string filename = KCOM.Events.Save.shortCommentKey();
2238
                string filename = KCOM.Events.Save.shortFileKey();
2239
2240
                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2241
                clipboardImage.Save(temppath + "\\" + filename);
2242
2243
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2244
                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2245
                long numByte = fileInfo.Length;
2246
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2247
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2248
2249
                if (dLen < 4)
2250
                {
2251
                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2252
                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
2253
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2254
                    byte[] data = br.ReadBytes((int)numByte);
2255
2256
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2257
                    br.Close();
2258
                    fStream.Close();
2259
                    fStream.Dispose();
2260
                }
2261
                else
2262
                {
2263
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2264
                    return;
2265
                }
2266
2267
                fileInfo.Delete();
2268
2269
                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2270
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2271
                IntPtr hBitmap = bmp.GetHbitmap();
2272
                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2273
                Image img = new Image();
2274
                img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2275
2276
2277
2278
2279
2280
                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2281
                {
2282
                    PointSet = new List<Point>(),
2283
                    FilePath = img.Source.ToString(),
2284
                    ImageData = img.Source,
2285
                    StartPoint = new Point(100, 100),
2286
                    EndPoint = new Point(200, 200),
2287
                    TopRightPoint = new Point(100, 200),
2288
                    LeftBottomPoint = new Point(200, 100)
2289
                };
2290
2291
                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2292
                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2293
                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2294
2295
                currentControl.PointSet = new List<Point>
2296
                                        {
2297
                                            currentControl.StartPoint,
2298
                                            currentControl.LeftBottomPoint,
2299
                                            currentControl.EndPoint,
2300
                                            currentControl.TopRightPoint,
2301
                                        };
2302
2303
                multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2304
                UndoData.Markup_List.Add(multi_Undo_Data);
2305
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2306
2307
                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2308
                currentControl.CommentID = Events.Save.shortGuid();
2309
2310
                currentControl.ApplyTemplate();
2311
                currentControl.SetImage();
2312
2313
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2314
                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2315
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2316
2317
                double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2318
                double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2319
                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2320
            }
2321
        }
2322
2323
        public void Delete_Start()
2324
        {
2325
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2326
            {
2327
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2328
2329
                UndoData = new Undo_data()
2330
                {
2331
                    IsUndo = false,
2332
                    Event = Event_Type.Delete,
2333
                    EventTime = DateTime.Now,
2334
                    Markup_List = new List<Multi_Undo_data>()
2335
                };
2336
2337
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2338
                {
2339
                    if (item.GetType().Name == "AdornerFinal")
2340
                    {
2341
                        (item as Controls.AdornerFinal).unRegister();
2342
2343
                        foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2344
                        {
2345
                            //if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2346
                            if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
2347
                            {
2348
2349
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
2350
                                UndoData.Markup_List.Add(multi_Undo_Data);
2351
                                multi_Undo_Data = new Multi_Undo_data();
2352
2353
                                ViewerDataModel.Instance.MarkupControls.Remove(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
2354
2355
                                var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault();
2356
2357
                                ViewerDataModel.Instance.MarkupList_USER.Remove(Item_);
2358
                            }
2359
                        }
2360
                    }
2361
2362
                    ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2363
                    {
2364
                        ViewerDataModel.Instance.UndoDataList.Remove(i);
2365
                    });
2366
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2367
                }
2368
            }
2369
            this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2370
        }
2371
2372 787a4489 KangIngu
    }
2373
}
클립보드 이미지 추가 (최대 크기: 500 MB)