프로젝트

일반

사용자정보

개정판 02a9f323

ID02a9f323c8ce9de6e0deba026998068c36975c6c
상위 c7b02506
하위 19d602e0

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

Fix: UndoDataGroup 생성자 추가

Change-Id: If11a260fd4a847b735c721d7d2777447fd218dd8

차이점 보기:

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();

내보내기 Unified diff

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