프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 77922798

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

1 787a4489 KangIngu
using KCOM.Common;
2
using KCOM.Common.Converter;
3
using KCOM.Controls;
4
using KCOM.Events;
5 53880c83 ljiyeon
using KCOMDataModel.DataModel;
6 787a4489 KangIngu
using MarkupToPDF.Common;
7 53880c83 ljiyeon
using Svg2Xaml;
8 787a4489 KangIngu
using System;
9
using System.Collections.Generic;
10
using System.Linq;
11
using System.Text;
12
using System.Windows;
13
using System.Windows.Controls;
14
using System.Windows.Input;
15
using System.Windows.Media;
16 53880c83 ljiyeon
using System.Windows.Media.Imaging;
17 787a4489 KangIngu
using Telerik.Windows.Controls;
18 684ef11c ljiyeon
using IKCOM;
19
using Microsoft.Win32;
20
using System.IO;
21
using System.Reflection;
22
using System.Windows.Controls.Primitives;
23 036650a0 humkyung
using MarkupToPDF.Controls.Parsing;
24 2dfbf711 ljiyeon
using Telerik.Windows.Data;
25
using System.ComponentModel;
26 787a4489 KangIngu
27
namespace KCOM.Views
28
{
29
    public partial class TopMenu : UserControl
30
    {
31
        public int rotateOffSet = 0;
32
        private double[] rotateValue = { 0, 90, 180, 270 };
33
        public System.Windows.Threading.DispatcherTimer SaveTimer { get; set; }
34
        public bool isClosed = true;
35
        public RadWindow CheckPop;
36 53880c83 ljiyeon
        public RadWindow OptionPop;
37 787a4489 KangIngu
38
        /// <summary>
39
        /// TaskBar에 메시지를 입력합니다
40
        /// </summary>
41
        /// <param name="message"></param>
42
        /// <param name="type"></param>
43
        public void TaskMessage(string message, TaskMessageType type)
44
        {
45 129ca191 humkyung
            /*
46
            if (taskBar != null)
47
            {
48
                string color = "";
49
                taskBar.Content = message;
50
                DicTaskMessage.TryGetValue(type, out color);
51
                taskBar.Foreground = new SolidColorBrush(StringToColorConverter.Parse(color));
52
            }
53
            */
54 787a4489 KangIngu
        }
55
56
        /// <summary>
57
        /// Task Type명을 Key값으로 지정합니다
58
        /// </summary>
59
        public enum TaskMessageType
60
        {
61
            Normal,
62
            Caption,
63
            Error,
64
        }
65
66
        private void CheckShapeState()
67
        {
68
69
70
            if (cbHatchShape.IsChecked == true)
71
            {
72
                cbFillShape.IsChecked = false;
73
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
74
            }
75
            else if(cbFillShape.IsChecked == true)
76
            {
77
                cbHatchShape.IsChecked = false;
78
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
79
            }
80
            else
81
            {
82
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
83
            }
84
        }
85
86
        //강인구 추가(Undo End)
87
        private void SetPaintEvent()
88
        {
89
            List<AdornerMember> AdonerList = GetAdornerItem();
90
91
            if (AdonerList.Count > 0)
92
            {
93
                Undo_data UndoData = new Undo_data()
94
                {
95
                    IsUndo = false,
96
                    Event = Event_Type.Option,
97
                    EventTime = DateTime.Now,
98
                    paint = ViewerDataModel.Instance.paintSet,
99
                    Markup_List = new List<Multi_Undo_data>()
100
                };
101
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
102
103
                foreach (AdornerMember InnerItem in AdonerList)
104
                {
105
                    multi_Undo_Data.PointSet = new List<Point>();
106
107
                    if ((InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl) != null)
108
                    {
109
                        (InnerItem.DrawingData as MarkupToPDF.Controls.Common.IShapeControl).Paint = ViewerDataModel.Instance.paintSet;
110
                    }
111
112
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
113
                    UndoData.Markup_List.Add(multi_Undo_Data);
114
                    multi_Undo_Data = new Multi_Undo_data();
115
                }
116
117
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
118
                {
119 ccf944bb ljiyeon
                    ViewerDataModel.Instance.UndoDataList.Remove(i);                    
120 787a4489 KangIngu
                });
121
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
122
            }
123
        }
124
125
        private void SetHighlightEvent()
126
        {
127
            List<AdornerMember> AdonerList = GetAdornerItem();
128
129
            if (AdonerList.Count > 0)
130
            {
131
                foreach (AdornerMember InnerItem in AdonerList)
132
                {
133
                    switch (InnerItem.DrawingData.GetType().Name)
134
                    {
135
                        case ("TextControl"):
136
                            {
137
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape;
138
                            }
139
                            break;
140
                        case ("ArrowTextControl"):
141
                            {
142
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape;
143
                            }
144
                            break;
145
                    }
146
                }
147
            }
148
149
        }
150
151
        private void FillShapeEvent(object sender, RoutedEventArgs e)
152
        {
153
            #region 주석
154
            //if ((sender as CheckBox).IsChecked.Value)
155
            //{
156
            //    cbHatchShape.IsChecked = false;
157
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Fill.png", UriKind.Relative));
158
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Fill.png", UriKind.Relative));
159
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle_Fill.png", UriKind.Relative));
160
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon.png", UriKind.Relative));
161
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon.png", UriKind.Relative));
162
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_Fill.png", UriKind.Relative));
163
            //    TaskMessage("채우기 옵션이 적용되었습니다", TaskMessageType.Normal);
164
            //}
165
            //else
166
            //{
167
168
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
169
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
170
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
171
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
172
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
173
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
174
            //    TaskMessage("채우기 옵션이 해제되었습니다", TaskMessageType.Caption);
175
            //}
176
            #endregion
177
            ViewerDataModel.Instance.checkFillShape = (sender as CheckBox).IsChecked.Value;
178
179
            if (ViewerDataModel.Instance.checkFillShape)
180
            {
181
                cbHatchShape.IsChecked = false;
182
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Fill;
183
            }
184
            else
185
            {
186
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;
187
            }
188
            SetPaintEvent();
189
        }
190
191
        /// <summary>
192
        /// 도형 빗금 처리
193
        /// </summary>
194
        /// <param name="sender"></param>
195
        /// <param name="e"></param>
196
        private void HatchShapeEvent(object sender, RoutedEventArgs e)
197
        {
198
			#region 주석
199
            //if ((sender as CheckBox).IsChecked.Value)
200
            //{
201
            //    cbFillShape.IsChecked = false;
202
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud_Hatch.png", UriKind.Relative));
203
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud_Hatch.png", UriKind.Relative));
204
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/rectangle-icon_Hatch.png", UriKind.Relative));
205
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_Hatch.png", UriKind.Relative));
206
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_Hatch.png", UriKind.Relative));
207
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon_hatch.png", UriKind.Relative));
208
            //    TaskMessage("무늬 옵션이 적용되었습니다", TaskMessageType.Normal);
209
            //}
210
            //else
211
            //{
212
            //    imgShape_RectCloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/RectCloud.png", UriKind.Relative));
213
            //    imgShape_Cloud.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Cloud.png", UriKind.Relative));
214
            //    imgShape_Rect.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/Rectangle.png", UriKind.Relative));
215
            //    imgShape_Tri.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/triangle-icon_None.png", UriKind.Relative));
216
            //    imgShape_Cicle.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/circle-icon_None.png", UriKind.Relative));
217
            //    imgShape_Poly.Source = new BitmapImage(new Uri("/DeepView;component/Images/MenuImage/polygon.png", UriKind.Relative));
218
            //    TaskMessage("무늬 옵션이 해제되었습니다", TaskMessageType.Caption);
219
            //} 
220
            #endregion
221
222
            //강인구 추가
223
            ViewerDataModel.Instance.checkHatchShape = (sender as CheckBox).IsChecked.Value;
224
            if (ViewerDataModel.Instance.checkHatchShape)
225
            {
226
                cbFillShape.IsChecked = false;
227
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.Hatch;
228
            }
229
            else
230
            {
231
                ViewerDataModel.Instance.paintSet = MarkupToPDF.Controls.Common.PaintSet.None;  
232
            }
233
            SetPaintEvent();
234
        }
235
236
        void SaveTimer_Tick(object sender, EventArgs e)
237
        {
238
            //if (this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode != IKCOM.MouseHandlingMode.Drawing)
239
            if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl == null && this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count == 0)
240
            {
241 cb5c7f06 humkyung
                SaveEventCallback(null, null);
242 787a4489 KangIngu
            }
243
        }
244
245
        private void SaveTime(bool IsRun)
246
        {
247
            if(SaveTimer == null)
248
            {
249
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
250
                SaveTimer.Interval = new TimeSpan(0, 0, 5);
251
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
252
            }
253
254
            if (IsRun)
255
            {
256
                SaveTimer.Start();
257
            }
258
            else
259
            {
260
                SaveTimer.Stop();
261
            }
262
        }
263 537f4cd8 djkim
        private void SaveTime(bool IsRun,int timeinterval)
264
        {
265
            if (SaveTimer == null)
266
            {
267
                SaveTimer = new System.Windows.Threading.DispatcherTimer();
268
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
269
                SaveTimer.Tick += new EventHandler(SaveTimer_Tick);
270
            }
271
            else
272
            {
273
                SaveTimer.Stop();
274
                SaveTimer.Interval = new TimeSpan(0, timeinterval, 0);
275
            }
276 787a4489 KangIngu
277 537f4cd8 djkim
            if (IsRun)
278
            {
279
                SaveTimer.Start();
280
            }
281
            else
282
            {
283
                SaveTimer.Stop();
284
            }
285
        }
286 532d83ef humkyung
        /// <summary>
287
        /// enable busy indicator and then call _SaveEvent method.
288
        /// </summary>
289
        /// <param name="sender"></param>
290
        /// <param name="e"></param>
291 cb5c7f06 humkyung
        public void SaveEventCallback(object sender, RoutedEventArgs e)
292 787a4489 KangIngu
        {
293 532d83ef humkyung
            if (this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy == true) return;
294 787a4489 KangIngu
295 532d83ef humkyung
            this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = true;
296
            System.Threading.Tasks.Task SaveTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
297
            {
298
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action<object, RoutedEventArgs>(_SaveEvent), sender, e);
299
            }).ContinueWith(task =>
300
            {
301
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate () { this.ParentOfType<MainWindow>().dzMainMenu.busyIndicator.IsBusy = false; }));
302
            });
303
        }
304 787a4489 KangIngu
305 532d83ef humkyung
        /// <summary>
306 d62c0439 humkyung
        /// save markup
307 cb5c7f06 humkyung
        ///  - convert ink control to polygon control if ink control exists
308
        ///  - unselect and update my markup list
309 532d83ef humkyung
        /// <param name="sender"></param>
310
        /// <param name="e"></param>
311
        public void _SaveEvent(object sender, RoutedEventArgs e)
