프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (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 f3c08420 taeseongkim
                if (instanceMain.dzMainMenu.MainAngle.Visibility != isSee)
1758 787a4489 KangIngu
                {
1759 f3c08420 taeseongkim
                    instanceMain.dzMainMenu.MainAngle.Visibility = isSee;
1760
                }
1761
                //System.Reactive.Linq.Observable2.FromPropertyChangedPattern(Common.ViewerDataModel.Instance, temp => temp.AngleValue).Subscribe(p =>
1762
                //{
1763
                //    instanceMain.dzMainMenu.MainAngle.AngleValue = p;
1764
                //});
1765 787a4489 KangIngu
            });
1766
            instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
1767
1768
            instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
1769
1770
            if (instanceToggle.IsChecked != false)
1771
            {
1772
                #region 컨트롤이 체크되었다면
1773
                switch (instanceToggle.CommandParameter.ToString())
1774
                {
1775
                    #region Line
1776
                    case "Line":
1777
                        Common.ViewerDataModel.Instance.SelectedControl = "Line";
1778
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1779
                        if (instanceToggle.Tag.ToString() == "LineDelete")
1780
                        {
1781
                            //HiddenInterval.Visibility = Visibility.Visible;
1782
                        }
1783
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.SingleLine;
1784
                        break;
1785
                    #endregion
1786
                    #region ChainLine
1787
                    case "ChainLine":
1788
                        Common.ViewerDataModel.Instance.SelectedControl = "ChainLine";
1789
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1790
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ChainLine;
1791
                        break;
1792
                    #endregion
1793
                    #region DimLine
1794
                    case "DimLine":
1795
                        Common.ViewerDataModel.Instance.SelectedControl = "DimLine";
1796
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1797
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.DimLine;
1798
                        break;
1799
                    #endregion
1800
                    #region TwinLine
1801
                    case "TwinLine":
1802
                        Common.ViewerDataModel.Instance.SelectedControl = "TwinLine";
1803
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1804
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TwinLine;
1805
                        break;
1806
                    #endregion
1807
                    #region CancelLine
1808
                    case "CancelLine":
1809
                        Common.ViewerDataModel.Instance.SelectedControl = "CancelLine";
1810
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1811
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.CancelLine;
1812
                        break;
1813
                    #endregion
1814
                    #region PolygonCloud
1815
                    case "PolygonCloud":
1816
                        Common.ViewerDataModel.Instance.SelectedControl = "PolygonCloud";
1817
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1818
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonCloud;
1819
                        break;
1820
                    #endregion
1821
                    #region RectCloud
1822
                    case "RectCloud":
1823
                        Common.ViewerDataModel.Instance.SelectedControl = "RectCloud";
1824
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1825
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.RectCloud;
1826
                        break;
1827
                    #endregion
1828 4318fdeb KangIngu
                    #region Rectangle
1829 787a4489 KangIngu
                    case "Rectangle":
1830
                        Common.ViewerDataModel.Instance.SelectedControl = "Rectangle";
1831
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1832
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Rectangle;
1833
                        break;
1834
                    #endregion
1835 4318fdeb KangIngu
                    #region Triangle
1836 787a4489 KangIngu
                    case "Triangle":
1837
                        Common.ViewerDataModel.Instance.SelectedControl = "Triangle";
1838
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1839
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Triangle;
1840
                        break;
1841
                    #endregion
1842
                    #region RectCloud
1843
                    case "Circle":
1844
                        Common.ViewerDataModel.Instance.SelectedControl = "Circle";
1845
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1846
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Circle;
1847
                        break;
1848
                    #endregion
1849
                    #region Symbol
1850
                    case "Symbol":
1851
                        Common.ViewerDataModel.Instance.SelectedControl = "Symbol";
1852
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
1853
                        break;
1854
                    #endregion
1855
                    #region SymbolN
1856
                    case "SymbolN":
1857
                        Common.ViewerDataModel.Instance.SelectedControl = "SymbolN";
1858
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Stamp;
1859
                        break;
1860
                    #endregion
1861
                    #region Text
1862
                    case "Text":
1863
                        Common.ViewerDataModel.Instance.SelectedControl = "Text";
1864
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1865
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextControl;
1866
                        break;
1867
                    #endregion
1868
                    #region TextBorder
1869
                    case "TextBorder":
1870
                        Common.ViewerDataModel.Instance.SelectedControl = "TextBorder";
1871
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1872
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextBorder;
1873
                        break;
1874
                    #endregion
1875
                    #region TextCloud
1876
                    case "TextCloud":
1877
                        Common.ViewerDataModel.Instance.SelectedControl = "TextCloud";
1878
                        TaskMessage("Text 도구는 텍스트 영역을 더블 클릭하여 텍스트를 재 편집 할 수 있습니다", TaskMessageType.Normal);
1879
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.TextCloud;
1880
                        break;
1881
                    #endregion
1882
                    #region Date
1883
                    case "Date":
1884
                        Common.ViewerDataModel.Instance.SelectedControl = "Date";
1885
                        TaskMessage("날짜 컨트롤을 더블 클릭하면 날짜를 변경할 수 있습니다", TaskMessageType.Normal);
1886
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Date;
1887
                        break;
1888
                    #endregion
1889
                    #region ArrowText
1890
                    case "ArrowText":
1891
                        TaskMessage("ArrowText 컨트롤은 그린 후 컨트롤을 선택하였을 시 중간점을 조정할 수 있습니다", TaskMessageType.Normal);
1892
                        if (instanceToggle.Tag.ToString() == "ArrowText_Cloud")
1893
                        {
1894
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText_Cloud";
1895
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl;
1896
                        }
1897
                        else if (instanceToggle.Tag.ToString() == "ArrowText_Border")
1898
                        {
1899
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTextBorderControl";
1900
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl;
1901
                        }
1902
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Normal")
1903
                        {
1904
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextControl";
1905
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl;
1906
                        }
1907
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Border")
1908
                        {
1909
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextBorderControl";
1910
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl;
1911
                        }
1912
                        else if (instanceToggle.Tag.ToString() == "ArrowTextFix_Cloud")
1913
                        {
1914
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowTransTextCloudControl";
1915
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl;
1916
                        }
1917
                        else
1918
                        {
1919
                            Common.ViewerDataModel.Instance.SelectedControl = "ArrowText";
1920
                            instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowTextControl;
1921
                            //HiddenAxisLock.Visibility = Visibility.Visible;
1922
                        }
1923
                        break;
1924
                    #endregion
1925
                    #region Arrow
1926
                    case "Arrow":
1927
                        Common.ViewerDataModel.Instance.SelectedControl = "Arrow";
1928
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1929
                        //HiddenDimSize.Visibility = Visibility.Visible;
1930
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowLine;
1931
                        break;
1932
                    #endregion
1933
                    #region Shape
1934
                    case "Shape":
1935
                        Common.ViewerDataModel.Instance.SelectedControl = "Shape";
1936
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
1937
                        break;
1938
                    #endregion
1939
                    #region Polygon
1940
                    case "Polygon":
1941
                        Common.ViewerDataModel.Instance.SelectedControl = "Polygon";
1942
                        TaskMessage("자유형 코멘트 도구는 오른쪽 마우스 클릭을 통해 그리기를 마칠 수 있습니다", TaskMessageType.Normal);
1943
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1944
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PolygonControl;
1945
                        break;
1946
                    #endregion
1947
                    #region Arc
1948
                    case "Arc":
1949
                        Common.ViewerDataModel.Instance.SelectedControl = "Arc";
1950
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcLine;
1951
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1952
                        TaskMessage("Arc 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1953
                        break;
1954
                    #endregion
1955 40b3ce25 ljiyeon
                    #region ArrowArc
1956
                    case "ArrowArc":
1957
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowArc";
1958
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArcArrow;
1959
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1960
                        TaskMessage("ArcArrow 코멘트 도구는 오른쪽 마우스를 사용해 좌우 반전을 사용하실 수 있습니다", TaskMessageType.Normal);
1961
                        break;
1962
                    #endregion
1963 787a4489 KangIngu
                    #region ArrowMulti
1964
                    case "ArrowMulti":
1965
                        Common.ViewerDataModel.Instance.SelectedControl = "ArrowMulti";
1966
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ArrowMultiLine;
1967
                        //HiddenAxisLock.Visibility = Visibility.Visible;
1968
                        break;
1969
                    #endregion
1970
                    #region Etc
1971
                    case "Etc":
1972
                        Common.ViewerDataModel.Instance.SelectedControl = "Etc";
1973
                        break;
1974
                    #endregion
1975
                    #region Ink
1976
                    case "Ink":
1977
                        if (instanceToggle.Tag.ToString() == "EraserClear")
1978
                        {
1979
                            TaskMessage("해당 컨트롤은 점 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1980
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
1981
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByPoint";
1982
                        }
1983
                        else if (instanceToggle.Tag.ToString() == "Eraser")
1984
                        {
1985
                            TaskMessage("해당 컨트롤은 선 단위로 그려진 펜을 지웁니다", TaskMessageType.Normal);
1986
                            instanceMain.dzMainMenu.inkBoard.Tag = "EraseByStroke";
1987
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
1988
                        }
1989
                        else
1990
                        {
1991
                            instanceMain.dzMainMenu.inkBoard.Tag = "Ink";
1992
                            //instanceMain.dzMainMenu.inkDrawingCanvas.EditingMode = InkCanvasEditingMode.Ink;
1993
                        }
1994
1995
                        //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = true;
1996
1997
                        Common.ViewerDataModel.Instance.SelectedControl = "Ink";
1998
                        Common.ViewerDataModel.Instance.LineSize = (double)cbLineSize.Value;
1999
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.PenControl;
2000
                        break;
2001
                    #endregion
2002
                    #region Select
2003
                    case "Select":
2004 65246dc9 KangIngu
                        if(this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2005
                        {
2006
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2007
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2008
                        }
2009 787a4489 KangIngu
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Selecting;
2010
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2011 9f473fb7 KangIngu
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2012 787a4489 KangIngu
                        break;
2013
                    #endregion
2014
                    #region Image
2015
                    case "Image":
2016
                        Common.ViewerDataModel.Instance.SelectedControl = "ImgControl";
2017
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2018 83d916a3 ljiyeon
                        ImageConverter(instanceToggle);
2019 787a4489 KangIngu
                        break;
2020
                    #endregion
2021
                    #region Sign
2022
                    case "Sign":
2023
                        Common.ViewerDataModel.Instance.SelectedControl = "Sign";
2024
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2025
                        //강인구 추가
2026
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Sign;
2027
                        //instanceMain.BaseClient.GetUserSignCompleted += (sen, ea) =>
2028
                        //{
2029
                        //    if (ea.Result == null)
2030
                        //    {
2031
2032
                        //        this.ParentOfType<MainPage>().DialogMessage_Alert("You Don't Have Sign Data", "Alert");
2033
                        //    }
2034
                        //    else
2035
                        //    {
2036
                        //        byte[] imageBytes = System.Convert.FromBase64String(ea.Result);
2037
                        //        using (MemoryStream ms = new MemoryStream(imageBytes))
2038
                        //        {
2039
                        //            BitmapImage im = new BitmapImage();
2040
                        //            im.SetSource(ms);
2041
                        //            instanceMain.DeepLayer.SignImage = im;
2042
                        //            ms.Close();
2043
                        //        }
2044
                        //    }
2045
                        //};
2046
                        //instanceMain.BaseClient.GetUserSignAsync(instanceMain._ViewInfo.UserID);
2047
                        break;
2048
                    #endregion
2049
                    #region Check
2050
                    case "Check":
2051
                        Common.ViewerDataModel.Instance.SelectedControl = "Check";
2052
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2053
                        //강인구 추가
2054
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Symbol;
2055
                        break;
2056
                    #endregion
2057
                    #region Batch
2058
                    case "Batch":
2059
                        Common.ViewerDataModel.Instance.SelectedControl = "Batch";
2060
                        Common.ViewerDataModel.Instance.ControlTag = instanceMain.dzMainMenu._ViewInfo.UserID; //사번
2061
                        //강인구 추가
2062
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.Mark;
2063
                        instanceMain.dzMainMenu.txtBatch.Visibility = Visibility.Visible;
2064 999c9e40 humkyung
                        instanceMain.dzMainMenu.txtBatch.Text = "Place Mark";
2065 787a4489 KangIngu
                        break;
2066 d4b0c723 KangIngu
                    #endregion
2067
                    #region Copy
2068
                    case "Copy":
2069
                        Copy_Start();
2070
                        instanceToggle.IsChecked = false;
2071
                        ViewerDataModel.Instance.SelectedControl = "";
2072
                        ViewerDataModel.Instance.ControlTag = null;
2073
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2074
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2075
                        break;
2076
                    #endregion
2077
                    #region Cut
2078
                    case "Cut":
2079 93420e5a ljiyeon
                        //Cut_Start();
2080
                        CutCommand.Instance.Execute();
2081 d4b0c723 KangIngu
                        instanceToggle.IsChecked = false;
2082
                        ViewerDataModel.Instance.SelectedControl = "";
2083
                        ViewerDataModel.Instance.ControlTag = null;
2084
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2085
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2086
                        break;
2087
                    #endregion
2088
                    #region Paste
2089
                    case "Paste":
2090
                        Paste_Start();
2091
                        instanceToggle.IsChecked = false;
2092
                        ViewerDataModel.Instance.SelectedControl = "";
2093
                        ViewerDataModel.Instance.ControlTag = null;
2094
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2095 ccf944bb ljiyeon
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;                        
2096 d4b0c723 KangIngu
                        break;
2097
                    #endregion
2098
                    #region Delete
2099
                    case "Delete":
2100 d62c0439 humkyung
                        DeleteCommand.Instance.Execute(SelectionSet.Instance.SelectedItems);
2101 24678e06 humkyung
                        this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2102
2103 d4b0c723 KangIngu
                        instanceToggle.IsChecked = false;
2104
                        ViewerDataModel.Instance.SelectedControl = "";
2105
                        ViewerDataModel.Instance.ControlTag = null;
2106
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2107
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2108
                        break;
2109
                    #endregion
2110
                    #region Undo
2111
                    case "Undo":
2112 f816dd63 humkyung
                        UndoCommand.Instance.Execute();
2113 d4b0c723 KangIngu
                        instanceToggle.IsChecked = false;
2114
                        ViewerDataModel.Instance.SelectedControl = "";
2115
                        ViewerDataModel.Instance.ControlTag = null;
2116
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2117
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2118
                        break;
2119
                    #endregion
2120
                    #region Redo
2121
                    case "Redo":
2122 f816dd63 humkyung
                        RedoCommand.Instance.Execute();
2123 d4b0c723 KangIngu
                        instanceToggle.IsChecked = false;
2124
                        ViewerDataModel.Instance.SelectedControl = "";
2125
                        ViewerDataModel.Instance.ControlTag = null;
2126
                        this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2127
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2128 9f473fb7 KangIngu
                        break;
2129
                    #endregion
2130
                    #region DragZoom
2131
                    case "DragZoom":
2132
                        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.DragZoom;
2133
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2134
                        instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2135
                        break;
2136 d4b0c723 KangIngu
                    #endregion
2137 53880c83 ljiyeon
                    #region Grouping
2138
                    case "Group":
2139 c0977e97 djkim
                        //var GrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2140
                        //foreach (var togle in GrouptoggleList)
2141
                        //{
2142
                        //    togle.IsChecked = false;
2143
                        //}
2144 53880c83 ljiyeon
2145 c0977e97 djkim
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2146
                        //{
2147
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2148
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2149
                        //}
2150
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2151
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2152
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2153
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2154
                        //{
2155
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2156
                        //}
2157
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2158
                        //{
2159
                        //    // string MarkupData = "";
2160
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2161
                        //    {
2162
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 2) // 얘가 2개 이상이여야 그룹가능 버튼도 막을거긴하지만 일단..
2163
                        //        {
2164
                        //            //MARKUP_DATA_GROUP INSERT
2165
                        //            MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP
2166
                        //            {
2167
                        //                SYMBOL_ID = null,//InnerItem.Symbol_ID
2168
                        //                STATE = 0,
2169
                        //            };
2170
                        //            long group_id = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddMarkupDataGroup(mARKUP_DATA_GROUP, App.ViewInfo.ProjectNO);
2171
                        //            Logger.sendReqLog("AddMarkupDataGroup: ", "", 1);
2172
                        //            if (group_id > 0)
2173
                        //            {
2174
                        //                foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2175
                        //                {
2176
                        //                    if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2177
                        //                    {
2178
                        //                        //MARKUP_DATA UPDATE
2179
                        //                        //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, group_id, App.ViewInfo.ProjectNO);
2180
                        //                        //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2181
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = group_id;
2182
                        //                        ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2183
                        //                    }
2184
                        //                }
2185
                        //            }
2186
                        //        }
2187
                        //    }
2188
                        //}
2189 53880c83 ljiyeon
                        break;
2190
                    case "UnGroup":
2191 c0977e97 djkim
                        //var UnGrouptoggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2192
                        //foreach (var togle in UnGrouptoggleList)
2193
                        //{
2194
                        //    togle.IsChecked = false;
2195
                        //}
2196
                        //if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2197
                        //{
2198
                        //    ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2199
                        //    this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2200
                        //}
2201
                        //this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2202
                        //instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2203
                        //instanceMain.dzMainMenu.isLeftMouseButtonDownOnWindow = false;
2204
2205
                        //if (ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Count < 1) //선택된 것이 없으면
2206
                        //{
2207
                        //    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Please Select Controls", "Alert");
2208
                        //}
2209
                        //else//if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2210
                        //{
2211
                        //    // string MarkupData = "";
2212
                        //    foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2213
                        //    {
2214
                        //        if (item.GetType().Name == "AdornerFinal" && (item as AdornerFinal).MemberSet.Count >= 1) // 1개 이상 
2215
                        //        {
2216
                        //            //MARKUP_DATA UPDATE
2217
                        //            foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>())
2218
                        //            {
2219
                        //                if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2220
                        //                {
2221
                        //                    long group_id = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault().Group_ID;
2222
                        //                    //MARKUP_DATA UPDATE
2223
                        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupData((InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo).CommentID, 0, App.ViewInfo.ProjectNO);
2224
                        //                    //Logger.sendReqLog("UpdateMarkupData: ", "", 1);
2225
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().Group_ID = 0;
2226
                        //                    ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == (InnerItem.DrawingData as CommentUserInfo).CommentID).FirstOrDefault().IsUpdate = true;
2227
2228
2229
                        //                    //MARKUP_DATA_GROUP UPDATE
2230
                        //                    //bool value = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.UpdateMarkupDataGroup(group_id, App.ViewInfo.ProjectNO);
2231
                        //                    //Logger.sendReqLog("AddMarkupDataGroup: ", value.ToString(), 1);
2232
                        //                }
2233
                        //            }
2234
                        //        }
2235
                        //    }
2236
                        //}
2237 53880c83 ljiyeon
                        break;
2238
                    #endregion
2239
                    #region Capture
2240
                    case "Capture":
2241
                        SyncInit();
2242
                        //   instanceToggle.IsChecked = false;
2243
                        var CaptureList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2244
                        foreach (var togle in CaptureList)
2245
                        {
2246
                            togle.IsChecked = false;
2247
                        }
2248
2249
                        if (this.ParentOfType<MainWindow>().dzMainMenu.currentControl != null)
2250
                        {
2251
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(this.ParentOfType<MainWindow>().dzMainMenu.currentControl);
2252
                            this.ParentOfType<MainWindow>().dzMainMenu.currentControl = null;
2253
                        }
2254
2255
                        ViewerDataModel.Instance.SelectedControl = "ImgControl";
2256
                   //     ViewerDataModel.Instance.ControlTag = null;
2257
                        instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ImgControl;
2258
2259
                        /*
2260
                        //캡쳐 하기 전에 코멘트 저장
2261
                        if (Common.ViewerDataModel.Instance.MarkupControls_USER.Count > 0 || (Application.Current.MainWindow as MainWindow).dzMainMenu.SelectLayer.Children.Count > 0)
2262
                        {
2263
                            var menu = (Application.Current.MainWindow as MainWindow).dzMainMenu;
2264
                            menu.ReleaseAdorner();
2265
                            if (menu.PreviewUserMarkupInfoItem != null && menu.PreviewUserMarkupInfoItem.IsPreviewUser == true)
2266
                            {
2267
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2268
                            }
2269
                            else if (menu.gridViewMarkup.SelectedItems.Count == 0 || (menu.gridViewMarkup.SelectedItems.FirstOrDefault() as IKCOM.MarkupInfoItem).UserID != App.ViewInfo.UserID)
2270
                            {
2271
2272
                            }
2273
                            else
2274
                            {
2275
                                (Application.Current.MainWindow as MainWindow).dzTopMenu.RefactoryCommentReact(menu);
2276
                            }
2277
                        }*/
2278
2279
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Telerik.Windows.Controls.RadButton).DataContext as Customer).ID;
2280
                        //Common.ViewerDataModel.Instance.CheckList_ID = ((e.Source as Image).DataContext as Customer).ID;
2281
                        //Common.ViewerDataModel.Instance.PageNumber = ((e.Source as Image).DataContext as Customer).PAGENUMBER;
2282
                        Application.Current.MainWindow.Focus();
2283
                        Common.ViewerDataModel.Instance.Capture_Opacity = 0.49;
2284 1c7f408a taeseongkim
2285
                        var mainwindow = (RadWindowManager.Current.GetWindows().Find(x => x is MainWindow) as MainWindow);
2286
                        if (mainwindow != null)
2287
                        {
2288
                            mainwindow.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Capture;
2289
                        }
2290
2291 53880c83 ljiyeon
                        break;
2292
                    #endregion
2293 f324a940 djkim
                    //#region Cad
2294
                    //case "Inside":
2295
                    //    //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2296
                    //    //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2297
                    //    Common.ViewerDataModel.Instance.SelectedControl = "InsideWhite";
2298
                    //    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.InsideWhite;
2299
                    //    break;
2300
                    //case "Overlap":
2301
                    //    //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2302
                    //    //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2303
                    //    Common.ViewerDataModel.Instance.SelectedControl = "OverlapWhite";
2304
                    //    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.OverlapWhite;
2305
                    //    break;
2306
                    //case "Clip":
2307
                    //    //instanceMain.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.Drawing;
2308
                    //    //instanceMain.dzMainMenu.inkDrawingCanvas.IsEnabled = false;
2309
                    //    Common.ViewerDataModel.Instance.SelectedControl = "ClipWhite";
2310
                    //    instanceMain.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.ClipWhite;
2311
                    //    break;
2312
                    //case "CadExport":
2313
                    //    if (isClosed)
2314
                    //    {
2315
                    //        //토글 및 마우스 상태 초기화
2316
                    //        var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2317
                    //        foreach (var togle in toggleList)
2318
                    //        {
2319
                    //            togle.IsChecked = false;
2320
                    //        }
2321
                    //        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2322
2323
                    //        isClosed = false;
2324
                    //        //Control 파일 먼저 생성
2325
                    //        CollapsedButton_Click();
2326
                    //        CadViewer check = new CadViewer();
2327
                    //        check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2328
                    //        check.Title = "Export Viewer";
2329
                    //        //check.Topmost = true;
2330
                    //        check.Show();
2331
                    //        check.Closed += Check_Closed;
2332
                    //        instanceToggle.IsChecked = false;
2333
                    //    }
2334
                    //    break;
2335
                    //case "CadViewer":
2336
                    //    if (isClosed)
2337
                    //    {
2338
                    //        //토글 및 마우스 상태 초기화
2339
                    //        var toggleList = this.Parent.ChildrenOfType<RadRibbonToggleButton>();
2340
                    //        foreach (var togle in toggleList)
2341
                    //        {
2342
                    //            togle.IsChecked = false;
2343
                    //        }
2344
                    //        this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2345
2346
                    //        isClosed = false;
2347
                    //        CadResultViewer check = new CadResultViewer();
2348
                    //        check.WindowStartupLocation = WindowStartupLocation.CenterScreen;
2349
                    //        check.Title = "Viewer";
2350
                    //        check.Show();
2351
2352
                    //        check.Closed += Check_Closed;
2353
2354
                    //    }
2355
                    //    break;
2356
                    //#endregion
2357 787a4489 KangIngu
                    default:
2358
                        break;
2359
                }
2360
                #endregion
2361
            }
