프로젝트

일반

사용자정보

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

markus / KCOM / Common / ViewerDataModel.cs @ bae83c92

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

1
using KCOM.Events;
2
using KCOM.Messenger;
3
using KCOMDataModel.DataModel;
4
//using Leadtools;
5
using MarkupToPDF.Common;
6
using Newtonsoft.Json;
7
using System;
8
using System.Collections;
9
using System.Collections.Generic;
10
using System.Collections.ObjectModel;
11
using System.ComponentModel;
12
using System.IO;
13
using System.Linq;
14
using System.Text;
15
using System.Threading.Tasks;
16
using System.Windows;
17
using System.Windows.Controls;
18
using System.Windows.Ink;
19
using System.Windows.Media;
20
using System.Xml;
21
using System.Xml.Serialization;
22
//using IKCOM;
23

    
24
namespace KCOM.Common
25
{
26
    public class ViewerDataModel : INotifyPropertyChanged
27
    {
28

    
29
        System.Threading.CancellationTokenSource TokenSource;
30

    
31
        public System.Threading.CancellationToken CancellationToken()
32
        {
33
            return TokenSource.Token;
34
        }
35

    
36
        public System.Threading.CancellationToken NewCancellationToken()
37
        {
38
            if (TokenSource != null)
39
            {
40
                System.Diagnostics.Debug.WriteLine("cancel Token");
41
                TokenSource.Cancel();
42
            }
43

    
44
            TokenSource = new System.Threading.CancellationTokenSource();
45

    
46
            return TokenSource.Token;
47
        }
48

    
49

    
50
        private static DateTime KeyInputTime = DateTime.Now;
51
        private static TimeSpan KeyInputDelay = new TimeSpan(0, 0, 1);
52

    
53
        public bool IsFastKeyInput()
54
        {
55
            if(DateTime.Now - KeyInputTime < KeyInputDelay)
56
            {
57
                return true;
58
            }
59
            else
60
            {
61
                KeyInputTime = DateTime.Now;
62
                return false;
63
            }
64
        }
65

    
66
        #region Data Members
67

    
68
        private static ViewerDataModel instance = new ViewerDataModel();
69

    
70
        //private ObservableCollection<CommentUserInfo> markupControls_Pre = new ObservableCollection<CommentUserInfo>();
71

    
72
        private ObservableCollection<CommentUserInfo> markupControls = new ObservableCollection<CommentUserInfo>();
73
        private ObservableCollection<CommentUserInfo> markupControls_Sync = new ObservableCollection<CommentUserInfo>();
74
        private ObservableCollection<CommentUserInfo> markupControls_User = new ObservableCollection<CommentUserInfo>();
75

    
76

    
77
        ////강인구 추가
78
        //private List<Check_Inferface> check_Item = new List<Check_Inferface>();
79
        private ObservableCollection<KCOMDataModel.DataModel.DOCPAGE> document_Info = new ObservableCollection<KCOMDataModel.DataModel.DOCPAGE>();
80
        private ObservableCollection<Undo_data> undoDataList = new ObservableCollection<Undo_data>();
81
        
82
        //public  UndoDataList { get; set; }
83

    
84

    
85
        private ObservableCollection<IKCOM.MarkupInfoItem> markupInfoList = new ObservableCollection<IKCOM.MarkupInfoItem>();
86
        private ObservableCollection<MarkupUserInfo> markupUserList = new ObservableCollection<MarkupUserInfo>();
87
        
88
        private ObservableCollection<IKCOM.MarkupInfoItem> markupInfoRevList = new ObservableCollection<IKCOM.MarkupInfoItem>();
89

    
90
        public List<FAVORITE_DOC> FavoriteSelctedSet = new List<FAVORITE_DOC>();
91
        public List<FAVORITE_DOC> FavoriteSet = new List<FAVORITE_DOC>();
92
        public List<KCOMDataModel.DataModel.DOCPAGE> RotationDocs = new List<KCOMDataModel.DataModel.DOCPAGE>();
93
        //_markupInfoList
94

    
95
        private StrokeCollection markupPens = new StrokeCollection();
96

    
97
        //private ObservableCollection<RectangleData> rectangles = new ObservableCollection<RectangleData>();
98

    
99

    
100
        private double contentScale = 1;
101

    
102
        private double contentOffsetY = 0;
103

    
104
        private double contentOffsetX = 0;
105

    
106
        private double Sync_contentScale = 1;
107

    
108
        private double Sync_contentOffsetY = 0;
109

    
110
        private double Sync_contentOffsetX = 0;
111

    
112
        private double contentViewportHeight = 0;
113

    
114
        private double contentViewportWidth = 0;
115

    
116
        private double contentWidth = 0;
117

    
118
        private MessageCollection _k_talkMessageSet;
119

    
120
        private double contentHeight = 0;
121

    
122
        private double markupAngle = 0;
123

    
124
        private double pageAngle = 0;
125

    
126
        private double angleOffsetX = 0;
127

    
128
        private double angleOffsetY = 0;
129

    
130
        private ImageBrush backgroundImage;
131

    
132
        //private RasterImage _rasterimage;
133

    
134

    
135
        #endregion Data Members
136

    
137
        #region Property Member
138

    
139
        public bool IsWheelPageChanage = false;
140

    
141
        public static ViewerDataModel Instance
142
        {
143
            get
144
            {
145
                return instance;
146
            }
147
        }
148

    
149
        private bool isDownloadOriginal;
150
        public bool IsDownloadOriginal
151
        {
152
            get => isDownloadOriginal;
153
            set
154
            {
155
                if (isDownloadOriginal != value)
156
                {
157
                    isDownloadOriginal = value;
158
                    OnPropertyChanged("IsDownloadOriginal");
159
                }
160
            }
161
        }
162

    
163
        private bool isAdmin;
164
        public bool IsAdmin
165
        {
166
            //get => true;
167
            get => isAdmin;
168
            set
169
            {
170
                isAdmin = value;
171
                OnPropertyChanged("IsAdmin");
172
            }
173
        }
174

    
175
        private bool isDocumentHistory;
176
        public bool IsDocumentHistory
177
        {
178
            get => isDocumentHistory;
179
            set
180
            {
181
                isDocumentHistory = value;
182
                OnPropertyChanged("IsDocumentHistory");
183
            }
184
        }
185

    
186
        private bool isDownloadCancel;
187
        public bool IsDownloadCancel
188
        {
189
            get => isDownloadCancel;
190
            set
191
            {
192
                if (isDownloadCancel != value)
193
                {
194
                    isDownloadCancel = value;
195
                    OnPropertyChanged("IsDownloadCancel");
196
                }
197
            }
198
        }
199

    
200
        private int downloadFileProgress;
201
        public int DownloadFileProgress
202
        {
203
            get => downloadFileProgress;
204
            set
205
            {
206
                if (downloadFileProgress != value)
207
                {
208
                    downloadFileProgress = value;
209
                    OnPropertyChanged("DownloadFileProgress");
210
                }
211
            }
212
        }
213

    
214
        private string originalTempFile;
215
        public string OriginalTempFile
216
        {
217
            get => originalTempFile;
218
            set
219
            {
220
                if (originalTempFile != value)
221
                {
222
                    originalTempFile = value;
223
                    OnPropertyChanged("OriginalTempFile");
224
                }
225
            }
226
        }
227

    
228
        private List<IKCOM.MarkupItemEx> _MarkupList_MY { get; set; }
229
        public List<IKCOM.MarkupItemEx> MarkupList_MY
230
        {
231
            get
232
            {
233
                if (_MarkupList_MY == null)
234
                {
235
                    _MarkupList_MY = new List<IKCOM.MarkupItemEx>();
236
                }
237

    
238
                return _MarkupList_MY;
239
            }
240
            set
241
            {
242

    
243
                _MarkupList_MY = value;
244
                OnPropertyChanged("MarkupList_MY");
245
            }
246
        }
247

    
248
        private List<IKCOM.MarkupItemEx> _MarkupList_USER { get; set; }
249
        public List<IKCOM.MarkupItemEx> MyMarkupList
250
        {
251
            get
252
            {
253
                if (_MarkupList_USER == null)
254
                {
255
                    _MarkupList_USER = new List<IKCOM.MarkupItemEx>();
256
                }
257

    
258
                return _MarkupList_USER;
259
            }
260
            set
261
            {
262

    
263
                _MarkupList_USER = value;
264
                OnPropertyChanged("_MarkupList_USER");
265
            }
266
        }
267

    
268
        private List<IKCOM.MarkupItemEx> _MarkupList_Pre { get; set; }
269
        public List<IKCOM.MarkupItemEx> MarkupList_Pre
270
        {
271
            get
272
            {
273
                if (_MarkupList_Pre == null)
274
                {
275
                    _MarkupList_Pre = new List<IKCOM.MarkupItemEx>();
276
                }
277

    
278
                return _MarkupList_Pre;
279
            }
280
            set
281
            {
282

    
283
                _MarkupList_Pre = value;
284
                OnPropertyChanged("MarkupList_Pre");
285
            }
286

    
287
        }
288

    
289
        private System.IO.FileInfo _searchPDF { get; set; }
290
        public System.IO.FileInfo searchPDF
291
        {
292
            get
293
            {
294
                return _searchPDF;
295
            }
296
            set
297
            {
298
                _searchPDF = value;
299
                OnPropertyChanged("searchPDF");
300
            }
301
        }
302

    
303

    
304
        /// <summary>
305
        /// 현재 상단 메뉴에서 선택된 컨트롤
306
        /// </summary>
307
        private string _SelectedControl { get; set; }
308
        public string SelectedControl
309
        {
310
            get
311
            {
312
                return _SelectedControl;
313
            }
314
            set
315
            {
316
                _SelectedControl = value;
317
                OnPropertyChanged("SelectedControl");
318
            }
319
        }
320

    
321
        private List<KCOM.Common.MacroItem> _MacroItems;
322

    
323
        public List<KCOM.Common.MacroItem> MacroItems
324
        {
325
            get
326
            {
327
                return _MacroItems;
328
            }
329

    
330
            set
331
            {
332
                _MacroItems = value;
333
            }
334
        }
335

    
336
        private int _MacroCommandIndex;
337

    
338
        public int MacroCommandIndex
339
        {
340
            get
341
            {
342
                return _MacroCommandIndex;
343
            }
344

    
345
            set
346
            {
347
                _MacroCommandIndex = value;
348
            }
349
        }
350

    
351
        private bool _IsMacroCommand;
352

    
353
        public bool IsMacroCommand
354
        {
355
            get
356
            {
357
                return _IsMacroCommand;
358
            }
359

    
360
            set
361
            {
362
                _IsMacroCommand = value;
363
            }
364
        }
365

    
366
        /// <summary>
367
        /// 현재 상단 메뉴의 선 굵기값
368
        /// </summary>
369
        private double _LineSize { get; set; }
370
        public double LineSize
371
        {
372
            get
373
            {
374
                return _LineSize;
375
            }
376
            set
377
            {
378
                _LineSize = value;
379
                OnPropertyChanged("LineSize");
380
            }
381
        }
382

    
383
        private double _Interval { get; set; }
384
        public double Interval
385
        {
386
            get
387
            {
388
                return _Interval;
389
            }
390
            set
391
            {
392
                _Interval = value;
393
                OnPropertyChanged("Interval");
394
            }
395
        }
396
        private double _SaveInterval { get; set; }
397
        public double SaveInterval
398
        {
399
            get
400
            {
401
                return _SaveInterval;
402
            }
403
            set
404
            {
405
                _SaveInterval = value;
406
                OnPropertyChanged("SaveInterval");
407
            }
408
        }
409
        private double _ArcLength { get; set; }
410
        public double ArcLength
411
        {
412
            get
413
            {
414
                return _ArcLength;
415
            }
416
            set
417
            {
418
                _ArcLength = value;
419
                OnPropertyChanged("ArcLength");
420
            }
421
        }
422

    
423
        public bool IsPressShift
424
        {
425
            get
426
            {
427
                return ((System.Windows.Input.Keyboard.Modifiers & System.Windows.Input.ModifierKeys.Shift) == System.Windows.Input.ModifierKeys.Shift);
428
            }
429
        }
430

    
431
        public bool IsPressCtrl
432
        {
433
            get
434
            {
435
                return ((System.Windows.Input.Keyboard.Modifiers & System.Windows.Input.ModifierKeys.Control) == System.Windows.Input.ModifierKeys.Control);
436
            }
437
        }
438

    
439
        /// <summary>
440
        /// Dash 사이즈 
441
        /// </summary>
442
        private DoubleCollection _DashSize { get; set; }
443
        public DoubleCollection DashSize
444
        {
445
            get
446
            {
447
                return _DashSize;
448
            }
449
            set
450
            {
451
                _DashSize = value;
452
                OnPropertyChanged("DashSize");
453
            }
454
        }
455

    
456
        private string _ControlTag { get; set; }
457
        public string ControlTag
458
        {
459
            get
460
            {
461
                return _ControlTag;
462
            }
463
            set
464
            {
465
                _ControlTag = value;
466
                OnPropertyChanged("ControlTag");
467
            }
468
        }
469

    
470
        private string _CheckStatus { get; set; }
471
        public string CheckStatus
472
        {
473
            get
474
            {
475
                return _CheckStatus;
476
            }
477
            set
478
            {
479
                _CheckStatus = value;
480
                OnPropertyChanged("CheckStatus");
481
            }
482
        }
483

    
484

    
485

    
486
        //private bool _IsPageChanged { get; set; }
487
        //public bool IsPageChanged
488
        //{
489
        //    get
490
        //    {
491
        //        return _IsPageChanged;
492
        //    }
493
        //    set
494
        //    {
495
        //        _IsPageChanged = value;
496
        //        OnPropertyChanged("IsPageChanged");
497
        //    }
498
        //}
499

    
500

    
501

    
502
        ///// <summary>
503
        ///// 강인구 추가(Check List관련)
504
        ///// </summary>
505
        //public List<Check_Inferface> Check_Item
506
        //{
507
        //    get
508
        //    {
509
        //        return check_Item;
510
        //    }
511
        //}
512

    
513
        private bool _IsConsolidate { get; set; }
514
        public bool IsConsolidate
515
        {
516
            get
517
            {
518
                return _IsConsolidate;
519
            }
520
            set
521
            {
522
                _IsConsolidate = value;
523
                OnPropertyChanged("IsConsolidate");
524
            }
525
        }
526

    
527
        private bool _IsFinalPDF { get; set; }
528
        public bool IsFinalPDF
529
        {
530
            get
531
            {
532
                return _IsFinalPDF;
533
            }
534
            set
535
            {
536
                _IsFinalPDF = value;
537
                OnPropertyChanged("IsFinalPDF");
538
            }
539
        }
540
        private DateTime _FinalPDFTime { get; set; }
541
        public DateTime FinalPDFTime
542
        {
543
            get
544
            {
545
                return _FinalPDFTime;
546
            }
547
            set
548
            {
549
                _FinalPDFTime = value;
550
                OnPropertyChanged("FinalPDFTime");
551
            }
552
        }
553

    
554
        ////////////////////////////////////////////////
555

    
556

    
557
        #region Angle 관련
558
        private Visibility _MarkupAngleVisibility { get; set; }
559
        public Visibility MarkupAngleVisibility
560
        {
561
            get
562
            {
563
                return _MarkupAngleVisibility;
564
            }
565
            set
566
            {
567
                _MarkupAngleVisibility = value;
568
                OnPropertyChanged("MarkupAngleVisibility");
569
            }
570

    
571
        }
572

    
573
        public double MarkupAngle
574
        {
575
            get
576
            {
577
                return markupAngle;
578
            }
579
            set
580
            {
581
                markupAngle = value;
582
                OnPropertyChanged("MarkupAngle");
583
            }
584
        }
585

    
586
        public double PageAngle
587
        {
588
            get
589
            {
590
                return pageAngle;
591
            }
592
            set
593
            {
594
                pageAngle = value;
595
                OnPropertyChanged("PageAngle");
596
            }
597
        }
598

    
599
        private string _HelperContent { get; set; }
600
        public string HelperContent
601
        {
602
            get
603
            {
604
                return _HelperContent;
605
            }
606
            set
607
            {
608
                _HelperContent = value;
609
                OnPropertyChanged("HelperContent");
610
            }
611
        }
612

    
613
        private string _HelperHeader { get; set; }
614
        public string HelperHeader
615
        {
616
            get
617
            {
618
                return _HelperHeader;
619
            }
620
            set
621
            {
622
                _HelperHeader = value;
623
                OnPropertyChanged("HelperHeader");
624
            }
625
        }
626

    
627
        private bool _HelperExit { get; set; }
628
        public bool HelperExit
629
        {
630
            get
631
            {
632
                return _HelperExit;
633
            }
634
            set
635
            {
636
                _HelperExit = value;
637
                OnPropertyChanged("HelperExit");
638
            }
639
        }
640

    
641
        #endregion
642

    
643
        public event EventHandler<EventArgs> PageLoaded;
644

    
645
        /// <summary>
646
        /// 페이지 변경 후 페이지에 해당하는 마크업을 모두 읽었을때 이벤트를 보내도록 한다.
647
        /// </summary>
648
        public void LoadPageMarkupFinish(Rect rect)
649
        {
650
            if(PageLoaded != null)
651
            {
652
                PageLoaded(this, new EventArgs());
653
            }
654
            else
655
            {
656
                this.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(rect);
657
            }
658
        }
659

    
660
        public bool SaveCheck()
661
        {
662
            bool result = false;
663

    
664
            if (ViewerDataModel.Instance.UndoDataList.Count > 0)
665
            {
666
                DateTime undoTime = UndoDataList.OrderByDescending(order => order.EventTime).FirstOrDefault().EventTime;
667
                DateTime updatetime = DateTime.Now.AddDays(-1);
668
                
669
                if (_markupInfoList.Count > 0)
670
                {
671
                    updatetime = _markupInfoList.OrderByDescending(order => order.UpdateTime).FirstOrDefault().UpdateTime;
672
                }
673

    
674
                if (undoTime > updatetime)
675
                {
676
                    result = false;
677
                }
678
                else
679
                {
680
                    result = true;
681
                }
682
            }
683
            else
684
            {
685
                result = true;
686
            }
687

    
688
            return result;
689
        }
690

    
691
        public bool FinalPDFCheck()
692
        {
693
            bool result = false;
694

    
695
            DateTime updatetime = DateTime.Now.AddDays(-1);
696

    
697
            if (_markupInfoList.Count > 0)
698
            {
699
               var consolidateItems = _markupInfoList.Where(x => x.Consolidate == 1 && x.AvoidConsolidate == 0);
700

    
701
                if (consolidateItems.Count() > 0)
702
                {
703
                    updatetime = consolidateItems.OrderByDescending(order => order.UpdateTime).FirstOrDefault().UpdateTime;
704
                }
705
            }
706

    
707
            if (FinalPDFTime > updatetime)
708
            {
709
                result = true;
710
            }
711

    
712
            return result;
713
        }
714

    
715
        public void SetAngleVisible(Visibility visibility)
716
        {
717
            this.MarkupAngleVisibility = visibility;
718
        }
719

    
720

    
721
        public ObservableCollection<CommentUserInfo> MarkupControls
722
        {
723
            get
724
            {
725
                return markupControls;
726
            }
727
        }
728

    
729
        public ObservableCollection<CommentUserInfo> MarkupControls_Sync
730
        {
731
            get
732
            {
733
                return markupControls_Sync;
734
            }
735
        }
736
        public int current_page_commentcnt = 0;
737
        public ObservableCollection<CommentUserInfo> MarkupControls_USER
738
        {
739
            get
740
            {
741
                return markupControls_User;
742
            }
743
        }
744

    
745
        public ObservableCollection<Undo_data> UndoDataList
746
        {
747
            get
748
            {
749
                return undoDataList;
750
            }
751
        }
752
        
753
        public StrokeCollection MarkupPens
754
        {
755
            get
756
            {
757
                return markupPens;
758
            }
759

    
760
        }
761

    
762
        #region 버튼 여부
763

    
764
        /// <summary>
765
        /// 상단 Fill 버튼이 클릭 되어있는지
766
        /// </summary>
767
        private bool _checkFillShape { get; set; }
768
        public bool checkFillShape
769
        {
770
            get
771
            {
772
                return _checkFillShape;
773
            }
774
            set
775
            {
776
                _checkFillShape = value;
777
                OnPropertyChanged("checkFillShape");
778
            }
779
        }
780

    
781
        /// <summary>
782
        /// 상단 Hatch 버튼이 클릭 되어있는지
783
        /// </summary>
784
        private bool _checkHatchShape { get; set; }
785
        public bool checkHatchShape
786
        {
787
            get
788
            {
789
                return _checkHatchShape;
790
            }
791
            set
792
            {
793
                _checkHatchShape = value;
794
                OnPropertyChanged("checkHatchShape");
795
            }
796
        }
797

    
798
        private double _controlOpacity { get; set; }
799
        public double ControlOpacity
800
        {
801
            get
802
            {
803
                return _controlOpacity;
804
            }
805
            set
806
            {
807

    
808
                _controlOpacity = value;
809
                OnPropertyChanged("ControlOpacity");
810
            }
811
        }
812

    
813
        private MarkupToPDF.Controls.Common.PaintSet _paintSet { get; set; }
814
        public MarkupToPDF.Controls.Common.PaintSet paintSet
815
        {
816
            get
817
            {
818
                return _paintSet;
819
            }
820
            set
821
            {
822
                _paintSet = value;
823
                OnPropertyChanged("paintSet");
824
            }
825
        }
826

    
827
        /// <summary>
828
        /// 강인구 추가
829
        /// 상단 TextStyle 버튼이 클릭 되어있는지
830
        /// </summary>
831
        private bool _checkTextStyle { get; set; }
832
        public bool checkTextStyle
833
        {
834
            get
835
            {
836
                return _checkTextStyle;
837
            }
838
            set
839
            {
840
                _checkTextStyle = value;
841
                OnPropertyChanged("checkTextStyle");
842
            }
843
        }
844

    
845
        /// <summary>
846
        /// 강인구 추가
847
        /// 상단 TextWeight 버튼이 클릭 되어있는지
848
        /// </summary>
849
        private bool _checkTextWeight { get; set; }
850
        public bool checkTextWeight
851
        {
852
            get
853
            {
854
                return _checkTextWeight;
855
            }
856
            set
857
            {
858
                _checkTextWeight = value;
859
                OnPropertyChanged("checkTextWeight");
860
            }
861
        }
862

    
863
        /// <summary>
864
        /// 강인구 추가
865
        /// 상단 UnderLine 버튼이 클릭 되어있는지
866
        /// </summary>
867
        private bool _checkUnderLine { get; set; }
868
        public bool checkUnderLine
869
        {
870
            get
871
            {
872
                return _checkUnderLine;
873
            }
874
            set
875
            {
876
                _checkUnderLine = value;
877
                OnPropertyChanged("checkUnderLine");
878
            }
879
        }
880

    
881
        /// <summary>
882
        /// 상단 Hatch 버튼이 클릭 되어있는지
883
        /// </summary>
884
        private bool _checkHighShape { get; set; }
885
        public bool checkHighShape
886
        {
887
            get
888
            {
889
                return _checkHighShape;
890
            }
891
            set
892
            {
893
                _checkHighShape = value;
894
                OnPropertyChanged("checkHighShape");
895
            }
896
        }
897

    
898
        /// <summary>
899
        /// 상단 Axis 버튼이 클릭 되어있는지
900
        /// </summary>
901
        private bool _IsAxisLock { get; set; }
902
        public bool IsAxisLock
903
        {
904
            get
905
            {
906
                return _IsAxisLock;
907
            }
908
            set
909
            {
910
                _IsAxisLock = value;
911
                OnPropertyChanged("IsAxisLock");
912
            }
913
        }
914

    
915
        /// <summary>
916
        /// 상단 Highlight 버튼이 클릭 되어있는지
917
        /// </summary>
918
        private bool _checkHighlight { get; set; }
919
        public bool checkHighlight
920
        {
921
            get
922
            {
923
                return _checkHighlight;
924
            }
925
            set
926
            {
927
                _checkHighlight = value;
928
                OnPropertyChanged("checkHighlight");
929
            }
930
        }
931

    
932
        /// <summary>
933
        /// 강인구 추가
934
        /// 상단 TextWeight 버튼이 클릭 되어있는지
935
        /// </summary>
936
        private double _TextSize { get; set; }
937
        public double TextSize
938
        {
939
            get
940
            {
941
                return _TextSize;
942
            }
943
            set
944
            {
945
                _TextSize = value;
946
                OnPropertyChanged("TextSize");
947
            }
948
        }
949
        #endregion
950

    
951
        public ImageBrush BackgroundImage
952
        {
953
            get
954
            {
955
                return backgroundImage;
956
            }
957
            set
958
            {
959
                backgroundImage = value;
960
                OnPropertyChanged("BackgroundImage");
961
            }
962
        }
963

    
964
        public ObservableCollection<KCOMDataModel.DataModel.DOCPAGE> Document_Info
965
        {
966
            get
967
            {
968
                return document_Info;
969
            }
970
        }
971

    
972
        public double ContentScale
973
        {
974
            get
975
            {
976
                return contentScale;
977
            }
978
            set
979
            {
980
                contentScale = value;
981

    
982
                double minOffsetX = 0.0;
983
                double maxOffsetX = Math.Max(0.0, ContentWidth - ContentViewportWidth);
984
                contentOffsetX = Math.Min(Math.Max(contentOffsetX, minOffsetX), maxOffsetX);
985

    
986
                double minOffsetY = 0.0;
987
                double maxOffsetY = Math.Max(0.0, ContentHeight - ContentViewportHeight);
988
                contentOffsetY = Math.Min(Math.Max(contentOffsetY, minOffsetY), maxOffsetY);
989

    
990
                OnPropertyChanged("ContentScale");
991
            }
992
        }
993

    
994
        public double Sync_ContentScale
995
        {
996
            get
997
            {
998
                return Sync_contentScale;
999
            }
1000
            set
1001
            {
1002
                Sync_contentScale = value;
1003
                OnPropertyChanged("Sync_ContentScale");
1004
            }
1005
        }
1006

    
1007
        public ObservableCollection<IKCOM.MarkupInfoItem> _markupInfoList
1008
        {
1009
            get
1010
            {
1011
                return markupInfoList;
1012
            }
1013
            set
1014
            {
1015
                markupInfoList = value;
1016
                OnPropertyChanged("_markupInfoList");
1017
            }
1018
        }
1019

    
1020
        public ObservableCollection<MarkupUserInfo> _markupUserList
1021
        {
1022
            get
1023
            {
1024
                return markupUserList;
1025
            }
1026
            set
1027
            {
1028
                markupUserList = value;
1029
                OnPropertyChanged("_markupUserList");
1030
            }
1031
        }
1032

    
1033
        public ObservableCollection<IKCOM.MarkupInfoItem> _markupInfoRevList
1034
        {
1035
            get
1036
            {
1037
                return markupInfoRevList;
1038
            }
1039
            set
1040
            {
1041
                markupInfoRevList = value;
1042
                OnPropertyChanged("_markupInfoRevList");
1043
            }
1044
        }
1045

    
1046
        public double ContentOffsetX
1047
        {
1048
            get
1049
            {
1050
                return contentOffsetX;
1051
            }
1052
            set
1053
            {
1054
                double minOffsetX = 0.0;
1055
                double maxOffsetX = Math.Max(0.0, ContentWidth - ContentViewportWidth);
1056
                contentOffsetX = Math.Min(Math.Max(value, minOffsetX), maxOffsetX);
1057
                OnPropertyChanged("ContentOffsetX");
1058
            }
1059
        }
1060

    
1061
        public double ContentOffsetY
1062
        {
1063
            get
1064
            {
1065
                return contentOffsetY;
1066
            }
1067
            set
1068
            {
1069
                double minOffsetY = 0.0;
1070
                double maxOffsetY = Math.Max(0.0, ContentHeight - ContentViewportHeight);
1071
                contentOffsetY = Math.Min(Math.Max(value, minOffsetY), maxOffsetY);
1072
                OnPropertyChanged("ContentOffsetY");
1073
            }
1074
        }
1075

    
1076
        public double Sync_ContentOffsetX
1077
        {
1078
            get
1079
            {
1080
                return Sync_contentOffsetX;
1081
            }
1082
            set
1083
            {
1084
                Sync_contentOffsetX = value;
1085
                OnPropertyChanged("Sync_ContentOffsetX");
1086
            }
1087
        }
1088

    
1089
        public double Sync_ContentOffsetY
1090
        {
1091
            get
1092
            {
1093
                return Sync_contentOffsetY;
1094
            }
1095
            set
1096
            {
1097
                Sync_contentOffsetY = value;
1098
                OnPropertyChanged("Sync_ContentOffsetY");
1099
            }
1100
        }
1101

    
1102
        public MessageCollection k_talkMessageSet
1103
        {
1104
            get
1105
            {
1106
                if (_k_talkMessageSet == null)
1107
                {
1108
                    _k_talkMessageSet = new MessageCollection();
1109
                }
1110
                return _k_talkMessageSet;
1111
            }
1112
            set
1113
            {
1114
                _k_talkMessageSet = value;
1115
                OnPropertyChanged("k_talkMessageSet");
1116
            }
1117
        }
1118

    
1119
        public double ContentWidth
1120
        {
1121
            get
1122
            {
1123
                return contentWidth;
1124
            }
1125
            set
1126
            {
1127
                contentWidth = value;
1128
                OnPropertyChanged("ContentWidth");
1129
            }
1130
        }
1131

    
1132
        public double ContentHeight
1133
        {
1134
            get
1135
            {
1136
                return contentHeight;
1137
            }
1138
            set
1139
            {
1140
                contentHeight = value;
1141
                OnPropertyChanged("ContentHeight");
1142
            }
1143
        }
1144

    
1145
        public double ContentViewportWidth
1146
        {
1147
            get
1148
            {
1149
                return contentViewportWidth;
1150
            }
1151
            set
1152
            {
1153
                contentViewportWidth = value;
1154
                OnPropertyChanged("ContentViewportWidth");
1155
            }
1156
        }
1157

    
1158
        public double ContentViewportHeight
1159
        {
1160
            get
1161
            {
1162
                return contentViewportHeight;
1163
            }
1164
            set
1165
            {
1166
                contentViewportHeight = value;
1167
                OnPropertyChanged("ContentViewportHeight");
1168
            }
1169
        }
1170

    
1171
        public MainWindow SystemMain { get; set; }
1172

    
1173
        private bool _PageBalanceMode { get; set; }
1174
        public bool PageBalanceMode
1175
        {
1176
            get
1177
            {
1178
                return _PageBalanceMode;
1179
            }
1180
            set
1181
            {
1182
                _PageBalanceMode = value;
1183
                OnPropertyChanged("PageBalanceMode");
1184
            }
1185
        }
1186

    
1187
        private int _PageBalanceNumber { get; set; }
1188
        public int PageBalanceNumber
1189
        {
1190
            get
1191
            {
1192
                return _PageBalanceNumber;
1193
            }
1194
            set
1195
            {
1196
                _PageBalanceNumber = value;
1197
                OnPropertyChanged("PageBalanceNumber");
1198
            }
1199
        }
1200

    
1201
        
1202
        private int _SyncPageNumber { get; set; }
1203

    
1204
        /// <summary>
1205
        /// Sync Page No
1206
        /// </summary>
1207
        public int SyncPageNumber
1208
        {
1209
            get
1210
            {
1211
                return _SyncPageNumber;
1212
            }
1213
            set
1214
            {
1215
                if (_SyncPageNumber != value)
1216
                {
1217
                    _SyncPageNumber = value;
1218
                    OnPropertyChanged("PageNumber");
1219
                }
1220
            }
1221
        }
1222

    
1223
        public double AngleOffsetX
1224
        {
1225
            get
1226
            {
1227
                return angleOffsetX;
1228
            }
1229
            set
1230
            {
1231
                angleOffsetX = value;
1232
                OnPropertyChanged("AngleOffsetX");
1233
            }
1234
        }
1235

    
1236
        public double AngleOffsetY
1237
        {
1238
            get
1239
            {
1240
                return angleOffsetY;
1241
            }
1242
            set
1243
            {
1244
                angleOffsetY = value;
1245
                OnPropertyChanged("AngleOffsetY");
1246
            }
1247
        }
1248

    
1249
        //강인구 추가(체크리스트)
1250
        private string _CheckList_ID { get; set; }
1251
        public string CheckList_ID
1252
        {
1253
            get
1254
            {
1255
                return _CheckList_ID;
1256
            }
1257
            set
1258
            {
1259
                _CheckList_ID = value;
1260
                OnPropertyChanged("CheckList_ID");
1261
            }
1262
        }
1263
        //강인구 추가(캡쳐 모드)
1264
        private double _Capture_Opacity { get; set; }
1265
        public double Capture_Opacity
1266
        {
1267
            get
1268
            {
1269
                return _Capture_Opacity;
1270
            }
1271
            set
1272
            {
1273
                _Capture_Opacity = value;
1274
                OnPropertyChanged("Capture_Opacity");
1275
            }
1276
        }
1277

    
1278
        private Visibility _ViewVisible { get; set; }
1279
        public Visibility ViewVisible
1280
        {
1281
            get
1282
            {
1283
                return _ViewVisible;
1284
            }
1285
            set
1286
            {
1287
                _ViewVisible = value;
1288
                OnPropertyChanged("ViewVisible");
1289
            }
1290
        }
1291

    
1292
        private bool _IsSync { get; set; }
1293
        public bool IsSync
1294
        {
1295
            get
1296
            {
1297
                return _IsSync;
1298
            }
1299
            set
1300
            {
1301
                _IsSync = value;
1302
                OnPropertyChanged("IsSync");
1303
            }
1304
        }
1305

    
1306
        private System.Windows.Media.Imaging.BitmapFrame _ImageViewPath;
1307
        public System.Windows.Media.Imaging.BitmapFrame ImageViewPath
1308
        {
1309
            get
1310
            {
1311
                return _ImageViewPath;
1312
            }
1313
            set
1314
            {
1315
                _ImageViewPath = value;
1316
                OnPropertyChanged("ImageViewPath");
1317
            }
1318
        }
1319
        private double _ImageViewWidth { get; set; }
1320
        public double ImageViewWidth
1321
        {
1322
            get
1323
            {
1324
                return _ImageViewWidth;
1325
            }
1326
            set
1327
            {
1328
                _ImageViewWidth = value;
1329
                OnPropertyChanged("ImageViewWidth");
1330
            }
1331
        }
1332
        private double _ImageViewHeight { get; set; }
1333
        public double ImageViewHeight
1334
        {
1335
            get
1336
            {
1337
                return _ImageViewHeight;
1338
            }
1339
            set
1340
            {
1341
                _ImageViewHeight = value;
1342
                OnPropertyChanged("ImageViewHeight");
1343
            }
1344
        }
1345

    
1346
        private System.Windows.Media.Imaging.BitmapImage _ImageViewPath_C;
1347
        public System.Windows.Media.Imaging.BitmapImage ImageViewPath_C
1348
        {
1349
            get
1350
            {
1351
                return _ImageViewPath_C;
1352
            }
1353
            set
1354
            {
1355
                _ImageViewPath_C = value;
1356
                OnPropertyChanged("ImageViewPath_C");
1357
            }
1358
        }
1359
        private double _ImageViewWidth_C { get; set; }
1360
        public double ImageViewWidth_C
1361
        {
1362
            get
1363
            {
1364
                return _ImageViewWidth_C;
1365
            }
1366
            set
1367
            {
1368
                _ImageViewWidth_C = value;
1369
                OnPropertyChanged("ImageViewWidth_C");
1370
            }
1371
        }
1372
        private double _ImageViewHeight_C { get; set; }
1373
        public double ImageViewHeight_C
1374
        {
1375
            get
1376
            {
1377
                return _ImageViewHeight_C;
1378
            }
1379
            set
1380
            {
1381
                _ImageViewHeight_C = value;
1382
                OnPropertyChanged("ImageViewHeight_C");
1383
            }
1384
        }
1385

    
1386

    
1387
        #endregion Property Member
1388

    
1389
        public System.IO.Stream GetStreamFromUrl(string url)
1390
        {
1391
            byte[] imageData = null;
1392

    
1393
            using (var wc = new System.Net.WebClient())
1394
                imageData = wc.DownloadData(url);
1395

    
1396
            return new System.IO.MemoryStream(imageData);
1397
        }
1398

    
1399
        public ViewerDataModel()
1400
        {
1401
            //rectangles.Add(new RectangleData(50, 50, 80, 150, Colors.Blue));
1402
            //rectangles.Add(new RectangleData(550, 350, 80, 150, Colors.Green));
1403
            //rectangles.Add(new RectangleData(850, 850, 30, 20, Colors.Purple));
1404
            //rectangles.Add(new RectangleData(1850, 1850, 80, 150, Colors.Red));
1405

    
1406
            //RectangleControl rect1 = new RectangleControl();
1407
            //rect1.StartPoint = new Point(50, 50);
1408
            //rect1.LeftBottomPoint = new Point(100, 50);
1409
            //rect1.TopRightPoint = new Point(50, 100);
1410
            //rect1.EndPoint = new Point(100, 100);
1411
            //rect1.FillColor = new SolidColorBrush(Colors.Red);
1412
            //rectangles.Add(rect1);
1413
            //
1414
            // Populate the data model with some example data.
1415
            //
1416
            //rectangles.Add(new RectangleData(50, 50, 80, 150, Colors.Blue));
1417
            //rectangles.Add(new RectangleData(550, 350, 80, 150, Colors.Green));
1418
            //rectangles.Add(new RectangleData(850, 850, 30, 20, Colors.Purple));
1419
            //rectangles.Add(new RectangleData(1850, 1850, 80, 150, Colors.Red));
1420

    
1421
            this.ControlOpacity = 1;
1422

    
1423
            /* Default
1424
             LineSize = 3, TextSize = 30, Interval = 10, ArcLength = 10, SaveInterval = 5
1425
            */            
1426
            this.LineSize = KCOM.Properties.Settings.Default.LineSize;
1427

    
1428
            this.TextSize = KCOM.Properties.Settings.Default.TextSize;
1429

    
1430
            this.Interval = KCOM.Properties.Settings.Default.Interval;
1431

    
1432
            this.ArcLength = KCOM.Properties.Settings.Default.ArcLength;
1433

    
1434
            this.DashSize = new DoubleCollection();
1435

    
1436
            this.SaveInterval = KCOM.Properties.Settings.Default.SaveInterval;
1437
            this.MarkupAngleVisibility = Visibility.Collapsed;
1438
        }
1439

    
1440

    
1441
        public List<IKCOM.MarkupInfoItem> SelectedmarkupInfoItems { get; set; }
1442
       
1443
        #region INotifyPropertyChanged Event
1444

    
1445
        private void OnPropertyChanged(string name)
1446
        {
1447
            if (PropertyChanged != null)
1448
            {
1449
                PropertyChanged(this, new PropertyChangedEventArgs(name));
1450
            }
1451
        }
1452

    
1453
        public event PropertyChangedEventHandler PropertyChanged;
1454

    
1455
        #endregion
1456
    }
1457
}
클립보드 이미지 추가 (최대 크기: 500 MB)