프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 65246dc9

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