312
        {
313 d62c0439 humkyung
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
314 532d83ef humkyung
            try
315 787a4489 KangIngu
            {
316 cb5c7f06 humkyung
                menu.ConvertInkControlToPolygon();
317 f729ef4e humkyung
318 cb5c7f06 humkyung
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
319 8129f2a5 ljiyeon
                // update mylist and gridview
320
                menu.UpdateMyMarkupList();
321
322 129ca191 humkyung
                if (menu.gridViewMarkup.SelectedItems.Count == 0 && menu.gridViewMarkup.Items.Count > 0)
323 787a4489 KangIngu
                {
324 532d83ef humkyung
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("Please Select Your Comment List Item", "Alert");
325
                }
326
                else
327 8129f2a5 ljiyeon
                {                    
328 532d83ef humkyung
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
329 787a4489 KangIngu
                    {
330 532d83ef humkyung
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
331
                        {
332 d62c0439 humkyung
                            this.ExecuteSaveCommand(menu);
333 532d83ef humkyung
                            ViewerDataModel.Instance._markupInfoList.Where(data => data.MarkupInfoID == (item as IKCOM.MarkupInfoItem).MarkupInfoID).FirstOrDefault().UpdateTime = DateTime.Now;
334 cb5c7f06 humkyung
                            if (!ViewerDataModel.Instance.IsConsolidate && (sender != null))
335 532d83ef humkyung
                            {
336
                                this.ParentOfType<MainWindow>().DialogMessage_Alert("Save 가 완료되었습니다.", "Alert");
337
                            }
338 316d0f5c KangIngu
                        }
339 787a4489 KangIngu
                    }
340 532d83ef humkyung
                }
341 cb5c7f06 humkyung
342
                ViewerDataModel.Instance.UndoDataList.Clear();
343 787a4489 KangIngu
            }
344 cb5c7f06 humkyung
            catch (Exception ex)
345 399976da ljiyeon
            {
346 08a73330 ljiyeon
               
347 399976da ljiyeon
            }
348 532d83ef humkyung
            finally
349 316d0f5c KangIngu
            {
350 8129f2a5 ljiyeon
                /*
351 d62c0439 humkyung
                /// delete markup information when 코멘트가 없을 경우
352
                if (ViewerDataModel.Instance.MyMarkupList.Count == 0)
353
                {
354
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
355
                    {
356
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
357
                        {
358 8129f2a5 ljiyeon
                            //this.ParentOfType<MainWindow>().dzMainMenu.DeleteItem((item as IKCOM.MarkupInfoItem));
359 d62c0439 humkyung
                        }
360
                    }
361
                }
362 8129f2a5 ljiyeon
                */
363 316d0f5c KangIngu
            }
364 787a4489 KangIngu
        }
365
366 d62c0439 humkyung
        /// <summary>
367
        /// call save command
368
        /// </summary>
369
        /// <param name="menu"></param>
370
		private void ExecuteSaveCommand(MainMenu menu)
371 787a4489 KangIngu
        {
372 de6499db humkyung
            SaveCommand.Instance.Project_No = App.ViewInfo.ProjectNO;
373
            SaveCommand.Instance.document_id = App.ViewInfo.DocumentItemID;
374
            SaveCommand.Instance.user_id = App.ViewInfo.UserID;
375 129ca191 humkyung
            SaveCommand.Instance.page_no = menu.pageNavigator.CurrentPage.PageNumber;
376 787a4489 KangIngu
377
            try
378
            {
379 129ca191 humkyung
                if (ViewerDataModel.Instance.UndoDataList.Count > 0)
380 787a4489 KangIngu
                {
381 129ca191 humkyung
                    List<IKCOM.MarkupInfoItem> SelectedMarkupInfos = new List<IKCOM.MarkupInfoItem>();
382
                    foreach (var item in menu.gridViewMarkup.SelectedItems)
383 787a4489 KangIngu
                    {
384 129ca191 humkyung
                        if ((item as IKCOM.MarkupInfoItem).UserID == App.ViewInfo.UserID)
385
                        {
386
                            SelectedMarkupInfos.Add(item as IKCOM.MarkupInfoItem);
387
                        }
388 787a4489 KangIngu
                    }
389 129ca191 humkyung
390
                    SaveCommand.Instance.Execute(SelectedMarkupInfos);
391 787a4489 KangIngu
                }
392 2b19f5f2 djkim
393 129ca191 humkyung
                if(ViewerDataModel.Instance.RotationDocs.Count > 0)
394
                    SaveCommand.Instance.PageAngleSave(App.ViewInfo.ProjectNO, ViewerDataModel.Instance.RotationDocs);
395 787a4489 KangIngu
            }
396 cb33ad14 humkyung
            catch (Exception ex)
397 787a4489 KangIngu
            {
398 cb33ad14 humkyung
                this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(string.Format("세이브 실패:{0}", ex.Message), "Alert");
399 08a73330 ljiyeon
                throw ex;
400 787a4489 KangIngu
            }
401
        }
402
403
        //강인구 추가
404
        public void Print_Start(string Type)
405
        {
406 4c8bb207 djkim
            if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
407 787a4489 KangIngu
            {
408
                var menu = this.ParentOfType<MainWindow>().dzMainMenu;
409 077896be humkyung
                SelectionSet.Instance.UnSelect(menu);
410 787a4489 KangIngu
                if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
411
                {
412 cb5c7f06 humkyung
                    this.SaveEventCallback(null, null);
413 787a4489 KangIngu
                }
414
                else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
415
                {
416
417
                }
418
                else
419
                {
420 cb5c7f06 humkyung
                    this.SaveEventCallback(null, null);
421 787a4489 KangIngu
                }
422
            }
423
424
            bool isprint = false;
425
            if (Type == "Print")
426
            {
427
                isprint = true;
428
            }
429
430
            RadWindow PrintWindow = new RadWindow();
431 53880c83 ljiyeon
            //IKCOM.MarkupInfoItem _result = null;
432 787a4489 KangIngu
            PrintWindow.Width = 850;
433
            PrintWindow.Height = 600;
434
            //PrintWindow.Width = 650;
435
            //PrintWindow.Height = 550;
436
            PrintWindow.Header = Type;
437
438
            List<IKCOM.MarkupInfoItem> markupinfo = new List<IKCOM.MarkupInfoItem>();
439 0f065e57 ljiyeon
440
            Logger.sendReqLog("GetPrintDocItemList: ", App.ViewInfo.ProjectNO + "," + App.ViewInfo.DocumentItemID + "," + ViewerDataModel.Instance._markupInfoList.ToList(), 1);
441 6c781c0c djkim
            markupinfo = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetPrintDocItemList(App.ViewInfo.ProjectNO, App.ViewInfo.DocumentItemID, ViewerDataModel.Instance._markupInfoList.ToList());
442
443 0f065e57 ljiyeon
            if (markupinfo.Count() > 0)
444
            {
445
                Logger.sendResLog("GetPrintDocItemList", "TRUE", 1);
446
            }
447
            else
448
            {
449
                Logger.sendResLog("GetPrintDocItemList", "FALSE", 1);
450
            }
451
452 6c781c0c djkim
            var Tile_Url = string.Format(@"{0}/TileSource/{1}_Tile/{2}/{3}/",
453
                App.SystemInfo.HostName,
454
                App.ViewInfo.ProjectNO,
455
                (Convert.ToInt64(App.ViewInfo.DocumentItemID) / 100).ToString(),
456
                App.ViewInfo.DocumentItemID
457
                );
458
459
            PrintWindow.Content = new KCOM.Control.PrintControl(
460
                      Tile_Url,
461
                      App.ViewInfo.ProjectNO,
462
                      this.ParentOfType<MainWindow>().dzMainMenu._DocInfo, markupinfo,
463
                      this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber,
464
                      App.ViewInfo.DocumentItemID,
465
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO,
466
                      this.ParentOfType<MainWindow>().dzMainMenu._DocItem.ORIGINAL_FILE, isprint);
467 787a4489 KangIngu
468
            //프린트 팝업 옵션
469
            //PrintWindow.BorderThickness = new Thickness(3);
470
            //PrintWindow.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 37, 160, 218));
471
            PrintWindow.ResizeMode = System.Windows.ResizeMode.NoResize;
472
            PrintWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
473
            PrintWindow.Background = new SolidColorBrush(Colors.Black);
474
            PrintWindow.Background.Opacity = 0.6;
475 b9b01f8e ljiyeon
            PrintWindow.Owner = Application.Current.MainWindow;
476 787a4489 KangIngu
            Telerik.Windows.Controls.StyleManager.SetTheme(PrintWindow, new Telerik.Windows.Controls.VisualStudio2013Theme());
477
            PrintWindow.ShowDialog();
478
        }
479
480
        //강인구 추가
481
        private void PrintEvent(object sender, RoutedEventArgs e)
482
        {
483
            RadRibbonButton button = sender as RadRibbonButton;
484
            Print_Start(button.Content.ToString());
485
        }
486
487
        private List<AdornerMember> GetAdornerItem()
488
        {
489
            List<AdornerMember> AdonerList = new List<AdornerMember>();
490
491
            if (this.ParentOfType<MainWindow>() != null)
492
            {
493
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
494
                {
495
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
496
                    {
497
                        if (item.GetType().Name == "AdornerFinal")
498
                        {
499 4913851c humkyung
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
500 787a4489 KangIngu
                            {
501
                                AdonerList.Add(InnerItem);
502
                            }
503
                        }
504
                    }
505
                }
506
            }
507 4913851c humkyung
508 787a4489 KangIngu
            return AdonerList;
509
        }
510
        /// <summary>
511
        /// 투명도
512
        /// </summary>
513
        /// <param name="sender"></param>
514
        /// <param name="e"></param>
515
        //강인구 추가(Undo End)
516
        private void sdOpacity_ValueChanged(object sender, RoutedEventArgs e)
517
        {
518
            List<AdornerMember> AdonerList = GetAdornerItem();
519
            if(AdonerList.Count > 0)
520
            {
521
                Undo_data UndoData = new Undo_data()
522
                {
523
                    IsUndo = false,
524
                    Event = Event_Type.Option,
525
                    EventTime = DateTime.Now,
526
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
527
                    Markup_List = new List<Multi_Undo_data>()
528
                };
529
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
530
531
                foreach (AdornerMember InnerItem in AdonerList)
532
                {
533
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
534
                  
535
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
536
                    UndoData.Markup_List.Add(multi_Undo_Data);
537
                    multi_Undo_Data = new Multi_Undo_data();
538
                }
539
540
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
541
                {
542
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
543
                });
544
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
545
            }
546
        }
547
548
        //강인구 추가(Undo End)
549
        private void cbLineSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
550
        {
551 be04d12c djkim
            if (string.IsNullOrEmpty(cbLineSize.Value.ToString()))
552
            {
553
                cbLineSize.Value = cbLineSize.Minimum;
554
            }
555 787a4489 KangIngu
            List<AdornerMember> AdonerList = GetAdornerItem();
556
            if (AdonerList.Count > 0)
557
            {
558
                Undo_data UndoData = new Undo_data()
559
                {
560
                    IsUndo = false,
561
                    Event = Event_Type.Option,
562
                    EventTime = DateTime.Now,
563
                    LineSize = ViewerDataModel.Instance.LineSize,
564
                    Markup_List = new List<Multi_Undo_data>()
565
                };
566
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
567
568
                foreach (AdornerMember InnerItem in AdonerList)
569
                {
570
                    switch (InnerItem.DrawingData.GetType().Name)
571
                    {
572
                        case ("LineControl"):
573
                            {
574
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).LineSize = ViewerDataModel.Instance.LineSize;
575
                            }
576
                            break;
577
                        case ("ArcControl"):
578
                            {
579
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).LineSize = ViewerDataModel.Instance.LineSize;
580
                            }
581
                            break;
582 40b3ce25 ljiyeon
                        case ("ArrowArcControl"):
583
                            {
584
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).LineSize = ViewerDataModel.Instance.LineSize;
585
                            }
586
                            break;
587 787a4489 KangIngu
                        case ("ArrowControl_Multi"):
588
                            {
589
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).LineSize = ViewerDataModel.Instance.LineSize;
590
                            }
591
                            break;
592
                        case ("CloudControl"):
593
                            {
594
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).LineSize = ViewerDataModel.Instance.LineSize;
595
                            }
596
                            break;
597
                        case ("PolygonControl"):
598
                            {
599
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).LineSize = ViewerDataModel.Instance.LineSize;
600
                            }
601
                            break;
602
                        case ("RectangleControl"):
603
                            {
604
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).LineSize = ViewerDataModel.Instance.LineSize;
605
                            }
606
                            break;
607
                        case ("RectCloudControl"):
608
                            {
609
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).LineSize = ViewerDataModel.Instance.LineSize;
610
                            }