2362
            else
2363
            {
2364 992a98b4 KangIngu
2365 787a4489 KangIngu
                if (!instanceMain.dzMainMenu.IsFreeSelectionMode)
2366
                {
2367
                    instanceMain.dzMainMenu.IsSwingMode = false;
2368
                    Common.ViewerDataModel.Instance.SelectedControl = "";
2369
                    Common.ViewerDataModel.Instance.ControlTag = null;
2370
                    this.ParentOfType<MainWindow>().dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None;
2371
                    this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2372
                }
2373
            }
2374
        }
2375
2376 53880c83 ljiyeon
        private void SyncInit()
2377
        {
2378
            try
2379
            {
2380
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden)
2381
                {
2382
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.testPanel2.IsHidden = true;
2383
                    ViewerDataModel.Instance.PageBalanceMode = false;
2384
                    ViewerDataModel.Instance.PageBalanceNumber = 0;
2385
                    ViewerDataModel.Instance.PageNumber = 0;
2386
                    ViewerDataModel.Instance.MarkupControls_Sync.Clear();
2387
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewRevMarkup.Visibility = Visibility.Collapsed;
2388
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.UserList.IsChecked = false;
2389
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.BalanceMode.IsChecked = false;
2390
                }
2391
            }
2392
            catch (Exception ex)
