프로젝트

일반

사용자정보

개정판 02a9f323

ID02a9f323c8ce9de6e0deba026998068c36975c6c
상위 c7b02506
하위 19d602e0

백흠경이(가) 5달 전에 추가함

Fix: UndoDataGroup 생성자 추가

Change-Id: If11a260fd4a847b735c721d7d2777447fd218dd8

차이점 보기:

KCOM/Controls/Symbol.xaml.cs
513 513
                    UndoDataGroup = new UndoDataGroup()
514 514
                    {
515 515
                        IsUndo = false,
516
                        Event = EventType.Create,
517
                        EventTime = DateTime.Now,
518
                        MarkupDataColl = new List<UndoData>()
516
                        Event = EventType.Create
519 517
                    };
520 518
                    ViewerDataModel.Instance.UndoDataList.Where(x => x.IsUndo).ToList().ForEach(i =>
521 519
                    {
......
640 638
                    UndoDataGroup = new UndoDataGroup()
641 639
                    {
642 640
                        IsUndo = false,
643
                        Event = EventType.Create,
644
                        EventTime = DateTime.Now,
645
                        MarkupDataColl = new List<UndoData>()
641
                        Event = EventType.Create
646 642
                    };
647 643
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo).ToList().ForEach(i =>
648 644
                    {
KCOM/Events/CreateCommand.cs
63 63
                ViewerDataModel.Instance.UndoDataList.Remove(i); 
64 64
                });
65 65

  
66
            MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
66
            MarkupToPDF.Common.UndoDataGroup UndoDataGroup = new UndoDataGroup()
67 67
            {
68 68
                IsUndo = false,
69
                Event = EventType.Create,
70
                EventTime = DateTime.Now,
71
                MarkupDataColl = new List<UndoData>()
69
                Event = EventType.Create
72 70
            };
73 71

  
74 72
            UndoData multi_UndoData = new UndoData()
75 73
            {
76 74
                Markup = control
77 75
            };
78
            UndoData.MarkupDataColl.Add(multi_UndoData);
76
            UndoDataGroup.MarkupDataColl.Add(multi_UndoData);
79 77

  
80
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
78
            ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup);
81 79

  
82 80
            ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
83 81
                MarkupParser.MarkupToString(multi_UndoData.Markup, App.ViewInfo.UserID), EventType.Create, null, null);
KCOM/Events/CutCommand.cs
66 66
                    string id = string.Empty;
67 67
                    if (item?.GetType().Name == "AdornerFinal")
68 68
                    {
69
                        MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
69
                        MarkupToPDF.Common.UndoDataGroup UndoDataGrp = new UndoDataGroup()
70 70
                        {
71 71
                            IsUndo = false,
72
                            Event = EventType.Delete,
73
                            EventTime = DateTime.Now,
74
                            MarkupDataColl = new List<UndoData>()
72
                            Event = EventType.Delete
75 73
                        };
76 74

  
77
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
75
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members)
78 76
                        {
79 77
                            var comment = (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
80 78

  
......
82 80
                            {
83 81
                                Markup = comment
84 82
                            };
85
                            UndoData.MarkupDataColl.Add(multi_UndoData);
83
                            UndoDataGrp.MarkupDataColl.Add(multi_UndoData);
86 84

  
87 85
                            var data = MarkupParser.MarkupToString(comment, App.ViewInfo.UserID);
88 86

  
......
99 97
                            ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
100 98
                            null, EventType.Delete, data.CommentID, null);
101 99
                        }
102
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
100

  
101
                        ViewerDataModel.Instance.UndoDataList.Add(UndoDataGrp);
103 102
                        //Clipboard.SetText(MarkupData,TextDataFormat.Text);
104 103
                        Dispatcher.CurrentDispatcher.Invoke(() =>
105 104
                        {
KCOM/Events/Implementation/TopMenuEvent.cs
113 113

  
114 114
            if (AdonerList.Count > 0)
115 115
            {
116
                UndoDataGroup UndoData = new UndoDataGroup()
116
                UndoDataGroup UndoDataGrp = new UndoDataGroup()
117 117
                {
118 118
                    IsUndo = false,
119 119
                    Event = EventType.Operation,
120
                    EventTime = DateTime.Now,
121
                    paint = ViewerDataModel.Instance.paintSet,
122
                    MarkupDataColl = new List<UndoData>()
120
                    paint = ViewerDataModel.Instance.paintSet
123 121
                };
124 122
                UndoData multi_UndoData = new UndoData();
125 123

  
......
133 131
                    }
134 132

  
135 133
                    multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
136
                    UndoData.MarkupDataColl.Add(multi_UndoData);
134
                    UndoDataGrp.MarkupDataColl.Add(multi_UndoData);
137 135
                    multi_UndoData = new UndoData();
138 136
                }
139 137

  
......
141 139
                {
142 140
                    ViewerDataModel.Instance.UndoDataList.Remove(i);                    
143 141
                });