611
                            break;
612
                        case ("TriControl"):
613
                            {
614
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).LineSize = ViewerDataModel.Instance.LineSize;
615
                            }
616
                            break;
617
                        case ("CircleControl"):
618
                            {
619
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).LineSize = ViewerDataModel.Instance.LineSize;
620
                            }
621
                            break;
622 f8769f8a ljiyeon
                        case ("ArrowTextControl"):
623
                            {
624
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).LineSize = ViewerDataModel.Instance.LineSize;
625
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).BorderSize = new Thickness(ViewerDataModel.Instance.LineSize);
626
                            }
627
                            break;
628
                        case ("TextControl"):
629
                            {
630
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).LineSize = new Thickness(ViewerDataModel.Instance.LineSize);
631
                            }
632
                            break;
633 684ef11c ljiyeon
                        case ("InsideWhiteControl"):
634
                            {
635
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
636
                            }
637
                            break;
638
                        case ("OverlapWhiteControl"):
639
                            {
640
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
641
                            }
642
                            break;
643
                        case ("ClipWhiteControl"):
644
                            {
645
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).LineSize = ViewerDataModel.Instance.LineSize;
646
                            }
647
                            break;
648
                        case ("CoordinateControl"):
649
                            {
650
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).LineSize = 10; //ViewerDataModel.Instance.LineSize
651
                            }
652
                            break;
653 787a4489 KangIngu
                    }
654
                    
655
656
                    multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
657
                    UndoData.Markup_List.Add(multi_Undo_Data);
658
                    multi_Undo_Data = new Multi_Undo_data();
659
                }
660
661
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
662
                {
663
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
664
                });
665
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
666 5822e146 ljiyeon
667
                
668 787a4489 KangIngu
            }
669 5822e146 ljiyeon
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
670
            Properties.Settings.Default.Save();
671 787a4489 KangIngu
        }
672
673 5ce56a3a KangIngu
674
        private void cbIntervalSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
675
        {
676 be04d12c djkim
            if (string.IsNullOrEmpty(cbIntervalSize.Value.ToString()))
677
            {
678
                cbIntervalSize.Value = cbIntervalSize.Minimum;
679
            }
680 5ce56a3a KangIngu
            List<AdornerMember> AdonerList = GetAdornerItem();
681
            if (AdonerList.Count > 0)
682
            {
683
684
                Undo_data UndoData = new Undo_data()
685
                {
686
                    IsUndo = false,
687
                    Event = Event_Type.Option,
688
                    EventTime = DateTime.Now,
689
                    Interval = ViewerDataModel.Instance.Interval,
690
                    Markup_List = new List<Multi_Undo_data>()
691
                };
692
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
693
694
                foreach (AdornerMember InnerItem in AdonerList)
695
                {
696
                    switch (InnerItem.DrawingData.GetType().Name)
697
                    {
698
                        case ("LineControl"):
699
                            {
700
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
701
702
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
703
                                UndoData.Markup_List.Add(multi_Undo_Data);
704
                                multi_Undo_Data = new Multi_Undo_data();
705
                            }
706
                            break;
707
                    }
708
                }
709
710
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
711
                {
712
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
713
                });
714
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
715
            }
716 5822e146 ljiyeon
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
717
            Properties.Settings.Default.Save();
718 5ce56a3a KangIngu
        }
719 537f4cd8 djkim
        
720 9f473fb7 KangIngu
        private void cbArcLength_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
721
        {
722 be04d12c djkim
            if (string.IsNullOrEmpty(cbArcLength.Value.ToString()))
723
            {
724
                cbArcLength.Value = cbArcLength.Minimum;
725
            }
726 9f473fb7 KangIngu
            List<AdornerMember> AdonerList = GetAdornerItem();
727
            if (AdonerList.Count > 0)
728
            {
729
730
                //Undo_data UndoData = new Undo_data()
731
                //{
732
                //    IsUndo = false,
733
                //    Event = Event_Type.Option,
734
                //    EventTime = DateTime.Now,
735
                //    Interval = ViewerDataModel.Instance.Interval,
736
                //    Markup_List = new List<Multi_Undo_data>()
737
                //};
738
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
739
740
                foreach (AdornerMember InnerItem in AdonerList)
741
                {
742
                    switch (InnerItem.DrawingData.GetType().Name)
743
                    {
744
                        case ("RectCloudControl"):
745
                            {
746
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
747
748
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
749
                                //UndoData.Markup_List.Add(multi_Undo_Data);
750
                                //multi_Undo_Data = new Multi_Undo_data();
751
                            }
752
                            break;
753
                        case ("CloudControl"):
754
                            {
755
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength;
756
757
                                //multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
758
                                //UndoData.Markup_List.Add(multi_Undo_Data);
759
                                //multi_Undo_Data = new Multi_Undo_data();
760
                            }
761
                            break;
762
                    }
763
                }
764
765
                //ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
766
                //{
767
                //    ViewerDataModel.Instance.UndoDataList.Remove(i);
768
                //});
769
                //ViewerDataModel.Instance.UndoDataList.Add(UndoData);
770
            }
771 5822e146 ljiyeon
772
            KCOM.Properties.Settings.Default.ArcLength = (double)cbArcLength.Value;
773
            Properties.Settings.Default.Save();
774 9f473fb7 KangIngu
        }
775
776 787a4489 KangIngu
        //강인구 추가(Undo End)
777
        private void cbDashStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
778
        {
779
            //강인구 추가
780
            if (this.ParentOfType<MainWindow>() != null)
781
            {
782
                ViewerDataModel.Instance.DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
783
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
784
                {
785
                    Undo_data UndoData = new Undo_data()
786
                    {
787
                        IsUndo = false,
788
                        Event = Event_Type.Option,
789
                        EventTime = DateTime.Now,
790
                        DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData,
791
                        Markup_List = new List<Multi_Undo_data>()
792
                    };
793
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
794
795
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
796
                    {
797
                        if (item.GetType().Name == "AdornerFinal")
798
                        {
799 4913851c humkyung
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
800 787a4489 KangIngu
                            {
801
                                switch (InnerItem.DrawingData.GetType().Name)
802
                                {
803
                                    case ("LineControl"):
804
                                        {
805
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
806
                                        }
807
                                        break;
808
                                    case ("ArcControl"):
809
                                        {
810
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
811
                                        }
812
                                        break;
813 40b3ce25 ljiyeon
                                    case ("ArrowArcControl"):
814
                                        {
815
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowArcControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
816
                                        }
817
                                        break;
818 787a4489 KangIngu
                                    case ("ArrowControl_Multi"):
819
                                        {
820
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Line.ArrowControl_Multi).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
821
                                        }
822
                                        break;
823
                                    case ("CloudControl"):
824
                                        {
825
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.CloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
826
                                        }
827
                                        break;
828
                                    case ("PolygonControl"):
829
                                        {
830
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Polygon.PolygonControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
831
                                        }
832
                                        break;
833
                                    case ("RectangleControl"):
834
                                        {
835
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectangleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
836
                                        }
837
                                        break;
838
                                    case ("RectCloudControl"):
839
                                        {
840
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.RectCloudControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
841
                                        }
842
                                        break;
843
                                    case ("TriControl"):
844
                                        {
845
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.TriControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
846
                                        }
847
                                        break;
848
                                    case ("CircleControl"):
849
                                        {
850
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Shape.CircleControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
851
                                        }
852 684ef11c ljiyeon
                                        break;
853
                                    case ("InsideWhiteControl"):
854
                                        {
855
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.InsideWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
856
                                        }
857
                                        break;
858
                                    case ("OverlapWhiteControl"):
859
                                        {
860
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.OverlapWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
861
                                        }
862
                                        break;
863
                                    case ("ClipWhiteControl"):
864
                                        {
865
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.ClipWhiteControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
866
                                        }
867
                                        break;
868
                                    case ("CoordinateControl"):
869
                                        {
870
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Cad.CoordinateControl).DashSize = (cbDashStyle.SelectedValue as DashStyle).dashData;
871
                                        }
872
                                        break;
873 787a4489 KangIngu
                                }
874
875
                                multi_Undo_Data.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
876
                                UndoData.Markup_List.Add(multi_Undo_Data);
877
                                multi_Undo_Data = new Multi_Undo_data();
878
                            }
879
880
                            ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
881
                            {
882
                                ViewerDataModel.Instance.UndoDataList.Remove(i);
883
                            });
884
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
885
                        }
886
                    }
887
                }
888
            }
889
        }
890
891
        //강인구 추가
892
        private void comboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e)
893
        {
894 d4b0c723 KangIngu
            //if (this.ParentOfType<MainWindow>() != null)
895
            //{
896
            //    if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
897
            //    {
898
            //        foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
899
            //        {
900
            //            if (item.GetType().Name == "AdornerFinal")
901
            //            {
902
            //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
903
            //                {
904
            //                    switch (InnerItem.DrawingData.GetType().Name)
905
            //                    {
906
            //                        case ("TextControl"):
907
            //                            {
908
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Text);
909
            //                            }
910
            //                            break;
911
            //                        case ("ArrowTextControl"):
912
            //                            {
913
            //                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Text);
914
            //                            }
915
            //                            break;
916
            //                    }
917
            //                }
918
            //            }
919
            //        }
920
            //    }
921
            //}
922 787a4489 KangIngu
        }
923
924
        //강인구 추가
925
        private void btnBold_Checked(object sender, RoutedEventArgs e)
926
        {
927
            if (this.ParentOfType<MainWindow>() != null)
928
            {
929
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
930
                {
931
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
932
                    {
933
                        if (item.GetType().Name == "AdornerFinal")
934
                        {
935 4913851c humkyung
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
936 787a4489 KangIngu
                            {
937
                                switch (InnerItem.DrawingData.GetType().Name)
938
                                {
939
                                    case ("TextControl"):
940
                                        {
941 d4b0c723 KangIngu
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight == FontWeights.Bold)
942 787a4489 KangIngu
                                            {
943
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Normal;
944
                                            }
945
                                            else
946
                                            {
947 d4b0c723 KangIngu
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextWeight = FontWeights.Bold;
948 787a4489 KangIngu
                                            }
949
950
                                        }
951
                                        break;
952
                                    case ("ArrowTextControl"):
953
                                        {
954 d4b0c723 KangIngu
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight == FontWeights.Bold)
955 787a4489 KangIngu
                                            {
956
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Normal;
957
                                            }
958
                                            else
959
                                            {
960 d4b0c723 KangIngu
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextWeight = FontWeights.Bold;
961 787a4489 KangIngu
                                            }
962
                                        }
963
                                        break;
964
                                }
965
                            }
966
                        }
967
                    }
968
                }
969
            }
970
        }
971
972
        //강인구 추가
973
        private void btnItalic_Checked(object sender, RoutedEventArgs e)
974
        {
975
            if (this.ParentOfType<MainWindow>() != null)
976
            {
977
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
978
                {
979
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
980
                    {
981
                        if (item.GetType().Name == "AdornerFinal")
982
                        {
983 4913851c humkyung
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
984 787a4489 KangIngu
                            {
985
                                switch (InnerItem.DrawingData.GetType().Name)
986
                                {
987
                                    case ("TextControl"):
988
                                        {
989
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle == FontStyles.Italic)
990
                                            {
991
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = System.Windows.FontStyles.Normal;
992
                                            }
993
                                            else
994
                                            {
995
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextStyle = FontStyles.Italic;
996
                                            }
997
998
                                        }
999
                                        break;
1000
                                    case ("ArrowTextControl"):
1001
                                        {
1002
                                            if((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle == FontStyles.Italic)
1003
                                            {
1004
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Normal;
1005
                                            }
1006
                                            else
1007
                                            {
1008
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextStyle = FontStyles.Italic;
1009
                                            }
1010
                                        }
1011
                                        break;
1012
                                }
1013
                            }
1014
                        }
1015
                    }
1016
                }
1017
            }
1018
        }
