프로젝트

일반

사용자정보

개정판 26ec6226

ID26ec622634d943099ae2979885dd60b77206f890
상위 32fb9425
하위 dbddfdd0

김태성이(가) 일년 이상 전에 추가함

issue #00000 copy&Paste 수정

Change-Id: I05c6141221f180d7f53d8f19929ed32d56977085

차이점 보기:

IIpc/WcfServer.cs
12 12
{
13 13
    public sealed class WcfServer : IIpcServer
14 14
    {
15
        [ServiceBehavior(IncludeExceptionDetailInFaults = true,InstanceContextMode = InstanceContextMode.Single)]
15
        [ServiceBehavior(IncludeExceptionDetailInFaults = false,InstanceContextMode = InstanceContextMode.Single)]
16 16
        private class _Server : IIpcClient
17 17
        {
18 18
            private readonly WcfServer server;
......
134 134
            this.host.Open();
135 135
        }
136 136

  
137
        public bool IsDispose
138
        {
139
            get { return (this.host == null ? true : false); }
140
        }
141

  
142
        public bool IsOpen
143
        {
144
            get { return (this.host?.State == CommunicationState.Opened ? true : false); }
145
        }
146

  
137 147
        public void Stop()
138 148
        {
139
            this.host.Close();
149
            try
150
            {
151
                System.Diagnostics.Debug.WriteLine($"IIpc.WcfServer {this.host.BaseAddresses?.First()} Stop");
152
                this.host.Close(new TimeSpan(1));
153

  
154
                System.Diagnostics.Debug.WriteLine($"IIpc.WcfServer {this.host.BaseAddresses?.First()} Stoped");
155

  
156
            }
157
            catch (Exception ex)
158
            {
159
                System.Diagnostics.Debug.WriteLine(ex.ToString());
160
            }
140 161
        }
141 162

  
142 163
        void IDisposable.Dispose()
......
144 165
            this.Stop();
145 166

  
146 167
            (this.host as IDisposable).Dispose();
168

  
169
            System.Diagnostics.Debug.WriteLine($"IIpc.WcfServer {this.host.BaseAddresses?.First()} Dispose");
147 170
        }
148 171
    }
149 172
}
KCOM/Common/SelectionSet.cs
146 146
                                        }
147 147
                                    }
148 148

  
149
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(InnerItem.DrawingData as CommentUserInfo);
149
                                    var control = InnerItem.DrawingData as CommentUserInfo;
150
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(control);
151
                                   
152
                                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
153
                                    {
154
                                        IsUndo = false,
155
                                        Event = Event_Type.Create,
156
                                        EventTime = DateTime.Now,
157
                                        Markup_List = new List<Multi_Undo_data>()
158
                                    };
159

  
160
                                    var multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(control);
161
                                    UndoData.Markup_List.Add(multi_Undo_Data);
162
                                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
163
                                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.UpdateMyMarkupList();
150 164
                                }
151 165
                            }
152 166
                        }
KCOM/Controls/AdornerFinal.xaml.cs
1232 1232
            var comments = (from drawing in this.Members
1233 1233
                            select drawing.DrawingData as CommentUserInfo).ToList();
1234 1234
            UndoCommand.Instance.Push(comments, this.AngleValue);
1235
            ViewerDataModel.Instance.IsMarkupUpdate = true;
1235 1236
        }
1236 1237

  
1237 1238
        /// <summary>
KCOM/Events/CopyCommand.cs
71 71
                            id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : "";
72 72
                            MarkupData += "|OR|" + data.ConvertData + id;
73 73
                        }
74

  
75
                        Clipboard.SetDataObject(MarkupData);
74
                 
75
                        Clipboard.SetText(MarkupData,TextDataFormat.Text);
76 76
                    }
77 77
                }
78 78
            }
KCOM/Events/CutCommand.cs
63 63
                foreach (var item in Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children)
64 64
                {
65 65
                    string id = string.Empty;
66
                    if (item.GetType().Name == "AdornerFinal")
66
                    if (item?.GetType().Name == "AdornerFinal")
67 67
                    {
68
                        MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
69
                        {
70
                            IsUndo = false,
71
                            Event = Event_Type.Delete,
72
                            EventTime = DateTime.Now,
73
                            Markup_List = new List<Multi_Undo_data>()
74
                        };
75

  
68 76
                        foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>())
69 77
                        {
70
                            var data = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID);
78
                            var comment = (InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo);
79

  
80
                            Multi_Undo_data multi_Undo_Data = new Multi_Undo_data()
81
                            {
82
                                Markup = comment
83
                            };
84
                            UndoData.Markup_List.Add(multi_Undo_Data);
85

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

  
71 88
                            id = (InnerItem.Symbol_ID != null) ? "|SymbolID|" + InnerItem.Symbol_ID : "";
72 89
                            MarkupData += "|OR|" + data.ConvertData + id;
73 90

  
91
                            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.UpdateMyMarkupList();
92
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(comment);
93
                            ViewerDataModel.Instance.MarkupControls.Remove(comment);
94

  
95
                            var Item_ = ViewerDataModel.Instance.MyMarkupList.Where(d => d.ID == comment.CommentID).FirstOrDefault();
96
                            ViewerDataModel.Instance.MyMarkupList.Remove(Item_);
97

  
74 98
                            ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
75 99
                            null, Event_Type.Delete, data.CommentID, null);
