프로젝트

일반

사용자정보

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

markus / KCOM / Events / Implementation / TopMenuEvent.cs @ 8acc4862

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