144
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
142
                ViewerDataModel.Instance.UndoDataList.Add(UndoDataGrp);
145 143
            }
146 144
        }
147 145

  
......
650 648
            List<AdornerMember> AdonerList = GetAdornerItem();
651 649
            if(AdonerList.Count > 0)
652 650
            {
653
                UndoDataGroup UndoData = new UndoDataGroup()
651
                UndoDataGroup UndoDataGrp = new UndoDataGroup()
654 652
                {
655 653
                    IsUndo = false,
656 654
                    Event = EventType.Operation,
657
                    EventTime = DateTime.Now,
658
                    Opacity = ViewerDataModel.Instance.ControlOpacity,
659
                    MarkupDataColl = new List<UndoData>()
655
                    Opacity = ViewerDataModel.Instance.ControlOpacity
660 656
                };
661
                UndoData multi_UndoData = new UndoData();
662 657

  
663 658
                foreach (AdornerMember InnerItem in AdonerList)
664 659
                {
665 660
                    InnerItem.DrawingData.Opacity = ViewerDataModel.Instance.ControlOpacity;
666
                  
667
                    multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
668
                    UndoData.MarkupDataColl.Add(multi_UndoData);
669
                    multi_UndoData = new UndoData();
661

  
662
                    UndoData UndoData = new UndoData();
663
                    UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
664
                    UndoDataGrp.MarkupDataColl.Add(UndoData);
670 665
                }
671 666

  
672 667
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
673 668
                {
674 669
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
675 670
                });
676
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
671
                ViewerDataModel.Instance.UndoDataList.Add(UndoDataGrp);
677 672
            }
678 673
        }
679 674

  
......
687 682
            List<AdornerMember> AdonerList = GetAdornerItem();
688 683
            if (AdonerList.Count > 0)
689 684
            {
690
                UndoDataGroup UndoData = new UndoDataGroup()
685
                UndoDataGroup UndoDataGrp = new UndoDataGroup()
691 686
                {
692 687
                    IsUndo = false,
693 688
                    Event = EventType.Operation,
694
                    EventTime = DateTime.Now,
695
                    LineSize = ViewerDataModel.Instance.LineSize,
696
                    MarkupDataColl = new List<UndoData>()
689
                    LineSize = ViewerDataModel.Instance.LineSize
697 690
                };
698 691
                UndoData multi_UndoData = new UndoData();
699 692

  
......
783 776
                            }
784 777
                            break;
785 778
                    }
786
                    
787 779

  
788 780
                    multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
789
                    UndoData.MarkupDataColl.Add(multi_UndoData);
781
                    UndoDataGrp.MarkupDataColl.Add(multi_UndoData);
790 782
                    multi_UndoData = new UndoData();
791 783
                }
792 784

  
......
794 786
                {
795 787
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
796 788
                });
797
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
798

  
799
                
789
                ViewerDataModel.Instance.UndoDataList.Add(UndoDataGrp);
800 790
            }
801 791
            KCOM.Properties.Settings.Default.LineSize = (double)cbLineSize.Value;
802 792
            Properties.Settings.Default.Save();
......
813 803
            if (AdonerList.Count > 0)
814 804
            {
815 805

  
816
                UndoDataGroup UndoData = new UndoDataGroup()
806
                UndoDataGroup UndoDataGrp = new UndoDataGroup()
817 807
                {
818 808
                    IsUndo = false,
819 809
                    Event = EventType.Operation,
820
                    EventTime = DateTime.Now,
821
                    Interval = ViewerDataModel.Instance.Interval,
822
                    MarkupDataColl = new List<UndoData>()
810
                    Interval = ViewerDataModel.Instance.Interval
823 811
                };
824 812
                UndoData multi_UndoData = new UndoData();
825 813

  
......
832 820
                                (InnerItem.DrawingData as MarkupToPDF.Controls.Line.LineControl).Interval = ViewerDataModel.Instance.Interval;
833 821

  
834 822
                                multi_UndoData.Markup = InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo;
835
                                UndoData.MarkupDataColl.Add(multi_UndoData);
823
                                UndoDataGrp.MarkupDataColl.Add(multi_UndoData);
836 824
                                multi_UndoData = new UndoData();
837 825
                            }
