프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 285635d3

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