1019
1020
        //강인구 추가
1021
        private void btnUnderLine_Checked(object sender, RoutedEventArgs e)
1022
        {
1023
            if (this.ParentOfType<MainWindow>() != null)
1024
            {
1025
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1026
                {
1027
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1028
                    {
1029
                        if (item.GetType().Name == "AdornerFinal")
1030
                        {
1031 4913851c humkyung
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1032 787a4489 KangIngu
                            {
1033
                                switch (InnerItem.DrawingData.GetType().Name)
1034
                                {
1035
                                    case ("TextControl"):
1036
                                        {
1037
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine == TextDecorations.Underline)
1038
                                            {
1039
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = null;
1040
                                            }
1041
                                            else
1042
                                            {
1043
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1044
                                            }
1045
                                        }
1046
                                        break;
1047
                                    case ("ArrowTextControl"):
1048
                                        {
1049
                                            if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1050
                                            {
1051
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1052
                                            }
1053
                                            else
1054
                                            {
1055
                                                (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1056
                                            }
1057
                                        }
1058
                                        break;
1059
                                }
1060
                            }
1061
                        }
1062
                    }
1063
                }
1064
            }
1065
        }
1066 5ce56a3a KangIngu
1067
        private void AxisLockEvent(object sender, RoutedEventArgs e)
1068
        {
1069
            ViewerDataModel.Instance.checkAxis = cbAxisLock.IsChecked.Value;
1070
        }
1071
1072 d4b0c723 KangIngu
        private void comboFontSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
1073
        {
1074 be04d12c djkim
            if (string.IsNullOrEmpty(comboFontSize.Value.ToString()))
1075
            {
1076
                comboFontSize.Value = comboFontSize.Minimum;
1077
            }
1078 d4b0c723 KangIngu
            if (this.ParentOfType<MainWindow>() != null)
1079
            {
1080
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1081
                {
1082
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1083
                    {
1084
                        if (item.GetType().Name == "AdornerFinal")
1085
                        {
1086 4913851c humkyung
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1087 d4b0c723 KangIngu
                            {
1088
                                switch (InnerItem.DrawingData.GetType().Name)
1089
                                {
1090
                                    case ("TextControl"):
1091
                                        {
1092
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1093
                                        }
1094
                                        break;
1095
                                    case ("ArrowTextControl"):
1096
                                        {
1097
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).TextSize = int.Parse(comboFontSize.Value.ToString());
1098
                                        }
1099
                                        break;
1100
                                }
1101
                            }
1102
                        }
1103
                    }
1104
                }
1105
            }
1106 5822e146 ljiyeon
            KCOM.Properties.Settings.Default.TextSize = (double)comboFontSize.Value;
1107
            Properties.Settings.Default.Save();
1108 d4b0c723 KangIngu
        }
1109
1110 787a4489 KangIngu
        //강인구 추가
1111
        private void RadRibbonComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
1112
        {
1113
            if (this.ParentOfType<MainWindow>() != null)
1114
            {
1115
                if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
1116
                {
1117
                    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
1118
                    {
1119
                        if (item.GetType().Name == "AdornerFinal")
1120
                        {
1121 4913851c humkyung
                            foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
1122 787a4489 KangIngu
                            {
1123
                                switch (InnerItem.DrawingData.GetType().Name)
1124
                                {
1125
                                    case ("TextControl"):
1126
                                        {
1127
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).FontFamily == TextDecorations.Underline)
1128
                                            //{
1129 55d4f382 송근호
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).SetFontFamily(new FontFamily(comboFontFamily.Text));
1130
                                            //(InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBlock.FontFamily = new FontFamily(comboFontFamily.Text);
1131
                                            //(InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).Base_TextBox.FontFamily = new FontFamily(comboFontFamily.Text);
1132
                                            //(InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).TextFamily = new FontFamily(comboFontFamily.Text);
1133 787a4489 KangIngu
                                            //}
1134
                                            //else
1135
                                            //{
1136
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.TextControl).UnderLine = TextDecorations.Underline;
1137
                                            //}
1138
                                        }
1139
                                        break;
1140
                                    case ("ArrowTextControl"):
1141
                                        {
1142 55d4f382 송근호
                                            (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).SetFontFamily(new FontFamily(comboFontFamily.Text));
1143 787a4489 KangIngu
                                            //if ((InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine == TextDecorations.Underline)
1144
                                            //{
1145
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = null;
1146
                                            //}
1147
                                            //else
1148
                                            //{
1149
                                            //    (InnerItem.DrawingData as MarkupToPDF.Controls.Text.ArrowTextControl).UnderLine = TextDecorations.Underline;
1150
                                            //}
1151
                                        }
1152
                                        break;
1153
                                }
1154
                            }
1155
                        }
1156
                    }
1157
                }
1158
            }
1159
        }
1160
1161
        /// <summary>
1162
        /// 텍스트 컨트롤 하일라이트 처리
1163
        /// </summary>
1164
        /// <param name="sender"></param>
1165
        /// <param name="e"></param>
1166
        private void HighlightEvent(object sender, RoutedEventArgs e)
1167
        {
1168
1169
            ViewerDataModel.Instance.checkHighShape = (sender as CheckBox).IsChecked.Value;
1170
            SetHighlightEvent();
1171
            //if ((sender as CheckBox).IsChecked.Value)
1172
            //{
1173
            //    TaskMessage("HighLight가 설정되었습니다", TaskMessageType.Normal);
1174
            //}
1175
            //else
1176
            //{
1177
            //    TaskMessage("HighLight가 해제되었습니다", TaskMessageType.Caption);
1178
            //}
1179
            //if (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl != null)
1180
            //{
1181
            //    MarkupToPDF.Controls.Text.TextControl instance = (ViewerDataModel.Instance.SelectedEditor as MarkupToPDF.Controls.Text.TextControl);
1182
            //    instance.IsHighLight = ViewerDataModel.Instance.checkHighShape;
1183
            //    instance.SetText();
1184
            //}
1185
        }
1186
1187 3026d214 ljiyeon
        //추가페이지 이동 엔터
1188 787a4489 KangIngu
        private void tlcurrentPage_KeyDown(object sender, KeyEventArgs e)
1189
        {
1190
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1191
            if (e.Key == Key.Enter)
1192
            {
1193
                try
1194
                {
1195
                    var instanceMain = this.ParentOfType<MainWindow>();
1196 baacbc36 송근호
                    var max = instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Max(f => f.PageNumber);
1197
                    if (string.IsNullOrEmpty(tlcurrentPage.Text))
1198
                    {
1199
                        RadWindow.Alert(new DialogParameters
1200
                        {
1201
                            Owner = Application.Current.MainWindow,
1202
                            Theme = new VisualStudio2013Theme(),
1203
                            Header = "안내",
1204
                            Content = "페이지 번호를 정확하게 입력해 주세요",
1205
                        });
1206
                    }
1207
                    else
1208
                    {
1209
                        if (Convert.ToInt32(tlcurrentPage.Text) > max || Convert.ToInt32(tlcurrentPage.Text) == 0)
1210
                        {
1211
                            RadWindow.Alert(new DialogParameters
1212
                            {
1213
                                Owner = Application.Current.MainWindow,
1214
                                Theme = new VisualStudio2013Theme(),
1215
                                Header = "안내",
1216
                                Content = "페이지 번호를 정확하게 입력해 주세요",
1217
                            });
1218
                        }
1219
                        else
1220
                        {
1221
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text));
1222
                        }
1223
                    }
1224
                    
1225 787a4489 KangIngu
                }
1226
                catch (Exception)
1227
                {
1228
                    RadWindow.Alert(new DialogParameters
1229
                    {
1230 b9b01f8e ljiyeon
                        Owner = Application.Current.MainWindow,
1231 787a4489 KangIngu
                        Theme = new VisualStudio2013Theme(),
1232
                        Header = "안내",
1233
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1234
                    });
1235
                }
1236
                
1237
            }
1238
        }
1239 baacbc36 송근호
        private string previousText;
1240
        private void TlcurrentPage_PreviewTextInput(object sender, TextCompositionEventArgs e)
1241
        {
1242
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[^0-9]+");
1243
            e.Handled = regex.IsMatch(e.Text);
1244
        }
1245
        private void TlcurrentPage_TextChanged(object sender, TextChangedEventArgs e)
1246
        {
1247
            double num = 0;
1248
            bool success = double.TryParse(((TextBox)sender).Text, out num);
1249
            if (success & num >= 0)
1250
                previousText = ((TextBox)sender).Text;
1251
            else
1252
            {
1253
                if (string.IsNullOrEmpty(((TextBox)sender).Text))
1254
                {
1255
                    ((TextBox)sender).Text = "";
1256
                }
1257
                else
1258
                {
1259
1260
                    ((TextBox)sender).Text = previousText;
1261
                }
1262
            }
1263
        }
1264
1265 3908a575 humkyung
        /// <summary>
1266
        /// 입력한 페이지로 이동한다
1267
        /// </summary>
1268
        /// <param name="sender"></param>
1269
        /// <param name="e"></param>
1270 3026d214 ljiyeon
        private void tlcurrentPage_readonly_KeyDown(object sender, KeyEventArgs e)
1271
        {
1272
            if (e.Key == Key.Enter)
1273
            {
1274
                try
1275
                {
1276
                    var instanceMain = this.ParentOfType<MainWindow>();
1277
                    instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage_readonly.Text));
1278
                }
1279
                catch (Exception)
1280
                {
1281
                    RadWindow.Alert(new DialogParameters
1282
                    {
1283 b9b01f8e ljiyeon
                        Owner = Application.Current.MainWindow,
1284 3026d214 ljiyeon
                        Theme = new VisualStudio2013Theme(),
1285
                        Header = "안내",
1286
                        Content = "페이지 번호를 정확하게 입력해 주세요",
1287
                    });
1288
                }
1289
            }
1290
        }
1291
        
1292 787a4489 KangIngu
        private void PanoramaEvent(object sender, RoutedEventArgs e)
1293
        {
1294
            PanoramaShow();
1295
        }
1296
1297
        public void PanoramaShow()
1298
        {
1299
            Panorama check = new Panorama();
1300
            double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
1301
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
1302
            //double windowWidth = this.Width;
1303
            //double windowHeight = this.Height;
1304
1305
            var PanoramaPop = new RadWindow
1306
            {
1307
                //MinWidth = 600,
1308
                //MinHeight = 400,
1309
                //Header = "My Check List",
1310
                Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1311
                Content = check,
1312
                Owner = this,
1313
                ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1314
                //ResizeMode = System.Windows.ResizeMode.NoResize,
1315
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1316
                IsTopmost = false,
1317
                //Left = (screenWidth / 2) - (windowWidth / 2),
1318
                //Top = (screenHeight / 2) - (windowHeight / 2),
1319
                //Left = (screenWidth / 2),
1320
                //Top = (screenHeight / 2),
1321
                Width = screenWidth * 0.4,
1322
                Height = screenHeight * 0.4,
1323
            };
1324
            StyleManager.SetTheme(PanoramaPop, new VisualStudio2013Theme());
1325
            //CheckPop.ShowDialog();
1326 b9b01f8e ljiyeon
            PanoramaPop.Owner = Application.Current.MainWindow;
1327 787a4489 KangIngu
            PanoramaPop.Show();
1328
        }
1329 d4b0c723 KangIngu
1330 787a4489 KangIngu
        private void CheckEvent(object sender, RoutedEventArgs e)
