프로젝트

일반

사용자정보

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

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

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

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