2393
            {
2394
                Logger.sendResLog("SyncInit", ex.Message, 0);
2395
            }
2396
2397
        }
2398
2399 684ef11c ljiyeon
        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2400
        CommentUserInfo currentControl { get; set; }
2401
        private void Check_Closed(object sender, EventArgs e)
2402
        {
2403
            isClosed = true;
2404
            //this.ParentOfType<MainWindow>().dzMainMenu.PN_Navi.IsEnabled = true;
2405
            //토글 및 마우스 상태 초기화
2406
            var toggleList = this.Parent.ChildrenOfType<RadToggleButton>();
2407
            foreach (var togle in toggleList)
2408
            {
2409
                togle.IsChecked = false;
2410
            }
2411
            this.ParentOfType<MainWindow>().dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None;
2412
            ViewerDataModel.Instance.Capture_Opacity = 0;
2413
2414
        }
2415
2416
        /* public class test 
2417
         {
2418
             public double width { get; set; }
2419
             public double height { get; set; }
2420
         }
2421
         */
2422
        private void CollapsedButton_Click()
2423
        {
2424
            this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); // 저장하지 못한 데이터가 있다면 저장
2425
2426
            string[] data = new string[0];
2427
2428
            int cnt = 0;
2429
            var menu = this.ParentOfType<MainWindow>().dzMainMenu;