76 100
                        }
77

  
78
                        Clipboard.SetDataObject(MarkupData);
101
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
102
                        Clipboard.SetText(MarkupData,TextDataFormat.Text);
79 103
                    }
80 104
                }
81 105

  
KCOM/Events/PasteCommand.cs
48 48
                return _instance;
49 49
            }
50 50
        }
51

  
52 51
        /// <summary>
53 52
        /// paste controls
54 53
        /// </summary>
......
59 58
        {
60 59
            if (Clipboard.GetText().Contains("|OR||DZ|"))
61 60
            {
61
                string[] delimiterChars = { "|OR|" };
62
                string[] delimiterChars2 = { "|OR|", "|SymbolID|" };
63
                string[] data = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
64

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

  
69
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
70

  
71
                    //강인구 Undo/Redo 보류
72
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
73
                    {
74
                        IsUndo = false,
75
                        Event = Event_Type.Create,
76
                        EventTime = DateTime.Now,
77
                        Markup_List = new List<Multi_Undo_data>()
78
                    };
79

  
80
                    foreach (string parse in data)
81
                    {
82
                        if (parse != "")
83
                        {
84
                            string[] data2 = new string[2];
85
                            data2 = parse.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
86

  
87
                            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);
88

  
89
                            var control = (item as MarkupToPDF.Common.CommentUserInfo);
90

  
91
                            control.CommentID = Commons.shortGuid();
92
                            control.MarkupInfoID = App.Custom_ViewInfoId;
93
                            control.IsNew = true;
94

  
95
                            if (data2.Length >= 2)
96
                            {
97
                                control.SymbolID = data2[1];
98
                            }
99

  
100
                            //CreateCommand.Instance.Execute(control);
101
                            adornerSet.Add(control);
102
                            multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(control);
103
                            UndoData.Markup_List.Add(multi_Undo_Data);
104
                            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
105

  
106
                            Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.UpdateMyMarkupList();
107
                            //ViewerDataModel.Instance.MarkupControls_USER.Remove(control);
108

  
109
                            ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
110
                                MarkupParser.MarkupToString(multi_Undo_Data.Markup, App.ViewInfo.UserID), Event_Type.Create, null, null);
111
                        }
112
                    }
113

  
114
                    Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
115

  
116
                    /// place controls at current mouse position
117
                    var diff = Point.Subtract(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint, final.Centeroid);
118
                    final.TranslateItems(diff.X, diff.Y);
119

  
120
                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
121
                }
122
            }
123
            /// 외부 이미지 붙여넣기
124
            else if (Clipboard.GetImage() != null)
