프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 6b6e937c

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