838 826
                            break;
......
843 831
                {
844 832
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
845 833
                });
846
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
834
                ViewerDataModel.Instance.UndoDataList.Add(UndoDataGrp);
847 835
            }
848 836
            KCOM.Properties.Settings.Default.Interval = (double)cbIntervalSize.Value;
849 837
            Properties.Settings.Default.Save();
......
2396 2384
                    #endregion
2397 2385
                    #region Cut
2398 2386
                    case "Cut":
2399
                        //Cut_Start();
2400 2387
                        CutCommand.Instance.Execute();
2401 2388
                        instanceToggle.IsChecked = false;
2402 2389
                        ViewerDataModel.Instance.SelectedControl = "";
......
2994 2981
                }
2995 2982
            }
2996 2983
        }
2997

  
2998
        public void Cut_Start()
2999
        {
3000
            if (this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Count > 0)
3001
            {
3002
                foreach (var item in this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children)
3003
                {
3004
                    string MarkupData = "";
3005

  
3006
                    if (item.GetType().Name == "AdornerFinal")
3007
                    {
3008
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
3009
                        {
3010
                            if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData))
3011
                            {
3012
                                MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn res = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
3013
                                MarkupData += "|OR|" + res.ConvertData;
3014
                            }
3015
                        }
3016
                        //클립보드에 넣음
3017
                        Clipboard.SetDataObject(MarkupData);
3018
                    }
3019
                }
3020
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Clear();
3021
            }
3022
        }
3023

  
3024
        public async void Paste_Start()
3025
        {
3026
            //마크업 붙여넣기
3027

  
3028
            var markupData = Clipboard.GetData(DataFormats.StringFormat);
3029

  
3030
            if (markupData.GetType() == typeof(string) && markupData.ToString().Contains("|OR||DZ|"))
3031
            {
3032
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
3033

  
3034
                string[] delimiterChars = { "|OR|" };
3035
                string[] data = markupData.ToString().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
3036

  
3037
                SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
3038

  
3039
                UndoData multi_UndoData = new UndoData();
3040

  
3041
                //강인구 Undo/Redo 보류
3042
                MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
3043
                {
3044
                    IsUndo = false,
3045
                    Event = EventType.Create,
3046
                    EventTime = DateTime.Now,
3047
                    MarkupDataColl = new List<UndoData>()
3048
                };
3049

  
3050
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
3051
                {
3052
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
3053
                });
3054

  
3055
                foreach (string parse in data)
3056
                {
3057
                    if (parse != "")
3058
                    {
3059
                        System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress,ViewerDataModel.Instance.NewMarkupCancelToken(),App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, string.Empty, string.Empty,
3060
                            STAMP_Contents: App.SystemInfo.STAMP_CONTENTS);
3061
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.ShortGuid();
3062

  
3063
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
3064
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
3065

  
3066
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
3067

  
3068
                        multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
3069

  
3070
                        UndoData.MarkupDataColl.Add(multi_UndoData);
3071
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);                        
3072
                    }
3073
                }
3074
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
3075

  
3076
                if(this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X < 0)
3077
                {
3078
                    Canvas.SetLeft(final, 0);
3079
                    Canvas.SetTop(final, 0);
3080
                }
3081
                else
3082
                {
3083
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3084
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3085
                    final.TranslateItems(realPointX, realPointY);
3086

  
3087
                    if (final.Members.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
3088
                    {
3089
                        final.TranslateItems(0.001, 0.001); //dummy
3090
                    }
3091
                }
3092

  
3093
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3094
            }
3095
            //외부 이미지 붙여넣기
3096
            else if (Clipboard.GetImage() != null)