1331
        {
1332
            //창이 떠있을 경우 재 실행 방지
1333
            if (isClosed)
1334
            {
1335
                //토글 및 마우스 상태 초기화
1336
                var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
1337
                foreach(var togle in toggleList)
1338
                {
1339
                    togle.IsChecked = false;
1340
                }
1341
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1342
1343
                isClosed = false;
1344
1345
                
1346 77922798 송근호
                CheckList check = new CheckList(this.ParentOfType<MainWindow>());
1347 787a4489 KangIngu
1348
                CheckPop = new RadWindow
1349
                {
1350
                    MinWidth = 1200,
1351
                    MinHeight = 500,
1352
                    //Header = "My Check List",
1353
                    Header = "Document No : " + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO + " / Revision :" + this.ParentOfType<MainWindow>().dzMainMenu._DocItem.REVISION,
1354
                    Content = check,
1355
                    //Owner = this,
1356
                    //ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip,
1357
                    ResizeMode = System.Windows.ResizeMode.NoResize,
1358
                    WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen,
1359
                    IsTopmost = true,
1360
                };
1361
                StyleManager.SetTheme(CheckPop, new Office2013Theme());
1362
                CheckPop.Closed += CheckPop_Closed;
1363 29010418 ljiyeon
                
1364 787a4489 KangIngu
                //CheckPop.ShowDialog();
1365
                CheckPop.Show();
1366
            }
1367
        }
1368
1369 53880c83 ljiyeon
        private void OptionPop_Closed(object sender, WindowClosedEventArgs e)
1370
        {
1371
            isClosed = true;
1372
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1373
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1374
            ViewerDataModel.Instance.Capture_Opacity = 0;
1375
        }
1376
1377 787a4489 KangIngu
        private void CheckPop_Closed(object sender, WindowClosedEventArgs e)
1378
        {
1379
            isClosed = true;
1380
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
1381
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1382
            ViewerDataModel.Instance.Capture_Opacity = 0;
1383
        }
1384
1385 64f6713a humkyung
        /// <summary>
1386
        /// 사용자가 선택한 페이지로 이동(썸네일 동기화 시킴)
1387
        /// </summary>
1388
        /// <param name="sender"></param>
1389
        /// <param name="e"></param>
1390 787a4489 KangIngu
        private void PageGoEvent(object sender, RoutedEventArgs e)
1391
        {
1392
            RadButton button = sender as RadButton;
1393
            var instanceMain = this.ParentOfType<MainWindow>();
1394
            
1395
            //강인구 추가 tlcurrentPage을 이상하게 입력할수 있기때문에 Try Catch
1396
            try
1397
            {
1398
                switch (button.CommandParameter.ToString())
1399
                {
1400
                    case "Down":
1401
                        {
1402
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) + 1);
1403
                        }
1404
                        break;
1405
                    case "Up":
1406
                        {
1407
                            instanceMain.dzMainMenu.pageNavigator.GotoPage(Convert.ToInt32(tlcurrentPage.Text) - 1);
1408
                        }
1409
                        break;
1410
                }
1411
            }
1412
            catch (Exception)
1413
            {
1414
                RadWindow.Alert(new DialogParameters
1415
                {
1416 b9b01f8e ljiyeon
                    Owner = Application.Current.MainWindow,
1417 787a4489 KangIngu
                    Theme = new VisualStudio2013Theme(),
1418
                    Header = "안내",
1419
                    Content = "페이지 번호를 정확하게 입력해 주세요",
1420
                });
1421
            }
1422
        }
1423
1424
        private void viewEvent(object sender, RoutedEventArgs e)
1425
        {
1426 9f473fb7 KangIngu
            RadRibbonToggleButton viewButton = sender as RadRibbonToggleButton;
1427 787a4489 KangIngu
            var instanceMain = this.ParentOfType<MainWindow>();
1428
1429
            Point point = new Point(instanceMain.dzMainMenu.zoomAndPanCanvas.Width / 2, instanceMain.dzMainMenu.zoomAndPanCanvas.Height / 2);
1430
1431 9f473fb7 KangIngu
            //if ((sender as RadRibbonToggleButton) != null)
1432
            //{
1433
            //    Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1434
            //    instanceToggle = (sender as RadRibbonToggleButton);
1435
            //}
1436
1437
            //instanceToggle.IsChecked = false;
1438
1439 787a4489 KangIngu
            switch (viewButton.CommandParameter.ToString())
1440
            {
1441
                case "zoomout":
1442
                    {
1443
                        //장원
1444
                        //instanceMain.dzMainMenu.zoomAndPanControl.ZoomTo(new Rect(0, 0, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualWidth, instanceMain.dzMainMenu.zoomAndPanCanvas.ActualHeight));
1445
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale -= 0.1, point);
1446 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1447 787a4489 KangIngu
                        //Common.ViewerDataModel.Instance.zom
1448
                    }
1449
                    break;
1450
                case "zoomin":
1451
                    {
1452
                        instanceMain.dzMainMenu.zoomAndPanControl.ZoomPointToViewportCenter(ViewerDataModel.Instance.ContentScale += 0.1, point);
1453 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1454 787a4489 KangIngu
                    }
1455
                    break;
1456
                case "fullscreen":
1457
                    {
1458
                        instanceMain.WindowState = WindowState.Maximized;
1459
                        //Sizemode 대기(강인구)
1460
                        //instanceMain.dzMainMenu.imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
1461
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1462 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1463 787a4489 KangIngu
                    }
1464
                    break;
1465
                case "fitWidth":
1466
                    {
1467
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1468 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1469 787a4489 KangIngu
                    }
1470
                    break;
1471
                case "fitHeight":
1472
                    {
1473
                        instanceMain.dzMainMenu.zoomAndPanControl.ScaleToFit();
1474 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1475 787a4489 KangIngu
                    }
1476
                    break;
1477
                case "boundzoom":
1478
                    {
1479 9f473fb7 KangIngu
1480 787a4489 KangIngu
                    }
1481
                    break;
1482
                case "Rotate_M":
1483
                    {
1484
                        drawingPannelRotate(false);
1485 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1486 787a4489 KangIngu
                    }
1487
                    break;
1488
                case "Rotate_P":
1489
                    {
1490
                        drawingPannelRotate(true);
1491 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1492 787a4489 KangIngu
                    }
1493
                    break;
1494
                case "Rotate_half":
1495
                    {
1496
                        drawingPannelRotate(true);
1497
                        drawingPannelRotate(true);
1498 9f473fb7 KangIngu
                        viewButton.IsChecked = false;
1499 787a4489 KangIngu
                    }
1500
                    break;
1501
            }
1502
        }
1503
1504 d4b0c723 KangIngu
        private void Control_Event(object sender, RoutedEventArgs e)
1505
        {
1506
1507
        }
1508
1509 787a4489 KangIngu
        #region 대기
1510
1511
        public void drawingPannelRotate(bool Flag)
1512
        {
1513
            var instanceMain = this.ParentOfType<MainWindow>();
1514
1515
            //if (rotateOffSet > 3)
1516
            //    rotateOffSet = 0;
1517
1518
            //if (rotateOffSet < 0)
1519
            //    rotateOffSet = 3;
1520
1521
            if(Flag)
1522
            {
1523
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
1524
                {
1525
                    instanceMain.dzMainMenu.rotate.Angle = 0;
1526
                }
1527
                else
1528
                {
1529
                    instanceMain.dzMainMenu.rotate.Angle += 90;
1530
                }
1531
            }
1532
            else
1533
            {
1534
                if(instanceMain.dzMainMenu.rotate.Angle == 0)
1535
                {
1536
                    instanceMain.dzMainMenu.rotate.Angle = 270;
1537
                }
1538
                else
1539
                {
1540
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
1541
                }
1542
            }
1543
            //double angle = (double)rotateValue.GetValue(rotateOffSet);
1544
            //instanceMain.dzMainMenu.rotate.Angle = angle;
1545
            var rotationNum = Math.Abs((instanceMain.dzMainMenu.rotate.Angle / 90));
1546
1547
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
1548
            {
1549
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1550
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1551
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
1552
            }
1553
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
1554
            {
1555
                instanceMain.dzMainMenu.translate.X = 0;
1556
                instanceMain.dzMainMenu.translate.Y = 0;
1557
            }
1558
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
1559
            {
1560
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1561
                instanceMain.dzMainMenu.translate.Y = 0;
1562
            }
1563
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
1564
            {
1565
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1566
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1567
            }
1568
            else
1569
            {
1570
                instanceMain.dzMainMenu.translate.X = 0;
1571
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1572
            }
1573
1574
            //instanceMain.dzMainMenu.zoomAndPanControl.RenderTransformOrigin = new Point(0.5, 0.5);
1575
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
1576
            //대기(강인구)
1577
            //instanceMain.dzMainMenu.imageViewer.RotateAngle = instanceMain.dzMainMenu.rotate.Angle;
1578
1579
1580
            //instanceMain.dzMainMenu.imageViewer.RenderTransformOrigin = new Point(0.5, 0.5);
1581
            //RotateTransform rotateTransform = new RotateTransform(instanceMain.dzMainMenu.rotate.Angle);
1582
            //instanceMain.dzMainMenu.imageViewer.RenderTransform = rotateTransform;
1583
1584
1585
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
1586
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
1587
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
1588
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
1589
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
1590
            //ViewerDataModel.Instance.Document_Info.Clear();
1591
            //ViewerDataModel.Instance.Document_Info.Where(i => i.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(value =>
1592
            //{
1593
            //    value.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1594
            //});
1595
1596
1597
            //이미지 각도 변경 시 실시간 Thumbnail 각도 변경(강인구 추가)
1598
            instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(data =>
1599
            {
1600
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1601
1602
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
1603
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
1604
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
1605
1606 3908a575 humkyung
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
1607 2b19f5f2 djkim
1608
                //rotation page add or update
1609
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
1610
                if (rotationdoc != null)
1611
                {
1612
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
1613
                }
1614
                else
1615
                {
1616
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
1617
                }
1618 787a4489 KangIngu
            });
1619
        }
1620
        #endregion
1621
1622 83d916a3 ljiyeon
        private void ImageConverter(RadToggleButton instanceToggle)