2430
2431
            List<MarkupInfoItem> gridSelectionItem = menu.gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
2432
2433
            foreach (var item in gridSelectionItem)
2434
            {
2435
                if ((item.UserID == App.ViewInfo.UserID) && (ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage != null))
2436
                {
2437 d62c0439 humkyung
                    var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber &&
2438 684ef11c ljiyeon
                    d.MarkupInfoID == item.MarkupInfoID).ToList();
2439
                    data = new string[instance.Count];
2440
                    foreach (var markup in instance)
2441
                    {
2442
                        data[cnt++] = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(markup.Data);
2443
                    }
2444
                }
2445
            }
2446
2447 cf2671a6 ljiyeon
            if (data != null && KCOM.Properties.Settings.Default.cad == 1)
2448 684ef11c ljiyeon
            {
2449
                string FilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Cad");
2450
                string FileName = FilePath + "\\commentstring.json"; // Default file name
2451
                if (!File.Exists(FilePath))
2452
                {
2453
                    Directory.CreateDirectory(FilePath);
2454
                }
2455
2456
                if (!string.IsNullOrEmpty(FileName))
2457
                {
2458
                    //  File.WriteAllText(SaveDig.FileName, data);
2459
                    File.WriteAllLines(FileName, data);
2460
                }
2461
            }