3097
            {
3098
                try
3099
                {
3100
                    UndoData multi_UndoData = new UndoData();
3101

  
3102
                    //강인구 Undo/Redo 보류
3103
                    MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
3104
                    {
3105
                        IsUndo = false,
3106
                        Event = EventType.Create,
3107
                        EventTime = DateTime.Now,
3108
                        MarkupDataColl = new List<UndoData>()
3109
                    };
3110

  
3111

  
3112
                    string temppath = System.IO.Path.GetTempPath();
3113
                    //string filename = KCOM.Events.Save.shortCommentKey();
3114
                    string filename = Commons.ShortFileKey();
3115

  
3116
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
3117
                    clipboardImage.Save(temppath + "\\" + filename);
3118

  
3119
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
3120
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
3121
                    long numByte = fileInfo.Length;
3122
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
3123
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
3124

  
3125
                    if (dLen < 4)
3126
                    {
3127
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
3128
                        System.IO.FileMode.Open, System.IO.FileAccess.Read,FileShare.Read);
3129
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
3130
                        byte[] data = br.ReadBytes((int)numByte);
3131

  
3132
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
3133
                        Check_Uri.UriCheck(filename);
3134
                        br.Close();
3135
                        fStream.Close();
3136
                        fStream.Dispose();
3137
                    }
3138
                    else
3139
                    {
3140
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
3141
                        return;
3142
                    }
3143

  
3144
                    fileInfo.Delete();
3145

  
3146
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
3147
                    IntPtr hBitmap = bmp.GetHbitmap();
3148
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
3149
                    Image img = new Image();
3150
                    if (filename.Contains(".svg"))
3151
                    {
3152
                        SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(filename);
3153
                        img.Source = (DrawingImage)svgImage.ProvideValue(null);
3154
                    }
3155
                    else
3156
                    {
3157
                        img.Source = new BitmapImage(new Uri(filename));
3158
                    }
3159

  
3160
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
3161
                    {
3162
                        PointSet = new List<Point>(),
3163
                        FilePath = filename,
3164
                        ImageData = img.Source,
3165
                        StartPoint = new Point(100, 100),
3166
                        EndPoint = new Point(200, 200),
3167
                        TopRightPoint = new Point(100, 200),
3168
                        LeftBottomPoint = new Point(200, 100)
3169
                    };
3170

  
3171
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
3172
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
3173
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
3174

  
3175
                    currentControl.PointSet = new List<Point>
3176
                                        {
3177
                                            currentControl.StartPoint,
3178
                                            currentControl.LeftBottomPoint,
3179
                                            currentControl.EndPoint,
3180
                                            currentControl.TopRightPoint,
3181
                                        };
3182

  
3183
                    multi_UndoData = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
3184
                    UndoData.MarkupDataColl.Add(multi_UndoData);
3185
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
3186

  
3187
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
3188
                    currentControl.CommentID = Commons.ShortGuid();
3189

  
3190
                    currentControl.ApplyTemplate();
3191
                    currentControl.SetImage();
3192

  
3193
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
3194
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
3195
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
3196

  
3197
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
3198
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
3199
                    final.TranslateItems(realPointX, realPointY);
3200
                }
3201
                catch(Exception ex)
3202
                {
3203
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
3204
                }
3205
            }
3206
        }
3207 2984
    }
3208 2985
}
KCOM/Events/PasteCommand.cs
64 64
                string[] delimiterChars2 = { "|OR|", "|SymbolID|" };
65 65
                string[] data = markupData.ToString().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
66 66

  
67
                if (data.Count() > 0)
67
                if (data.Any())
68 68
                {
69 69
                    List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
70 70

  
71
                    UndoData multi_UndoData = new UndoData();
72

  
73 71
                    //강인구 Undo/Redo 보류
74
                    MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
72
                    MarkupToPDF.Common.UndoDataGroup UndoDataGrp = new UndoDataGroup()
75 73
                    {
76 74
                        IsUndo = false,
77
                        Event = EventType.Create,
78
                        EventTime = DateTime.Now,
79
                        MarkupDataColl = new List<UndoData>()
75
                        Event = EventType.Create
80 76
                    };
81 77

  
82 78
                    foreach (string parse in data)
......
102 98

  
103 99
                            //CreateCommand.Instance.Execute(control);
104 100
                            adornerSet.Add(control);
105
                            multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(control);
106
                            UndoData.MarkupDataColl.Add(multi_UndoData);
107
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
101
                            var multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(control);
102
                            UndoDataGrp.MarkupDataColl.Add(multi_UndoData);
103
                            ViewerDataModel.Instance.UndoDataList.Add(UndoDataGrp);
108 104

  
109 105
                            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.UpdateMyMarkupList();
110 106
                            //ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
......
128 124
            {
129 125
                try
130 126
                {
131
                    UndoData multi_UndoData = new UndoData();
132

  
133
                    MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
127
                    MarkupToPDF.Common.UndoDataGroup UndoDataGrp = new UndoDataGroup()
134 128
                    {
135 129
                        IsUndo = false,
136
                        Event = EventType.Create,
137
                        EventTime = DateTime.Now,
138
                        MarkupDataColl = new List<UndoData>()
130
                        Event = EventType.Create
139 131
                    };
140 132

  
141 133
                    string temppath = System.IO.Path.GetTempPath();
......
210 202
                        currentControl.TopRightPoint,
211 203
                    };
212 204

  
213
                    multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
214
                    UndoData.MarkupDataColl.Add(multi_UndoData);
215
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
216

  
217
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
218
                    currentControl.CommentID = Commons.ShortGuid();
219

  
220
                    currentControl.ApplyTemplate();
221
                    currentControl.SetImage();
222

  
223
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
224
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
225
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
226

  
227
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
228
                        MarkupParser.MarkupToString(multi_UndoData.Markup, App.ViewInfo.UserID), EventType.Create, null, null);
229
                }