1623 787a4489 KangIngu
        {
1624 83d916a3 ljiyeon
            try
1625
            {           
1626
                var instanceMain = this.ParentOfType<MainWindow>();
1627
                //http://cloud.devdoftech.co.kr:5977/ImageUpload/FileUpload.asmx
1628
1629
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
1630
                dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";
1631
                Nullable<bool> result = dlg.ShowDialog();
1632
                if (result == true)
1633
                {
1634
                    instanceMain.dzMainMenu.filename = dlg.FileName;
1635
                    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
1636 787a4489 KangIngu
1637 83d916a3 ljiyeon
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(instanceMain.dzMainMenu.filename);
1638
                    String strFile = System.IO.Path.GetFileName(instanceMain.dzMainMenu.filename);
1639
                    long numByte = fileInfo.Length;
1640
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
1641
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
1642 787a4489 KangIngu
1643 83d916a3 ljiyeon
                    if (dLen < 4)
1644
                    {
1645
                        System.IO.FileStream fStream = new System.IO.FileStream(instanceMain.dzMainMenu.filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
1646
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
1647
                        byte[] data = br.ReadBytes((int)numByte);
1648
                        br.Close();
1649
1650
                        string filepath = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1651 c73426a9 ljiyeon
1652
                        Check_Uri.UriCheck(filepath);
1653
1654 83d916a3 ljiyeon
                        instanceMain.dzMainMenu.filename = filepath;
1655 787a4489 KangIngu
1656 83d916a3 ljiyeon
                        fStream.Close();
1657
                        fStream.Dispose();
1658
                    }
1659
                    else
1660
                    {
1661
                        this.ParentOfType<MainWindow>().DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
1662
                    }
1663 787a4489 KangIngu
                }
1664 08af623d ljiyeon
                else
1665
                {
1666
                    instanceToggle.IsChecked = false;
1667
                    Common.ViewerDataModel.Instance.SelectedControl = "";
1668
                    Common.ViewerDataModel.Instance.ControlTag = null;
1669
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1670
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1671 4c1692a1 ljiyeon
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("No Image selected.", "Alert");
1672 08af623d ljiyeon
                }
1673 787a4489 KangIngu
            }
1674 83d916a3 ljiyeon
            catch(Exception ex)
1675
            {
1676
                instanceToggle.IsChecked = false;
1677
                Common.ViewerDataModel.Instance.SelectedControl = "";
1678
                Common.ViewerDataModel.Instance.ControlTag = null;
1679
                this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1680
                this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
1681
                this.ParentOfType<MainWindow>().DialogMessage_Alert(""+ ex , "Alert");
1682
            }
1683 787a4489 KangIngu
        }
1684
1685 d4b0c723 KangIngu
        private void Control_Init(RadToggleButton instanceToggle, object sender)
1686
        {
1687
1688
        }
1689
1690 787a4489 KangIngu
        private void ControlEvent(object sender, RoutedEventArgs e)
1691
        {
1692
            RadToggleButton instanceToggle = sender as RadToggleButton;
1693
            var instanceMain = this.ParentOfType<MainWindow>();
1694
1695
            #region Ctrl + A 눌렀을 때 대처 방법 
1696
            //원인 : Ctrl + A를 누르면 UIElementSet에 등록을 시키지 않는다(이유는 한꺼번에 많은 양의 컨트롤의 동작이 유입되기 때문에
1697
            //       시스템의 성능저하를 불러올 수 있기 때문이다. 그래서 선택 후 다른 컨트롤을 누르면 등록되지 않은 컨트롤이기 때문에 삭제된다
1698
            //       이를 대처하는 방법으로 아래 코드를 사용한다.
1699
            if (Common.ViewerDataModel.Instance.MarkupControls.Count == 0 && Common.ViewerDataModel.Instance.MarkupControls.Count >= 1)
1700
            {
1701
                //var lstItem = instanceMain.DeepLayer._SelectLayer.ChildrenOfType<AdornerFinal>().ToList();
1702
                //foreach (var item in lstItem)
1703
                //{
1704
                //    foreach (var member in item.MemberSet)
1705
                //    {
1706
                //        if (!instanceMain.DeepLayer.UIElementSet.Contains(member.DrawingData))
1707
                //        {
1708
                //            instanceMain.DeepLayer.UIElementSet.Add(member.DrawingData);
1709
                //        }
1710
                //    }
1711
                //}
1712
            }
1713
            #endregion
1714
1715
            //if (!instanceMain.IsFreeSelectionMode)
1716
            //{
1717
            //    instanceMain.IsSwingMode = true;
1718
            //}
1719
1720 d4b0c723 KangIngu
            #region 다른 컨트롤 버튼 선택 해제
1721
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.SelectedControl).Subscribe(ControlState =>
1722
            {
1723
                if (ControlState == null)
1724
                {
1725
                    instanceToggle.IsChecked = false;
1726
                    HiddenControlHide();
1727
                }
1728
            });
1729
            #endregion
1730
1731 787a4489 KangIngu
            Release_ToggleButton(sender); //-> 해당 컨트롤을 제외한 모든 컨트롤에 대해 해제 처리
1732 d4b0c723 KangIngu
1733 787a4489 KangIngu
            if (instanceToggle != null)
1734
            {
1735
                Common.ViewerDataModel.Instance.ControlTag = instanceToggle.Tag.ToString();
1736
            }
1737
            else if ((sender as RadRibbonToggleButton) != null)
1738
            {
1739
                Common.ViewerDataModel.Instance.ControlTag = (sender as RadRibbonToggleButton).Tag.ToString();
1740
                instanceToggle = (sender as RadRibbonToggleButton);
1741
            }
1742
            else if ((sender as RadRibbonButton) != null)
1743
            {
1744
                RadRibbonButton instanceButton = sender as RadRibbonButton;
1745
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1746
            }
1747
            else
1748
            {
1749
                RadButton instanceButton = sender as RadButton;
1750
                Common.ViewerDataModel.Instance.ControlTag = instanceButton.Tag.ToString();
1751
            }
1752
1753
1754
1755
            System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleVisibility).Subscribe(isSee =>
1756
            {
1757
                instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1758
                System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1759
                {
1760
                    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1761
                });
1762
            });
1763
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1764
1765
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1766
1767
            if (instanceToggle.IsChecked != false)
1768
            {
1769
                #region 컨트롤이 체크되었다면
1770
                switch (instanceToggle.CommandParameter.ToString())
1771
                {
1772
                    #region Line
1773
                    case "Line":
1774
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
1775
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1776
                        if (instanceToggle.Tag.ToString() == "LineDelete")
1777
                        {
1778
                            //HiddenInterval.Visibility = Visibility.Visible;
1779
                        }
1780
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
1781
                        break;
1782
                    #endregion
1783
                    #region ChainLine
1784
                    case "ChainLine":
1785
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
1786
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1787
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
1788
                        break;
1789
                    #endregion
1790
                    #region DimLine
1791
                    case "DimLine":
1792
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
1793
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1794
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
1795
                        break;
1796
                    #endregion
1797
                    #region TwinLine
1798
                    case "TwinLine":
1799
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
1800
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1801
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
1802
                        break;
1803
                    #endregion
1804
                    #region CancelLine
1805
                    case "CancelLine":
1806
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
1807
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1808
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
1809
                        break;
1810
                    #endregion
1811
                    #region PolygonCloud
1812
                    case "PolygonCloud":
1813
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
1814
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1815
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
1816
                        break;
1817
                    #endregion
1818
                    #region RectCloud
1819
                    case "RectCloud":
1820
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
1821
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1822
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
1823
                        break;
1824
                    #endregion
1825 4318fdeb KangIngu
                    #region Rectangle
1826 787a4489 KangIngu
                    case "Rectangle":
1827
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
1828
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1829
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
1830
                        break;
1831
                    #endregion
1832 4318fdeb KangIngu
                    #region Triangle
1833 787a4489 KangIngu
                    case "Triangle":
1834
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
1835
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1836
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
1837
                        break;
1838
                    #endregion
1839
                    #region RectCloud
1840
                    case "Circle":
1841
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
1842
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1843
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
1844
                        break;
1845
                    #endregion
1846
                    #region Symbol
1847
                    case "Symbol":
1848
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
1849
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1850
                        break;
1851
                    #endregion
1852
                    #region SymbolN
1853
                    case "SymbolN":
1854
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
1855
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
1856
                        break;
1857
                    #endregion
1858
                    #region Text
1859
                    case "Text":
1860
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
1861
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1862
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
1863
                        break;
1864
                    #endregion
1865
                    #region TextBorder
1866
                    case "TextBorder":
1867
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
1868
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1869
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
1870
                        break;
1871
                    #endregion
1872
                    #region TextCloud
1873
                    case "TextCloud":
1874
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
1875
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1876
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
1877
                        break;
1878
                    #endregion
1879
                    #region Date
1880
                    case "Date":
1881
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
1882
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
1883
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
1884
                        break;
1885
                    #endregion
1886
                    #region ArrowText
1887
                    case "ArrowText":
1888
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
1889
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
1890
                        {
1891
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
1892
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
1893
                        }
1894
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
1895
                        {
1896
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
1897
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
1898
                        }
1899
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
1900
                        {
1901
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
1902
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
1903
                        }
1904
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
1905
                        {
1906
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
1907
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
1908
                        }
1909
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
1910
                        {
1911
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
1912
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
1913
                        }
1914
                        else
1915
                        {
1916
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
1917
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
1918
                            //HiddenAxisLock.Visibility = Visibility.Visible;
1919
                        }
1920
                        break;
1921
                    #endregion
1922
                    #region Arrow
1923
                    case "Arrow":
1924
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
1925
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1926
                        //HiddenDimSize.Visibility = Visibility.Visible;
1927
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
1928
                        break;
1929
                    #endregion
1930
                    #region Shape
1931
                    case "Shape":
1932
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
1933
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
1934
                        break;
1935
                    #endregion
1936
                    #region Polygon
1937
                    case "Polygon":
1938
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
1939
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
1940
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1941
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
1942
                        break;
1943
                    #endregion
1944
                    #region Arc
1945
                    case "Arc":
1946
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
1947
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
1948
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1949
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1950
                        break;
1951
                    #endregion
1952 40b3ce25 ljiyeon
                    #region ArrowArc
1953
                    case "ArrowArc":
1954
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowArc";
1955
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcArrow;
1956
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1957
                        TaskMessage("ArcArrow 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1958
                        break;
1959
                    #endregion
1960 787a4489 KangIngu
                    #region ArrowMulti
1961
                    case "ArrowMulti":
1962
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
1963
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
1964
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1965
                        break;
1966
                    #endregion
1967
                    #region Etc
1968
                    case "Etc":
1969
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
1970
                        break;
1971
                    #endregion
1972
                    #region Ink
1973
                    case "Ink":
1974
                        if (instanceToggle.Tag.ToString() == "EraserClear")
1975
                        {
1976
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1977
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
1978
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
1979
                        }
1980
                        else if (instanceToggle.Tag.ToString() == "Eraser")
1981
                        {
1982
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1983
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
1984
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
1985
                        }
1986
                        else
1987
                        {
1988
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
1989
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
1990
                        }
1991
1992
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1993
1994
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
1995
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
1996
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
1997
                        break;
1998
                    #endregion
1999
                    #region Select
2000
                    case "Select":
2001 65246dc9 KangIngu
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2002
                        {
2003
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2004
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2005
                        }
2006 787a4489 KangIngu
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2007
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2008 9f473fb7 KangIngu
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2009 787a4489 KangIngu
                        break;
2010
                    #endregion
2011
                    #region Image
2012
                    case "Image":
2013
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2014
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2015 83d916a3 ljiyeon
                        ImageConverter(instanceToggle);
2016 787a4489 KangIngu
                        break;
2017
                    #endregion
2018
                    #region Sign
2019
                    case "Sign":
2020
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2021
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2022
                        //강인구 추가
2023
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2024
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2025
                        //{
2026
                        //    if (ea.Result == null)
2027
                        //    {
2028
2029
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2030
                        //    }
2031
                        //    else
2032
                        //    {
2033
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2034
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2035
                        //        {
2036
                        //            BitmapImage im = new BitmapImage();
2037
                        //            im.SetSource(ms);
2038
                        //            instanceMain.DeepLayer.SignImage = im;
2039
                        //            ms.Close();
2040
                        //        }
2041
                        //    }
2042
                        //};
2043
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2044
                        break;
2045
                    #endregion
2046
                    #region Check
2047
                    case "Check":
2048
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2049
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2050
                        //강인구 추가
2051
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2052
                        break;
2053
                    #endregion
2054
                    #region Batch
2055
                    case "Batch":
2056
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2057
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2058
                        //강인구 추가
2059
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2060
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2061 999c9e40 humkyung
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2062 787a4489 KangIngu
                        break;
2063 d4b0c723 KangIngu
                    #endregion
2064
                    #region Copy
2065
                    case "Copy":
2066
                        Copy_Start();
2067
                        instanceToggle.IsChecked = false;
2068
                        ViewerDataModel.Instance.SelectedControl = "";
2069
                        ViewerDataModel.Instance.ControlTag = null;
2070
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2071
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2072
                        break;
2073
                    #endregion
2074
                    #region Cut
2075
                    case "Cut":
2076 93420e5a ljiyeon
                        //Cut_Start();
2077
                        CutCommand.Instance.Execute();
2078 d4b0c723 KangIngu
                        instanceToggle.IsChecked = false;
2079
                        ViewerDataModel.Instance.SelectedControl = "";
2080
                        ViewerDataModel.Instance.ControlTag = null;
2081
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2082
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2083
                        break;
2084
                    #endregion
2085
                    #region Paste
2086
                    case "Paste":
2087
                        Paste_Start();
2088
                        instanceToggle.IsChecked = false;
2089
                        ViewerDataModel.Instance.SelectedControl = "";
2090
                        ViewerDataModel.Instance.ControlTag = null;
2091
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2092 ccf944bb ljiyeon
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2093 d4b0c723 KangIngu
                        break;
2094
                    #endregion
2095
                    #region Delete
2096
                    case "Delete":
2097 d62c0439 humkyung
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2098 24678e06 humkyung
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2099
2100 d4b0c723 KangIngu
                        instanceToggle.IsChecked = false;
2101
                        ViewerDataModel.Instance.SelectedControl = "";
2102
                        ViewerDataModel.Instance.ControlTag = null;
2103
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2104
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2105
                        break;
2106
                    #endregion
2107
                    #region Undo
2108
                    case "Undo":
2109 f816dd63 humkyung
                        UndoCommand.Instance.Execute();
2110 d4b0c723 KangIngu
                        instanceToggle.IsChecked = false;
2111
                        ViewerDataModel.Instance.SelectedControl = "";
2112
                        ViewerDataModel.Instance.ControlTag = null;
2113
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2114
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2115
                        break;
2116
                    #endregion
2117
                    #region Redo
2118
                    case "Redo":
2119 f816dd63 humkyung
                        RedoCommand.Instance.Execute();
2120 d4b0c723 KangIngu
                        instanceToggle.IsChecked = false;
2121
                        ViewerDataModel.Instance.SelectedControl = "";
2122
                        ViewerDataModel.Instance.ControlTag = null;
2123
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2124
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2125 9f473fb7 KangIngu
                        break;
2126
                    #endregion
2127
                    #region DragZoom
2128
                    case "DragZoom":
2129
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2130
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2131
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2132
                        break;
2133 d4b0c723 KangIngu
                    #endregion
2134 53880c83 ljiyeon
                    #region Grouping
2135
                    case "Group":
2136 c0977e97 djkim
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2137
                        //foreach (var togle in GrouptoggleList)
2138
                        //{
2139
                        //    togle.IsChecked = false;
2140
                        //}
2141 53880c83 ljiyeon
2142 c0977e97 djkim
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2143
                        //{
2144
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2145
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2146
                        //}
2147
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2148
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2149
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2150
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2151
                        //{
2152
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2153
                        //}
2154
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2155
                        //{
2156
                        //    // string MarkupData = "";
2157
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2158
                        //    {
2159
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2160
                        //        {
2161
                        //            //MARKUP_DATA_GROUP INSERT
2162
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2163
                        //            {
2164
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2165
                        //                STATE = 0,
2166
                        //            };
2167
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2168
                        //            Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2169
                        //            if (group_id > 0)
2170
                        //            {
2171
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2172
                        //                {
2173
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2174
                        //                    {
2175
                        //                        //MARKUP_DATA UPDATE
2176
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2177
                        //                        //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2178
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2179
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2180
                        //                    }
2181
                        //                }
2182
                        //            }
2183
                        //        }
2184
                        //    }
2185
                        //}
2186 53880c83 ljiyeon
                        break;
2187
                    case "UnGroup":
2188 c0977e97 djkim
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2189
                        //foreach (var togle in UnGrouptoggleList)
2190
                        //{
2191
                        //    togle.IsChecked = false;
2192
                        //}
2193
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2194
                        //{
2195
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2196
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2197
                        //}
2198
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2199
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2200
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2201
2202
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2203
                        //{
2204
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2205
                        //}
2206
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2207
                        //{
2208
                        //    // string MarkupData = "";
2209
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2210
                        //    {
2211
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2212
                        //        {
2213
                        //            //MARKUP_DATA UPDATE
2214
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2215
                        //            {
2216
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2217
                        //                {
2218
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2219
                        //                    //MARKUP_DATA UPDATE
2220
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2221
                        //                    //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2222
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2223
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2224
2225
2226
                        //                    //MARKUP_DATA_GROUP UPDATE
2227
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2228
                        //                    //Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2229
                        //                }
2230
                        //            }
2231
                        //        }
2232
                        //    }
2233
                        //}
2234 53880c83 ljiyeon
                        break;
2235
                    #endregion
2236
                    #region Capture
2237
                    case "Capture":
2238
                        SyncInit();
2239
                        //   instanceToggle.IsChecked = false;
2240
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2241
                        foreach (var togle in CaptureList)
2242
                        {
2243
                            togle.IsChecked = false;
2244
                        }
2245
2246
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2247
                        {
2248
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2249
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2250
                        }
2251
2252
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2253
                   //     ViewerDataModel.Instance.ControlTag = null;
2254
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2255
2256
                        /*
2257
                        //캡쳐 하기 전에 코멘트 저장
2258
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2259
                        {
2260
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2261
                            menu.ReleaseAdorner();
2262
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2263
                            {
2264
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2265
                            }
2266
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2267
                            {
2268
2269
                            }
2270
                            else
2271
                            {
2272
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2273
                            }
2274
                        }*/
2275
2276
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2277
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2278
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2279
                        Application.Current.MainWindow.Focus();
2280
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2281
                        (Application.Current.MainWindow as MainWindow).dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2282
                        break;
2283
                    #endregion
2284 f324a940 djkim
                    //#region Cad
2285
                    //case "Inside":
2286
                    //    //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2287
                    //    //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2288
                    //    Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2289
                    //    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2290
                    //    break;
2291
                    //case "Overlap":
2292
                    //    //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2293
                    //    //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2294
                    //    Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2295
                    //    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2296
                    //    break;
2297
                    //case "Clip":
2298
                    //    //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2299
                    //    //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2300
                    //    Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2301
                    //    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2302
                    //    break;
2303
                    //case "CadExport":
2304
                    //    if (isClosed)
2305
                    //    {
2306
                    //        //토글 및 마우스 상태 초기화
2307
                    //        var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2308
                    //        foreach (var togle in toggleList)
2309
                    //        {
2310
                    //            togle.IsChecked = false;
2311
                    //        }
2312
                    //        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2313
2314
                    //        isClosed = false;
2315
                    //        //Control 파일 먼저 생성
2316
                    //        CollapsedButton_Click();
2317
                    //        CadViewer check = new CadViewer();
2318
                    //        check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2319
                    //        check.Title = "Export Viewer";
2320
                    //        //check.Topmost = true;
2321
                    //        check.Show();
2322
                    //        check.Closed += Check_Closed;
2323
                    //        instanceToggle.IsChecked = false;
2324
                    //    }
2325
                    //    break;
2326
                    //case "CadViewer":
2327
                    //    if (isClosed)
2328
                    //    {
2329
                    //        //토글 및 마우스 상태 초기화
2330
                    //        var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2331
                    //        foreach (var togle in toggleList)
2332
                    //        {
2333
                    //            togle.IsChecked = false;
2334
                    //        }
2335
                    //        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2336
2337
                    //        isClosed = false;
2338
                    //        CadResultViewer check = new CadResultViewer();
2339
                    //        check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2340
                    //        check.Title = "Viewer";
2341
                    //        check.Show();
2342
2343
                    //        check.Closed += Check_Closed;
2344
2345
                    //    }
2346
                    //    break;
2347
                    //#endregion
2348 787a4489 KangIngu
                    default:
2349
                        break;
2350
                }
2351
                #endregion
2352
            }
2353
            else
2354
            {
2355 992a98b4 KangIngu
2356 787a4489 KangIngu
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2357
                {
2358
                    instanceMain.dzMainMenu.IsSwingMode = false;
2359
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2360
                    Common.ViewerDataModel.Instance.ControlTag = null;
2361
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2362
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2363
                }
2364
            }
2365
        }
