프로젝트

일반

사용자정보

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

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

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

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