230
                catch (Exception ex)
231
                {
232
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert");
233
                }
234
            }
235
        }
236
        /// <summary>
237
        /// paste controls
238
        /// </summary>
239
        /// <author>humkyung</author>
240
        /// <date>2019.06.18</date>
241
        /// <param name="comments"></param>
242
        public async void Execute2()
243
        {
244
            if (Clipboard.GetText().Contains("|OR||DZ|"))
245
            {
246
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
247

  
248
                SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
249

  
250
                UndoData multi_UndoData = new UndoData();
251

  
252
                //강인구 Undo/Redo 보류
253
                MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
254
                {
255
                    IsUndo = false,
256
                    Event = EventType.Create,
257
                    EventTime = DateTime.Now,
258
                    MarkupDataColl = new List<UndoData>()
259
                };
260

  
261
                ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
262
                {
263
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
264
                });
265

  
266
                string[] delimiterChars = { "|OR|" };
267
                string[] delimiterChars2 = { "|OR|", "|SymbolID|" };
268
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
269
                foreach (string parse in data)
270
                {
271
                    if (parse != "")
272
                    {
273
                        string[] data2 = new string[2];
274
                        data2 = parse.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
275

  
276
                        System.Windows.Controls.Control item = await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, data2[0], ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, "#FFFF0000", string.Empty,
277
                            STAMP_Contents: App.SystemInfo.STAMP_CONTENTS);
278
                        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.ShortGuid();
279
                        if (data2.Length >= 2)
280
                        {
281
                            (item as MarkupToPDF.Common.CommentUserInfo).SymbolID = data2[1];
282
                        }
283

  
284
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
285
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
286

  
287
                        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
288

  
289
                        multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo);
290

  
291
                        UndoData.MarkupDataColl.Add(multi_UndoData);
292
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
293

  
294
                        ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
295
                        MarkupParser.MarkupToString(multi_UndoData.Markup, App.ViewInfo.UserID), EventType.Create, null, null);
296

  
297
                        (item as MarkupToPDF.Common.CommentUserInfo).ApplyOverViewData();
298
                    }
299
                }
300
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
301

  
302
                /// place controls at current mouse position
303
                var diff = Point.Subtract(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint, final.Centeroid);
304
                final.TranslateItems(diff.X, diff.Y);
305

  
306
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
307
               
308
            }
309
            /// 외부 이미지 붙여넣기
310
            else if (Clipboard.GetImage() != null)