125
            {
126
                try
127
                {
128
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
129

  
130
                    MarkupToPDF.Common.Undo_data UndoData = new Undo_data()
131
                    {
132
                        IsUndo = false,
133
                        Event = Event_Type.Create,
134
                        EventTime = DateTime.Now,
135
                        Markup_List = new List<Multi_Undo_data>()
136
                    };
137

  
138
                    string temppath = System.IO.Path.GetTempPath();
139
                    string filename = Commons.shortFileKey();
140

  
141
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
142
                    clipboardImage.Save(Path.Combine(temppath, filename));
143

  
144
                    /// upload image file to server
145
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(Path.Combine(temppath, filename));
146
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
147
                    long numByte = fileInfo.Length;
148
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
149
                    kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader;
150
                    if (dLen < 4)
151
                    {
152
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
153
                        System.IO.FileMode.Open, System.IO.FileAccess.Read, FileShare.Read);
154
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
155
                        byte[] data = br.ReadBytes((int)numByte);
156

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

  
160
                        br.Close();
161
                        fStream.Close();
162
                        fStream.Dispose();
163
                    }
164
                    else
165
                    {
166
                        Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
167
                        return;
168
                    }
169

  
170
                    fileInfo.Delete();
171

  
172
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
173
                    IntPtr hBitmap = bmp.GetHbitmap();
174
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
175
                    System.Windows.Controls.Image img = new System.Windows.Controls.Image();
176
                    if (filename.Contains(".svg"))
177
                    {
178
                        SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(filename);
179
                        img.Source = (DrawingImage)svgImage.ProvideValue(null);
180
                    }
181
                    else
182
                    {
183
                        img.Source = new BitmapImage(new Uri(filename));
184
                    }
185

  
186

  
187
                    var vecSize = new Vector(clipboardImage.Width, clipboardImage.Height);
188
                    var EndPoint = Point.Add(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint, vecSize);
189
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
190
                    {
191
                        PointSet = new List<Point>(),
192
                        FilePath = filename,
193
                        ImageData = img.Source,
194
                        StartPoint = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint,
195
                        EndPoint = Point.Add(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint, vecSize),
196
                        TopRightPoint = new Point(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint.X + vecSize.X,
197
                                                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint.Y),
198
                        LeftBottomPoint = new Point(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint.X,
199
                                                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.getCurrentPoint.Y + vecSize.Y)
200
                    };
201

  
202
                    currentControl.PointSet = new List<Point>
203
                    {
204
                        currentControl.StartPoint,
205
                        currentControl.LeftBottomPoint,
206
                        currentControl.EndPoint,
207
                        currentControl.TopRightPoint,
208
                    };
209

  
210
                    multi_Undo_Data = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
211
                    UndoData.Markup_List.Add(multi_Undo_Data);
212
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
213

  
214
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
215
                    currentControl.CommentID = Commons.shortGuid();
216

  
217
                    currentControl.ApplyTemplate();
218
                    currentControl.SetImage();
219

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

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

  
64 245
                SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
......
95 276
                        {
96 277
                            (item as MarkupToPDF.Common.CommentUserInfo).SymbolID = data2[1];
97 278
                        }
279

  
98 280
                        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
99 281
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
100 282

  
......
107 289

  
108 290
                        ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate(
109 291
                        MarkupParser.MarkupToString(multi_Undo_Data.Markup, App.ViewInfo.UserID), Event_Type.Create, null, null);
292

  
293
                        (item as MarkupToPDF.Common.CommentUserInfo).ApplyOverViewData();
110 294
                    }
111 295
                }
112 296
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
KCOM/Events/SaveCommand.cs
80 80

  
81 81
            try
82 82
            {
83

  
84
                SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
83 85
                var mainmenu = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu;
84 86
                //var client = mainmenu.BaseClient;
85 87

  
KCOM/Services/BaseServices.cs
286 286
                    Document_NO = _DocItem?.DOCUMENT_NO,
287 287
                    File_Result = _DocItem?.RESULT_FILE,
288 288
                    Group_No = _DocItem?.GROUP_NO,
289
                    ProjectNo = _DocItem?.PROJECT_NO,   
289
                    ProjectNo = _DocItem?.PROJECT_NO,
290 290
                    Revision = _DocItem?.REVISION,
291 291
                };
292 292

  
KCOM/Views/MainMenu.xaml.cs
557 557
        {
558 558
            try
559 559
            {
560
                Dispatcher.BeginInvoke((Action)delegate () { ViewerDataModel.Instance.DownloadFileProgress = (int)e.Progress; });
560
                Dispatcher.BeginInvoke((Action)delegate ()
561
                {
562
                    if ((sender as IIpc.WcfServer).IsOpen)
563
                    {
564
                        ViewerDataModel.Instance.DownloadFileProgress = (int)e.Progress;
565
                    }
566

  
567
                });
561 568

  
562
                if (e.IsFinish)
569
                if ((sender as IIpc.WcfServer).IsOpen)
563 570
                {
564
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.searchPanel_Instance.SetSerachPDFFile(instnaceFile);
565
                    ViewerDataModel.Instance.IsDownloadOriginal = true;
566
                    (sender as IIpc.WcfServer).IpcFileDownloadReceived -= WcfServer_IpcFileDownloadReceived;
567
                    (sender as IIpc.WcfServer).Stop();
571
                    if (e.IsFinish)
572
                    {
573
                        ViewerDataModel.Instance.SystemMain.dzMainMenu.searchPanel_Instance.SetSerachPDFFile(instnaceFile);
574
                        ViewerDataModel.Instance.IsDownloadOriginal = true;
575
                        (sender as IIpc.WcfServer).Stop();
576
                        (sender as IIpc.WcfServer).IpcFileDownloadReceived -= WcfServer_IpcFileDownloadReceived;
577
                    }
568 578
                }
569 579
            }
570 580
            catch (Exception ex)
......
683 693
            System.Diagnostics.Debug.WriteLine("pageNavigator PageChanging");
684 694
            //    await PageLoadAsync(e.CurrentPage,e.PageNumber);
685 695
            //}
686

  
687 696
            //private async Task PageLoadAsync(DOCPAGE page, int PageNo)
688 697
            //{
689 698
            DOCPAGE page = e.CurrentPage;
......
6181 6190
    {
6182 6191
        public string Title { get; set; }
6183 6192
    }
6193

  
6194

  
6184 6195
}

내보내기 Unified diff

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