2462
        }
2463
2464
        private double minHeight;
2465
        private double minWidth;
2466
2467
        private double maxHeight;
2468
        private double maxWidth;
2469
2470
        public bool CanVResize { get; private set; }
2471
        public bool CanHResize { get; private set; }
2472
2473
        public void DesignerComponent(FrameworkElement content)
2474
        {
2475
            this.InitializeComponent();
2476
2477
            if (!double.IsNaN(content.Width))
2478
            {
2479
                CanHResize = false;
2480
                this.Width = content.Width;
2481
            }
2482
            else
2483
            {
2484
                CanHResize = true;
2485
                this.Width = 23.0;
2486
            }
2487
            if (!double.IsNaN(content.Height))
2488
            {
2489
                CanVResize = false;
2490
                this.Height = content.Height; ;
2491
            }
2492
            else
2493
            {
2494
                CanVResize = true;
2495
                this.Height = 23.0;
2496
            }
2497
2498
            minWidth = content.MinWidth < 10.0 ? 10.0 : content.MinWidth;
2499
            minHeight = content.MinHeight < 10.0 ? 10.0 : content.MinHeight;
2500
            maxWidth = content.MaxWidth;
2501
            maxHeight = content.MaxHeight;
2502
2503
            double top = (double)content.GetValue(Canvas.TopProperty);
2504
            if (double.IsNaN(top))
2505
                top = 0.0;
2506
            double left = (double)content.GetValue(Canvas.LeftProperty);
2507
            if (double.IsNaN(left))
2508
                left = 0.0;
2509
            SetValue(Canvas.TopProperty, top);
2510
            SetValue(Canvas.LeftProperty, left);
2511
2512
            //Set the actual content. Note that "Content" property is a new property. See below
2513
            this.Content = content;
2514
        }