311
            {
312
                try
313
                {
314
                    UndoData multi_UndoData = new UndoData();
315

  
316
                    MarkupToPDF.Common.UndoDataGroup UndoData = new UndoDataGroup()
317
                    {
318
                        IsUndo = false,
319
                        Event = EventType.Create,
320
                        EventTime = DateTime.Now,
321
                        MarkupDataColl = new List<UndoData>()
322
                    };
323

  
324
                    string temppath = System.IO.Path.GetTempPath();
325
                    string filename = Commons.ShortFileKey();
326

  
327
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
328
                    clipboardImage.Save(Path.Combine(temppath , filename));
329

  
330
                    /// upload image file to server
331
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(Path.Combine(temppath , filename));
332
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
333
                    long numByte = fileInfo.Length;
334
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
335
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
336
                    if (dLen < 4)
337
                    {
338
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
339
                        System.IO.FileMode.Open, System.IO.FileAccess.Read,FileShare.Read);
340
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
341
                        byte[] data = br.ReadBytes((int)numByte);
342

  
343
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
344
                        Check_Uri.UriCheck(filename);
345

  
346
                        br.Close();
347
                        fStream.Close();
348
                        fStream.Dispose();
349
                    }
350
                    else
351
                    {
352
                        Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
353
                        return;
354
                    }
355

  
356
                    fileInfo.Delete();
357

  
358
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
359
                    IntPtr hBitmap = bmp.GetHbitmap();
360
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
361
                    System.Windows.Controls.Image img = new System.Windows.Controls.Image();
362
                    if (filename.Contains(".svg"))
363
                    {
364
                        SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(filename);
365
                        img.Source = (DrawingImage)svgImage.ProvideValue(null);
366
                    }
367
                    else
368
                    {
369
                        img.Source = new BitmapImage(new Uri(filename));
370
                    }
371

  
372

  
373
                    var vecSize = new Vector(clipboardImage.Width, clipboardImage.Height);
374
                    var EndPoint = Point.Add(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint, vecSize);
375
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
376
                    {
377
                        PointSet = new List<Point>(),
378
                        FilePath = filename,
379
                        ImageData = img.Source,
380
                        StartPoint = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint,
381
                        EndPoint = Point.Add(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint, vecSize),
382
                        TopRightPoint = new Point(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint.X + vecSize.X,
383
                                                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint.Y),
384
                        LeftBottomPoint = new Point(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint.X, 
385
                                                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint.Y + vecSize.Y)
386
                    };
387

  
388
                    currentControl.PointSet = new List<Point>
389
                    {
390
                        currentControl.StartPoint,
391
                        currentControl.LeftBottomPoint,
392
                        currentControl.EndPoint,
393
                        currentControl.TopRightPoint,
394
                    };
395

  
396
                    multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
397
                    UndoData.MarkupDataColl.Add(multi_UndoData);
398
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
205
                    var multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
206
                    UndoDataGrp.MarkupDataColl.Add(multi_UndoData);
207
                    ViewerDataModel.Instance.UndoDataList.Add(UndoDataGrp);
399 208

  
400 209
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
401 210
                    currentControl.CommentID = Commons.ShortGuid();
KCOM/Events/UndoCommand.cs
49 49
        /// <param name="comments"></param>
50 50
        public void Push(EventType _EventType, ICollection<CommentUserInfo> comments)
51 51
        {
52
            UndoDataGroup UndoData = new UndoDataGroup()
52
            UndoDataGroup UndoDataGrp = new UndoDataGroup()
53 53
            {
54 54
                IsUndo = false,
55
                Event = _EventType,
56
                EventTime = DateTime.Now,
57
                MarkupDataColl = new List<UndoData>(),
55
                Event = _EventType
58 56
            };
59 57

  
60 58
            foreach (var comment in comments)
......
64 62
                    Markup = comment
65 63
                };
66 64
                _UndoData.Clone = comment.Clone();
67
                UndoData.MarkupDataColl.Add(_UndoData);
65
                UndoDataGrp.MarkupDataColl.Add(_UndoData);
68 66

  
69 67
                if (_EventType == EventType.Delete)
70 68
                {
......
88 86
            {
89 87
                ViewerDataModel.Instance.UndoDataList.Remove(i);
90 88
            });
91
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
89
            ViewerDataModel.Instance.UndoDataList.Add(UndoDataGrp);
92 90
        }
93 91

  
94 92
        /// <summary>
KCOM/Views/MainMenu.xaml.cs
2696 2696
                    UndoDataGroup = new UndoDataGroup()
2697 2697
                    {
2698 2698
                        IsUndo = false,
2699
                        Event = EventType.Create,
2700
                        EventTime = DateTime.Now,
2701
                        MarkupDataColl = new List<UndoData>()
2699
                        Event = EventType.Create
2702 2700
                    };
2703 2701
                    ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i =>
2704 2702
                    {
MarkupToPDF/Common/Undo_data.cs
22 22

  
23 23
    public class UndoDataGroup
24 24
    {
25
        public UndoDataGroup() 
26
        {
27
            EventTime = DateTime.Now;
28
        }
29

  
25 30
        public EventType Event { get; set; }
26
        public List<UndoData> MarkupDataColl { get; set; } = new List<UndoData>();
31
        public List<UndoData> MarkupDataColl { get; } = new List<UndoData>();
27 32
        public bool IsUndo { get; set; }
28 33
        public DateTime EventTime { get; set; }
29 34
        public double LineSize { get; set; }

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)