2366
2367 53880c83 ljiyeon
        private void SyncInit()
2368
        {
2369
            try
2370
            {
2371
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2372
                {
2373
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2374
                    ViewerDataModel.Instance.PageBalanceMode = false;
2375
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2376
                    ViewerDataModel.Instance.PageNumber = 0;
2377
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2378
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2379
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2380
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2381
                }
2382
            }
2383
            catch (Exception ex)
2384
            {
2385
                Logger.sendResLog("SyncInit", ex.Message, 0);
2386
            }
2387
2388
        }
2389
2390 684ef11c ljiyeon
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2391
        CommentUserInfo currentControl { get; set; }
2392
        private void Check_Closed(object sender, EventArgs e)
2393
        {
2394
            isClosed = true;
2395
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2396
            //토글 및 마우스 상태 초기화
2397
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2398
            foreach (var togle in toggleList)
2399
            {
2400
                togle.IsChecked = false;
2401
            }
2402
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2403
            ViewerDataModel.Instance.Capture_Opacity = 0;
2404
2405
        }
2406
2407
        /* public class test 
2408
         {
2409
             public double width { get; set; }
2410
             public double height { get; set; }
2411
         }
2412
         */
2413
        private void CollapsedButton_Click()
2414
        {
2415
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2416
2417
            string[] data = new string[0];
2418
2419
            int cnt = 0;
2420
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2421
2422
            List<MarkupInfoItem> gridSelectionItem = menu.gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
2423
2424
            foreach (var item in gridSelectionItem)
2425
            {
2426
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2427
                {
2428 d62c0439 humkyung
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2429 684ef11c ljiyeon
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2430
                    data = new string[instance.Count];
2431
                    foreach (var markup in instance)
2432
                    {
2433
                        data[cnt++] = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(markup.Data);
2434
                    }
2435
                }
2436
            }
2437
2438 cf2671a6 ljiyeon
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2439 684ef11c ljiyeon
            {
2440
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2441
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2442
                if (!File.Exists(FilePath))
2443
                {
2444
                    Directory.CreateDirectory(FilePath);
2445
                }
2446
2447
                if (!string.IsNullOrEmpty(FileName))
2448
                {
2449
                    //  File.WriteAllText(SaveDig.FileName, data);
2450
                    File.WriteAllLines(FileName, data);
2451
                }
2452
            }
2453
        }
2454
2455
        private double minHeight;
2456
        private double minWidth;
2457
2458
        private double maxHeight;
2459
        private double maxWidth;
2460
2461
        public bool CanVResize { get; private set; }
2462
        public bool CanHResize { get; private set; }
2463
2464
        public void DesignerComponent(FrameworkElement content)
2465
        {
2466
            this.InitializeComponent();
2467
2468
            if (!double.IsNaN(content.Width))
2469
            {
2470
                CanHResize = false;
2471
                this.Width = content.Width;
2472
            }
2473
            else
2474
            {
2475
                CanHResize = true;
2476
                this.Width = 23.0;
2477
            }
2478
            if (!double.IsNaN(content.Height))
2479
            {
2480
                CanVResize = false;
2481
                this.Height = content.Height; ;
2482
            }
2483
            else
2484
            {
2485
                CanVResize = true;
2486
                this.Height = 23.0;
2487
            }
2488
2489
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2490
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2491
            maxWidth = content.MaxWidth;
2492
            maxHeight = content.MaxHeight;
2493
2494
            double top = (double)content.GetValue(Canvas.TopProperty);
2495
            if (double.IsNaN(top))
2496
                top = 0.0;
2497
            double left = (double)content.GetValue(Canvas.LeftProperty);
2498
            if (double.IsNaN(left))
2499
                left = 0.0;
2500
            SetValue(Canvas.TopProperty, top);
2501
            SetValue(Canvas.LeftProperty, left);
2502
2503
            //Set the actual content. Note that "Content" property is a new property. See below
2504
            this.Content = content;
2505
        }