2515
        private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
2516
        {
2517
            string name = ((Thumb)sender).Name;
2518
            if (name.Contains("Top"))
2519
            {
2520
                double newHeight = this.Height - e.VerticalChange;
2521
                if (newHeight >= minHeight && newHeight <= maxHeight)
2522
                {
2523
                    this.Height = newHeight;
2524
                    SetValue(Canvas.TopProperty,
2525
                (double)GetValue(Canvas.TopProperty) + e.VerticalChange);
2526
                }
2527
            }
2528
            if (name.Contains("Right"))
2529
            {
2530
                double newWidth = this.Width + e.HorizontalChange;
2531
                if (newWidth >= minWidth && newWidth <= maxWidth)
2532
                    this.Width = newWidth;
2533
            }
2534
            if (name.Contains("Bottom"))
2535
            {
2536
                double newHeight = this.Height + e.VerticalChange;
2537
                if (newHeight >= minHeight && newHeight <= maxHeight)
2538
                    this.Height = newHeight;
2539
            }
2540
            if (name.Contains("Left"))
2541
            {
2542
                double newWidth = this.Width - e.HorizontalChange;
2543
                if (newWidth >= minWidth && newWidth <= maxWidth)
2544
                {
2545
                    this.Width = newWidth;
2546
                    SetValue(Canvas.LeftProperty,
2547
                (double)GetValue(Canvas.LeftProperty) + e.HorizontalChange);
2548
                }
2549
            }
2550
        }
2551
2552
        private void drawControlBorder(object sender)
2553
        {
2554
            System.Windows.Controls.Control control = (System.Windows.Controls.Control)sender;
2555
        }
2556
2557
        private void ResizeThumb_DragDelta(object sender, MouseButtonEventArgs e)
2558
        {
2559
            System.Windows.Controls.Control designerItem = (System.Windows.Controls.Control)sender;
2560
            if (designerItem != null)
2561
            {
2562
                double deltaVertical, deltaHorizontal;
2563
2564
                switch (VerticalAlignment)
2565
                {
2566
                    case VerticalAlignment.Bottom:
2567
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2568
                        designerItem.Height -= deltaVertical;
2569
                        break;
2570
                    case VerticalAlignment.Top:
2571
                        deltaVertical = designerItem.ActualHeight - designerItem.MinHeight;
2572
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
2573
                        designerItem.Height -= deltaVertical;
2574
                        break;
2575
                    default:
2576
                        break;
2577
                }
2578
2579
                switch (HorizontalAlignment)
2580
                {
2581
                    case HorizontalAlignment.Left:
2582
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2583
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
2584
                        designerItem.Width -= deltaHorizontal;
2585
                        break;
2586
                    case HorizontalAlignment.Right:
2587
                        deltaHorizontal = designerItem.ActualWidth - designerItem.MinWidth;
2588
                        designerItem.Width -= deltaHorizontal;
2589
                        break;
2590
                    default:
2591
                        break;
2592
                }
2593
            }
2594
            e.Handled = true;
2595
        }