2506
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2507
        {
2508
            string name = ((Thumb)sender).Name;
2509
            if (name.Contains("Top"))
2510
            {
2511
                double newHeight = this.Height - e.VerticalChange;
2512
                if (newHeight >= minHeight && newHeight <= maxHeight)
2513
                {
2514
                    this.Height = newHeight;
2515
                    SetValue(Canvas.TopProperty,
2516
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2517
                }
2518
            }
2519
            if (name.Contains("Right"))
2520
            {
2521
                double newWidth = this.Width + e.HorizontalChange;
2522
                if (newWidth >= minWidth && newWidth <= maxWidth)
2523
                    this.Width = newWidth;
2524
            }
2525
            if (name.Contains("Bottom"))
2526
            {
2527
                double newHeight = this.Height + e.VerticalChange;
2528
                if (newHeight >= minHeight && newHeight <= maxHeight)
2529
                    this.Height = newHeight;
2530
            }
2531
            if (name.Contains("Left"))
2532
            {
2533
                double newWidth = this.Width - e.HorizontalChange;
2534
                if (newWidth >= minWidth && newWidth <= maxWidth)
2535
                {
2536
                    this.Width = newWidth;
2537
                    SetValue(Canvas.LeftProperty,
2538
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2539
                }
2540
            }
2541
        }
2542
2543
        private void drawControlBorder(object sender)
2544
        {
2545
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2546
        }
2547
2548
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2549
        {
2550
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2551
            if (designerItem != null)
2552
            {
2553
                double deltaVertical, deltaHorizontal;
2554
2555
                switch (VerticalAlignment)
2556
                {
2557
                    case VerticalAlignment.Bottom:
2558
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2559
                        designerItem.Height -= deltaVertical;
2560
                        break;
2561
                    case VerticalAlignment.Top:
2562
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2563
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2564
                        designerItem.Height -= deltaVertical;
2565
                        break;
2566
                    default:
2567
                        break;
2568
                }
2569
2570
                switch (HorizontalAlignment)
2571
                {
2572
                    case HorizontalAlignment.Left:
2573
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2574
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2575
                        designerItem.Width -= deltaHorizontal;
2576
                        break;
2577
                    case HorizontalAlignment.Right:
2578
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2579
                        designerItem.Width -= deltaHorizontal;
2580
                        break;
2581
                    default:
2582
                        break;
2583
                }
2584
            }
2585
            e.Handled = true;
2586
        }
2587
2588
        SaveFileDialog SaveDig = new SaveFileDialog(); //파일 세이브 다이얼로그
2589
2590
        void ExportMethod()
2591
        {
2592
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2593
            SaveDig.Filter = "PDF file format|*.pdf";
2594
            SaveDig.Title = "Save an DWG File";
2595
            SaveDig.ShowDialog();
2596
        }
2597
2598 537f4cd8 djkim
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2599 be04d12c djkim
        {            
2600
            if (cbAutoSave.IsChecked == true)
2601 537f4cd8 djkim
            {
2602
                SaveTime(true, (int)cbSaveInterval.Value);
2603
            }
2604
            else
2605
            {
2606
                SaveTime(false, (int)cbSaveInterval.Value);
2607
            }
2608
        }
2609
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2610
        {
2611 be04d12c djkim
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2612
            {
2613
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2614
            }
2615 537f4cd8 djkim
            if (cbAutoSave.IsChecked == true)
2616
            {
2617
                SaveTime(true, (int)cbSaveInterval.Value);
2618 5822e146 ljiyeon
            }
2619
2620
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2621
            Properties.Settings.Default.Save();
2622 537f4cd8 djkim
        }
2623 787a4489 KangIngu
        //강인구 자동 저장 추가
2624
        private void AutoSave(object sender, RoutedEventArgs e)
2625
        {
2626
            RadToggleButton instanceToggle = sender as RadToggleButton;
2627
2628
            if(instanceToggle.IsChecked == true)
2629
            {
2630
                SaveTime(true);
2631
            }
2632
            else
2633
            {
2634
                SaveTime(false);
2635
            }
2636
        }
2637
2638 d4b0c723 KangIngu
        public void Copy_Start()
2639
        {
2640
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2641
            {
2642
                string MarkupData = "";
2643
2644
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2645
                {
2646
                    if (item.GetType().Name == "AdornerFinal")
2647
                    {
2648 4913851c humkyung
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2649 d4b0c723 KangIngu
2650
                        {
2651
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2652
                            {
2653 129ca191 humkyung
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2654
                                MarkupData += "|OR|" + res.ConvertData;
2655 d4b0c723 KangIngu
                            }
2656
                        }
2657
                        Clipboard.SetText(MarkupData);
2658
                    }
2659
                }
2660
            }
2661
        }
2662
2663
        public void Cut_Start()
2664
        {
2665
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2666
            {
2667
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2668
                {
2669
                    string MarkupData = "";
2670
2671
                    if (item.GetType().Name == "AdornerFinal")
2672
                    {
2673 4913851c humkyung
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2674 d4b0c723 KangIngu
                        {
2675
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2676
                            {
2677 129ca191 humkyung
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2678
                                MarkupData += "|OR|" + res.ConvertData;
2679 d4b0c723 KangIngu
                            }
2680
                        }
2681 ccf944bb ljiyeon
                        //클립보드에 넣음
2682 d4b0c723 KangIngu
                        Clipboard.SetText(MarkupData);
2683
                    }
2684
                }
2685
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2686
            }
2687
        }
2688
2689
        public void Paste_Start()
2690
        {
2691
            //마크업 붙여넣기
2692
            //if (Clipboard.GetText().Contains("|DZ|"))
2693
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2694
            {
2695
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2696
2697
                string[] delimiterChars = { "|OR|" };
2698
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2699
2700 077896be humkyung
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2701 d4b0c723 KangIngu
2702
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2703
2704
                //강인구 Undo/Redo 보류
2705 129ca191 humkyung
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2706 d4b0c723 KangIngu
                {
2707
                    IsUndo = false,
2708
                    Event = Event_Type.Create,
2709
                    EventTime = DateTime.Now,
2710
                    Markup_List = new List<Multi_Undo_data>()
2711
                };
2712
2713
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2714
                {
2715
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2716
                });
2717
2718
                foreach (string parse in data)
2719
                {
2720
                    if (parse != "")
2721
                    {
2722 5529d2a2 humkyung
                        System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2723 24678e06 humkyung
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2724 d4b0c723 KangIngu
2725
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2726
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2727
2728
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2729
2730
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2731
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2732
2733
                        multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
2734
2735
                        UndoData.Markup_List.Add(multi_Undo_Data);
2736 6707a5c7 ljiyeon
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2737 d4b0c723 KangIngu
                    }
2738
                }
2739
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2740
2741
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2742
                {
2743
                    Canvas.SetLeft(final, 0);
2744
                    Canvas.SetTop(final, 0);
2745
                }
2746
                else
2747
                {
2748
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2749
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2750 0d00f9c8 humkyung
                    final.TranslateItems(realPointX, realPointY);
2751 d4b0c723 KangIngu
2752 4913851c humkyung
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2753 d4b0c723 KangIngu
                    {
2754 0d00f9c8 humkyung
                        final.TranslateItems(0.001, 0.001); //dummy
2755 d4b0c723 KangIngu
                    }
2756 6707a5c7 ljiyeon
2757 d4b0c723 KangIngu
                }
2758
                
2759
2760
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2761
2762
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2763
                //Canvas.SetLeft(final, 50);
2764
                //Canvas.SetTop(final, 50);
2765
            }
2766
            //외부 이미지 붙여넣기
2767
            else if (Clipboard.GetImage() != null)
2768
            {
2769 c73426a9 ljiyeon
                try
2770 d4b0c723 KangIngu
                {
2771 c73426a9 ljiyeon
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2772 d4b0c723 KangIngu
2773 c73426a9 ljiyeon
                    //강인구 Undo/Redo 보류
2774 129ca191 humkyung
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2775 c73426a9 ljiyeon
                    {
2776
                        IsUndo = false,
2777
                        Event = Event_Type.Create,
2778
                        EventTime = DateTime.Now,
2779
                        Markup_List = new List<Multi_Undo_data>()
2780
                    };
2781 d4b0c723 KangIngu
2782
2783 c73426a9 ljiyeon
                    string temppath = System.IO.Path.GetTempPath();
2784
                    //string filename = KCOM.Events.Save.shortCommentKey();
2785 24678e06 humkyung
                    string filename = Commons.shortFileKey();
2786 d4b0c723 KangIngu
2787 c73426a9 ljiyeon
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2788
                    clipboardImage.Save(temppath + "\\" + filename);
2789 d4b0c723 KangIngu
2790 c73426a9 ljiyeon
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2791
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2792
                    long numByte = fileInfo.Length;
2793
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2794
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2795 d4b0c723 KangIngu
2796 c73426a9 ljiyeon
                    if (dLen < 4)
2797
                    {
2798
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2799
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2800
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2801
                        byte[] data = br.ReadBytes((int)numByte);
2802 d4b0c723 KangIngu
2803 c73426a9 ljiyeon
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2804
                        Check_Uri.UriCheck(filename);
2805
                        br.Close();
2806
                        fStream.Close();
2807
                        fStream.Dispose();
2808
                    }
2809
                    else
2810
                    {
2811
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2812
                        return;
2813
                    }
2814 d4b0c723 KangIngu
2815 c73426a9 ljiyeon
                    fileInfo.Delete();
2816
2817
                    //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2818
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2819
                    IntPtr hBitmap = bmp.GetHbitmap();
2820
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2821
                    Image img = new Image();
2822
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2823
                    if (filename.Contains(".svg"))
2824 53880c83 ljiyeon
                    {
2825 c73426a9 ljiyeon
                        byte[] imageData = null;
2826
                        DrawingImage image = null;
2827
                        using (System.Net.WebClient web = new System.Net.WebClient())
2828
                        {
2829
                            imageData = web.DownloadData(new Uri(filename));
2830
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2831
                            image = SvgReader.Load(stream);
2832
                        }
2833
                        img.Source = image;
2834
                    }
2835
                    else
2836
                    {
2837
                        img.Source = new BitmapImage(new Uri(filename));
2838 53880c83 ljiyeon
                    }
2839 d4b0c723 KangIngu
2840 c73426a9 ljiyeon
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2841
                    {
2842
                        PointSet = new List<Point>(),
2843
                        //FilePath = img.Source.ToString(),
2844
                        FilePath = filename,
2845
                        ImageData = img.Source,
2846
                        StartPoint = new Point(100, 100),
2847
                        EndPoint = new Point(200, 200),
2848
                        TopRightPoint = new Point(100, 200),
2849
                        LeftBottomPoint = new Point(200, 100)
2850
                    };
2851 d4b0c723 KangIngu
2852 c73426a9 ljiyeon
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2853
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2854
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2855 d4b0c723 KangIngu
2856 c73426a9 ljiyeon
                    currentControl.PointSet = new List<Point>
2857 d4b0c723 KangIngu
                                        {
2858
                                            currentControl.StartPoint,
2859
                                            currentControl.LeftBottomPoint,
2860
                                            currentControl.EndPoint,
2861
                                            currentControl.TopRightPoint,
2862
                                        };
2863
2864 c73426a9 ljiyeon
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2865
                    UndoData.Markup_List.Add(multi_Undo_Data);
2866
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2867 d4b0c723 KangIngu
2868 c73426a9 ljiyeon
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2869 24678e06 humkyung
                    currentControl.CommentID = Commons.shortGuid();
2870 d4b0c723 KangIngu
2871 c73426a9 ljiyeon
                    currentControl.ApplyTemplate();
2872
                    currentControl.SetImage();
2873 d4b0c723 KangIngu
2874 c73426a9 ljiyeon
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2875
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2876
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2877 ccf944bb ljiyeon
2878 c73426a9 ljiyeon
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2879
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2880 0d00f9c8 humkyung
                    final.TranslateItems(realPointX, realPointY);
2881 c73426a9 ljiyeon
                }
2882
                catch(Exception ex)
2883
                {
2884
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2885
                }
2886 d4b0c723 KangIngu
            }
2887
        }
2888 787a4489 KangIngu
    }
2889
}
클립보드 이미지 추가 (최대 크기: 500 MB)