2596
2597
        SaveFileDialog SaveDig = new SaveFileDialog(); //파일 세이브 다이얼로그
2598
2599
        void ExportMethod()
2600
        {
2601
            //FileDialogFilter filterImage = new FileDialogFilter("Image Files", "*.jpg", "*.png");
2602
            SaveDig.Filter = "PDF file format|*.pdf";
2603
            SaveDig.Title = "Save an DWG File";
2604
            SaveDig.ShowDialog();
2605
        }
2606
2607 537f4cd8 djkim
        private void cbAutoSave_Checked(object sender, RoutedEventArgs e)
2608 be04d12c djkim
        {            
2609
            if (cbAutoSave.IsChecked == true)
2610 537f4cd8 djkim
            {
2611
                SaveTime(true, (int)cbSaveInterval.Value);
2612
            }
2613
            else
2614
            {
2615
                SaveTime(false, (int)cbSaveInterval.Value);
2616
            }
2617
        }
2618
        private void cbSaveInterval_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
2619
        {
2620 be04d12c djkim
            if(string.IsNullOrEmpty(cbSaveInterval.Value.ToString()))
2621
            {
2622
                cbSaveInterval.Value = cbSaveInterval.Minimum;
2623
            }
2624 537f4cd8 djkim
            if (cbAutoSave.IsChecked == true)
2625
            {
2626
                SaveTime(true, (int)cbSaveInterval.Value);
2627 5822e146 ljiyeon
            }
2628
2629
            KCOM.Properties.Settings.Default.SaveInterval = (double)cbSaveInterval.Value;
2630
            Properties.Settings.Default.Save();
2631 537f4cd8 djkim
        }
2632 787a4489 KangIngu
        //강인구 자동 저장 추가
2633
        private void AutoSave(object sender, RoutedEventArgs e)
2634
        {
2635
            RadToggleButton instanceToggle = sender as RadToggleButton;
2636
2637
            if(instanceToggle.IsChecked == true)
2638
            {
2639
                SaveTime(true);
2640
            }
2641
            else
2642
            {
2643
                SaveTime(false);
2644
            }
2645
        }
2646
2647 d4b0c723 KangIngu
        public void Copy_Start()
2648
        {
2649
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2650
            {
2651
                string MarkupData = "";
2652
2653
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2654
                {
2655
                    if (item.GetType().Name == "AdornerFinal")
2656
                    {
2657 4913851c humkyung
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2658 d4b0c723 KangIngu
2659
                        {
2660
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2661
                            {
2662 129ca191 humkyung
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2663
                                MarkupData += "|OR|" + res.ConvertData;
2664 d4b0c723 KangIngu
                            }
2665
                        }
2666
                        Clipboard.SetText(MarkupData);
2667
                    }
2668
                }
2669
            }
2670
        }
2671
2672
        public void Cut_Start()
2673
        {
2674
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
2675
            {
2676
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
2677
                {
2678
                    string MarkupData = "";
2679
2680
                    if (item.GetType().Name == "AdornerFinal")
2681
                    {
2682 4913851c humkyung
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
2683 d4b0c723 KangIngu
                        {
2684
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
2685
                            {
2686 129ca191 humkyung
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
2687
                                MarkupData += "|OR|" + res.ConvertData;
2688 d4b0c723 KangIngu
                            }
2689
                        }
2690 ccf944bb ljiyeon
                        //클립보드에 넣음
2691 d4b0c723 KangIngu
                        Clipboard.SetText(MarkupData);
2692
                    }
2693
                }
2694
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
2695
            }
2696
        }
2697
2698
        public void Paste_Start()
2699
        {
2700
            //마크업 붙여넣기
2701
            //if (Clipboard.GetText().Contains("|DZ|"))
2702
            if (Clipboard.GetText().Contains("|OR||DZ|"))
2703
            {
2704
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2705
2706
                string[] delimiterChars = { "|OR|" };
2707
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
2708
2709 077896be humkyung
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
2710 d4b0c723 KangIngu
2711
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2712
2713
                //강인구 Undo/Redo 보류
2714 129ca191 humkyung
                MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2715 d4b0c723 KangIngu
                {
2716
                    IsUndo = false,
2717
                    Event = Event_Type.Create,
2718
                    EventTime = DateTime.Now,
2719
                    Markup_List = new List<Multi_Undo_data>()
2720
                };
2721
2722
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2723
                {
2724
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2725
                });
2726
2727
                foreach (string parse in data)
2728
                {
2729
                    if (parse != "")
2730
                    {
2731 5529d2a2 humkyung
                        System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty);
2732 24678e06 humkyung
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid();
2733 d4b0c723 KangIngu
2734
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2735
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
2736
2737
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
2738
2739
                        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
2740
                        //this.dzMainMenu.SelectLayer.Children.Add(final);
2741
2742
                        multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
2743
2744
                        UndoData.Markup_List.Add(multi_Undo_Data);
2745 6707a5c7 ljiyeon
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
2746 d4b0c723 KangIngu
                    }
2747
                }
2748
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2749
2750
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
2751
                {
2752
                    Canvas.SetLeft(final, 0);
2753
                    Canvas.SetTop(final, 0);
2754
                }
2755
                else
2756
                {
2757
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2758
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2759 0d00f9c8 humkyung
                    final.TranslateItems(realPointX, realPointY);
2760 d4b0c723 KangIngu
2761 4913851c humkyung
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
2762 d4b0c723 KangIngu
                    {
2763 0d00f9c8 humkyung
                        final.TranslateItems(0.001, 0.001); //dummy
2764 d4b0c723 KangIngu
                    }
2765 6707a5c7 ljiyeon
2766 d4b0c723 KangIngu
                }
2767
                
2768
2769
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2770
2771
                //붙여 넣을때 원본 컨트롤과 겹치지 않도록 설정
2772
                //Canvas.SetLeft(final, 50);
2773
                //Canvas.SetTop(final, 50);
2774
            }
2775
            //외부 이미지 붙여넣기
2776
            else if (Clipboard.GetImage() != null)
2777
            {
2778 c73426a9 ljiyeon
                try
2779 d4b0c723 KangIngu
                {
2780 c73426a9 ljiyeon
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2781 d4b0c723 KangIngu
2782 c73426a9 ljiyeon
                    //강인구 Undo/Redo 보류
2783 129ca191 humkyung
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
2784 c73426a9 ljiyeon
                    {
2785
                        IsUndo = false,
2786
                        Event = Event_Type.Create,
2787
                        EventTime = DateTime.Now,
2788
                        Markup_List = new List<Multi_Undo_data>()
2789
                    };
2790 d4b0c723 KangIngu
2791
2792 c73426a9 ljiyeon
                    string temppath = System.IO.Path.GetTempPath();
2793
                    //string filename = KCOM.Events.Save.shortCommentKey();
2794 24678e06 humkyung
                    string filename = Commons.shortFileKey();
2795 d4b0c723 KangIngu
2796 c73426a9 ljiyeon
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2797
                    clipboardImage.Save(temppath + "\\" + filename);
2798 d4b0c723 KangIngu
2799 c73426a9 ljiyeon
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2800
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2801
                    long numByte = fileInfo.Length;
2802
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2803
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2804 d4b0c723 KangIngu
2805 c73426a9 ljiyeon
                    if (dLen < 4)
2806
                    {
2807
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2808
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2809
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2810
                        byte[] data = br.ReadBytes((int)numByte);
2811 d4b0c723 KangIngu
2812 c73426a9 ljiyeon
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2813
                        Check_Uri.UriCheck(filename);
2814
                        br.Close();
2815
                        fStream.Close();
2816
                        fStream.Dispose();
2817
                    }
2818
                    else
2819
                    {
2820
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2821
                        return;
2822
                    }
2823 d4b0c723 KangIngu
2824 c73426a9 ljiyeon
                    fileInfo.Delete();
2825
2826
                    //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2827
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2828
                    IntPtr hBitmap = bmp.GetHbitmap();
2829
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2830
                    Image img = new Image();
2831
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2832
                    if (filename.Contains(".svg"))
2833 53880c83 ljiyeon
                    {
2834 c73426a9 ljiyeon
                        byte[] imageData = null;
2835
                        DrawingImage image = null;
2836
                        using (System.Net.WebClient web = new System.Net.WebClient())
2837
                        {
2838
                            imageData = web.DownloadData(new Uri(filename));
2839
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2840
                            image = SvgReader.Load(stream);
2841
                        }
2842
                        img.Source = image;
2843
                    }
2844
                    else
2845
                    {
2846
                        img.Source = new BitmapImage(new Uri(filename));
2847 53880c83 ljiyeon
                    }
2848 d4b0c723 KangIngu
2849 c73426a9 ljiyeon
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2850
                    {
2851
                        PointSet = new List<Point>(),
2852
                        //FilePath = img.Source.ToString(),
2853
                        FilePath = filename,
2854
                        ImageData = img.Source,
2855
                        StartPoint = new Point(100, 100),
2856
                        EndPoint = new Point(200, 200),
2857
                        TopRightPoint = new Point(100, 200),
2858
                        LeftBottomPoint = new Point(200, 100)
2859
                    };
2860 d4b0c723 KangIngu
2861 c73426a9 ljiyeon
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2862
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2863
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2864 d4b0c723 KangIngu
2865 c73426a9 ljiyeon
                    currentControl.PointSet = new List<Point>
2866 d4b0c723 KangIngu
                                        {
2867
                                            currentControl.StartPoint,
2868
                                            currentControl.LeftBottomPoint,
2869
                                            currentControl.EndPoint,
2870
                                            currentControl.TopRightPoint,
2871
                                        };
2872
2873 c73426a9 ljiyeon
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2874
                    UndoData.Markup_List.Add(multi_Undo_Data);
2875
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2876 d4b0c723 KangIngu
2877 c73426a9 ljiyeon
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2878 24678e06 humkyung
                    currentControl.CommentID = Commons.shortGuid();
2879 d4b0c723 KangIngu
2880 c73426a9 ljiyeon
                    currentControl.ApplyTemplate();
2881
                    currentControl.SetImage();
2882 d4b0c723 KangIngu
2883 c73426a9 ljiyeon
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2884
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2885
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2886 ccf944bb ljiyeon
2887 c73426a9 ljiyeon
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2888
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2889 0d00f9c8 humkyung
                    final.TranslateItems(realPointX, realPointY);
2890 c73426a9 ljiyeon
                }
2891
                catch(Exception ex)
2892
                {
2893
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2894
                }
2895 d4b0c723 KangIngu
            }
2896
        }
2897 787a4489 KangIngu
    }
2898
}
클립보드 이미지 추가 (최대 크기: 500 MB)