프로젝트

일반

사용자정보

개정판 c73426a9

IDc73426a9cfe121831292ed3f8739ca17860d790e
상위 f286e80b
하위 e1fb3d16, 37262028

이지연이(가) 5년 이상 전에 추가함

issue #926 이미지생성오류(imagecontrol, 외부이미지붙여넣기, symbol)

Change-Id: I5376bab4a5bff122eee8e0f38aa49b0e64d18c0b

차이점 보기:

KCOM/Common/Converter/SvgConverter.cs
9 9
{
10 10
    class SvgConverter
11 11
    {
12
        //public DOCUMENT_ITEM _DocItem;
13

  
14 12
        public void SvgConvert(string fileurl, string guid, string DOCUMENT_NO)
15 13
        {
16
            var defaultBitmapImage = new BitmapImage();
17
            defaultBitmapImage.BeginInit();
18
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
19
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
20
            defaultBitmapImage.UriSource = new Uri(fileurl);
21
            defaultBitmapImage.EndInit();
14
            try
15
            {
16
                var defaultBitmapImage = new BitmapImage();
17
                defaultBitmapImage.BeginInit();
18
                defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
19
                defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
20
                defaultBitmapImage.UriSource = new Uri(fileurl);
21
                defaultBitmapImage.EndInit();
22 22

  
23
            GC.Collect();
24
            System.Drawing.Bitmap image;
23
                GC.Collect();
24
                System.Drawing.Bitmap image;
25 25

  
26
            if (defaultBitmapImage.IsDownloading)
27
            {
28
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
26
                if (defaultBitmapImage.IsDownloading)
29 27
                {
30
                    defaultBitmapImage.Freeze();
31
                    GC.Collect();
28
                    defaultBitmapImage.DownloadCompleted += (ex, arg) =>
29
                    {
30
                        defaultBitmapImage.Freeze();
31
                        GC.Collect();
32 32

  
33
                    image = GetBitmap(defaultBitmapImage);
33
                        image = GetBitmap(defaultBitmapImage);
34 34

  
35
                    image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
35
                        image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
36 36

  
37
                    Process potrace = new Process
38
                    {
39
                        StartInfo = new ProcessStartInfo
37
                        Process potrace = new Process
40 38
                        {
41
                            //FileName = @"http://cloud.devdoftech.co.kr:5977/UserData/"+ "potrace.exe",
42
                            FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
43
                            //Arguments = "-s -u 1", //SVG
44
                            //Arguments = "- -o- --svg",
45
                            //Arguments = filename2 + "  --backend svg",
46
                            //Arguments = @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp" + "  --backend svg -i",
47
                            //Arguments = "-b svg -i " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
48
                            Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
49
                            RedirectStandardInput = true,
50
                            RedirectStandardOutput = true,
51
                            //RedirectStandardError = Program.IsDebug,
52
                            RedirectStandardError = true,
53
                            UseShellExecute = false,
54
                            CreateNoWindow = true,
55
                            WindowStyle = ProcessWindowStyle.Hidden
56
                        },
57
                        EnableRaisingEvents = false
58
                    };
39
                            StartInfo = new ProcessStartInfo
40
                            {
41
                                //FileName = @"http://cloud.devdoftech.co.kr:5977/UserData/"+ "potrace.exe",
42
                                FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
43
                                //Arguments = "-s -u 1", //SVG
44
                                //Arguments = "- -o- --svg",
45
                                //Arguments = filename2 + "  --backend svg",
46
                                //Arguments = @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp" + "  --backend svg -i",
47
                                //Arguments = "-b svg -i " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
48
                                Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
49
                                RedirectStandardInput = true,
50
                                RedirectStandardOutput = true,
51
                                //RedirectStandardError = Program.IsDebug,
52
                                RedirectStandardError = true,
53
                                UseShellExecute = false,
54
                                CreateNoWindow = true,
55
                                WindowStyle = ProcessWindowStyle.Hidden
56
                            },
57
                            EnableRaisingEvents = false
58
                        };
59 59

  
60
                    StringBuilder svgBuilder = new StringBuilder();
61
                    potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) => {
62
                        svgBuilder.AppendLine(e2.Data);
63
                    };
60
                        StringBuilder svgBuilder = new StringBuilder();
61
                        potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
62
                        {
63
                            svgBuilder.AppendLine(e2.Data);
64
                        };
65

  
66
                        potrace.Start();
64 67

  
65
                    potrace.Start();
66 68

  
69
                        byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp");
70
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
71
                        fileurl = fileUploader.Run(App.ViewInfo.ProjectNO, DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
67 72

  
68
                    byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp");
69
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
70
                    fileurl = fileUploader.Run(App.ViewInfo.ProjectNO, DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
71
                };
73
                        Check_Uri.UriCheck(fileurl);
74
                    };
75
                }
76
            }
77
            catch (Exception ex)
78
            {
79
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert");
72 80
            }
73 81
        }
74 82

  
KCOM/Controls/Symbol.xaml.cs
254 254
        #region Symbol Add Close Event 
255 255
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
256 256
        {
257
            if (args.PromptResult != null)
257
            try
258 258
            {
259
                if (args.DialogResult.Value)
259
                if (args.PromptResult != null)
260 260
                {
261
                    PngBitmapEncoder _Encoder = symImage(data);
261
                    if (args.DialogResult.Value)
262
                    {
263
                        PngBitmapEncoder _Encoder = symImage(data);
262 264

  
263
                    System.IO.MemoryStream fs = new System.IO.MemoryStream();
264
                    _Encoder.Save(fs);
265
                    System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
265
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
266
                        _Encoder.Save(fs);
267
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
266 268

  
267
                    byte[] Img_byte = fs.ToArray();
269
                        byte[] Img_byte = fs.ToArray();
268 270

  
269
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
270
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Save.shortGuid() + ".png", Img_byte);
271
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
272
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Save.shortGuid() + ".png", Img_byte);
273
                        Check_Uri.UriCheck(filename);
274
                        if (RadTab.SelectedIndex == 0)
275
                        {
276
                            SymbolSave(args.PromptResult, filename, data);
277
                        }
278
                        else
279
                        {
280
                            SymbolSave_Public(args.PromptResult, filename, data, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
281
                        }
271 282

  
272
                    if (RadTab.SelectedIndex == 0)
273
                    {
274
                        SymbolSave(args.PromptResult, filename, data);
283
                        DataBind();
275 284
                    }
276
                    else
277
                    {
278
                        SymbolSave_Public(args.PromptResult, filename, data, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
279
                    }
280

  
281
                    DataBind();
282 285
                }
283 286
            }
287
            catch(Exception ex)
288
            {
289
                Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert");
290
            }
284 291
        }
285 292
        #endregion
286 293

  
KCOM/Events/Event_KeyEvent.cs
330 330
                            //외부 이미지 붙여넣기
331 331
                            else if (Clipboard.GetImage() != null)
332 332
                            {
333
                                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
334

  
335
                                //강인구 Undo/Redo 보류
336
                                UndoData = new Undo_data()
333
                                try
337 334
                                {
338
                                    IsUndo = false,
339
                                    Event = Event_Type.Create,
340
                                    EventTime = DateTime.Now,
341
                                    Markup_List = new List<Multi_Undo_data>()
342
                                };
335
                                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
343 336

  
344
                                string temppath = System.IO.Path.GetTempPath();
345
                                //string filename = KCOM.Events.Save.shortCommentKey();
346
                                string filename = KCOM.Events.Save.shortFileKey();
347

  
348
                                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
349
                                clipboardImage.Save(temppath + "\\" + filename);
350

  
351
                                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
352
                                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
353
                                long numByte = fileInfo.Length;
354
                                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
355
                                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
337
                                    //강인구 Undo/Redo 보류
338
                                    UndoData = new Undo_data()
339
                                    {
340
                                        IsUndo = false,
341
                                        Event = Event_Type.Create,
342
                                        EventTime = DateTime.Now,
343
                                        Markup_List = new List<Multi_Undo_data>()
344
                                    };
345

  
346
                                    string temppath = System.IO.Path.GetTempPath();
347
                                    //string filename = KCOM.Events.Save.shortCommentKey();
348
                                    string filename = KCOM.Events.Save.shortFileKey();
349

  
350
                                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
351
                                    clipboardImage.Save(temppath + "\\" + filename);
352

  
353
                                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
354
                                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
355
                                    long numByte = fileInfo.Length;
356
                                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
357
                                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
358

  
359
                                    if (dLen < 4)
360
                                    {
361
                                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
362
                                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
363
                                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
364
                                        byte[] data = br.ReadBytes((int)numByte);
356 365

  
357
                                if (dLen < 4)
358
                                {
359
                                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
360
                                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
361
                                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
362
                                    byte[] data = br.ReadBytes((int)numByte);
363

  
364
                                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
365
                                    br.Close();
366
                                    fStream.Close();
367
                                    fStream.Dispose();
368
                                }
369
                                else
370
                                {
371
                                    dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
372
                                    return;
373
                                }
366
                                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
374 367

  
375
                                fileInfo.Delete();
368
                                        Check_Uri.UriCheck(filename);
376 369

  
377
                                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
378
                                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
379
                                IntPtr hBitmap = bmp.GetHbitmap();
380
                                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
381
                                Image img = new Image();
382
                                //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));                            
383
                                if (filename.Contains(".svg"))
384
                                {
385
                                    byte[] imageData = null;
386
                                    DrawingImage image = null;
387
                                    using (System.Net.WebClient web = new System.Net.WebClient())
370
                                        br.Close();
371
                                        fStream.Close();
372
                                        fStream.Dispose();
373
                                    }
374
                                    else
388 375
                                    {
389
                                        imageData = web.DownloadData(new Uri(filename));
390
                                        System.IO.Stream stream = new System.IO.MemoryStream(imageData);
391
                                        image = SvgReader.Load(stream);
376
                                        dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
377
                                        return;
392 378
                                    }
393
                                    img.Source = image;
394
                                }
395
                                else
396
                                {
397
                                    img.Source = new BitmapImage(new Uri(filename));
398
                                }
399
                                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
400
                                {
401
                                    PointSet = new List<Point>(),
402
                                    //FilePath = img.Source.ToString(),
403
                                    FilePath = filename,
404
                                    ImageData = img.Source,
405
                                    StartPoint = new Point(100, 100),
406
                                    EndPoint = new Point(200, 200),
407
                                    TopRightPoint = new Point(100, 200),
408
                                    LeftBottomPoint = new Point(200, 100)
409
                                };
410 379

  
411
                                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
412
                                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
413
                                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
380
                                    fileInfo.Delete();
414 381

  
415
                                currentControl.PointSet = new List<Point>
382
                                    //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
383
                                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
384
                                    IntPtr hBitmap = bmp.GetHbitmap();
385
                                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
386
                                    Image img = new Image();
387
                                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));                            
388
                                    if (filename.Contains(".svg"))
389
                                    {
390
                                        byte[] imageData = null;
391
                                        DrawingImage image = null;
392
                                        using (System.Net.WebClient web = new System.Net.WebClient())
393
                                        {
394
                                            imageData = web.DownloadData(new Uri(filename));
395
                                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
396
                                            image = SvgReader.Load(stream);
397
                                        }
398
                                        img.Source = image;
399
                                    }
400
                                    else
401
                                    {
402
                                        img.Source = new BitmapImage(new Uri(filename));
403
                                    }
404
                                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
405
                                    {
406
                                        PointSet = new List<Point>(),
407
                                        //FilePath = img.Source.ToString(),
408
                                        FilePath = filename,
409
                                        ImageData = img.Source,
410
                                        StartPoint = new Point(100, 100),
411
                                        EndPoint = new Point(200, 200),
412
                                        TopRightPoint = new Point(100, 200),
413
                                        LeftBottomPoint = new Point(200, 100)
414
                                    };
415

  
416
                                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
417
                                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
418
                                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
419

  
420
                                    currentControl.PointSet = new List<Point>
416 421
                                        {
417 422
                                            currentControl.StartPoint,
418 423
                                            currentControl.LeftBottomPoint,
......
420 425
                                            currentControl.TopRightPoint,
421 426
                                        };
422 427

  
423
                                multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
424
                                UndoData.Markup_List.Add(multi_Undo_Data);
425
                                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
428
                                    multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
429
                                    UndoData.Markup_List.Add(multi_Undo_Data);
430
                                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
426 431

  
427
                                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
428
                                currentControl.CommentID = Events.Save.shortGuid();
432
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
433
                                    currentControl.CommentID = Events.Save.shortGuid();
429 434

  
430
                                currentControl.ApplyTemplate();
431
                                currentControl.SetImage();
435
                                    currentControl.ApplyTemplate();
436
                                    currentControl.SetImage();
432 437

  
433
                                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
434
                                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
435
                                this.dzMainMenu.SelectLayer.Children.Add(final);
438
                                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
439
                                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
440
                                    this.dzMainMenu.SelectLayer.Children.Add(final);
436 441

  
437
                                double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
438
                                double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
439
                                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
440
                                                                
441
                                #region 주석
442
                                    double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
443
                                    double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
444
                                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
445

  
446
                                    #region 주석
442 447

  
443
                                //주석
444
                                //ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
445
                                //Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
446
                                //this.dzMainMenu.SelectLayer.Children.Add(final);
448
                                    //주석
449
                                    //ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
450
                                    //Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
451
                                    //this.dzMainMenu.SelectLayer.Children.Add(final);
447 452

  
448
                                //string MarkupData = "";
453
                                    //string MarkupData = "";
449 454

  
450
                                //if (!ViewerDataModel.Instance.MarkupControls.Contains(currentControl))
451
                                //{
452
                                //    markupReturn = layer.MarkupToString(currentControl, App.ViewInfo.UserID);
453
                                //    MarkupData += "|OR|" + markupReturn.ConvertData;
454
                                //}
455
                                //Clipboard.SetText(MarkupData);
456
                                //this.dzMainMenu.SelectLayer.Children.Clear();
455
                                    //if (!ViewerDataModel.Instance.MarkupControls.Contains(currentControl))
456
                                    //{
457
                                    //    markupReturn = layer.MarkupToString(currentControl, App.ViewInfo.UserID);
458
                                    //    MarkupData += "|OR|" + markupReturn.ConvertData;
459
                                    //}
460
                                    //Clipboard.SetText(MarkupData);
461
                                    //this.dzMainMenu.SelectLayer.Children.Clear();
457 462

  
458
                                //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
463
                                    //List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
459 464

  
460
                                //string[] delimiterChars = { "|OR|" };
461
                                //string[] data1 = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
465
                                    //string[] delimiterChars = { "|OR|" };
466
                                    //string[] data1 = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
462 467

  
463
                                //this.dzMainMenu.ReleaseAdorner();
468
                                    //this.dzMainMenu.ReleaseAdorner();
464 469

  
465
                                //foreach (string parse in data1)
466
                                //{
467
                                //    if (parse != "")
468
                                //    {
469
                                //        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
470
                                //        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
470
                                    //foreach (string parse in data1)
471
                                    //{
472
                                    //    if (parse != "")
473
                                    //    {
474
                                    //        System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
475
                                    //        (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
471 476

  
472
                                //        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
473
                                //        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
477
                                    //        ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
478
                                    //        ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
474 479

  
475
                                //        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
480
                                    //        adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
476 481

  
477
                                //        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
478
                                //        //this.dzMainMenu.SelectLayer.Children.Add(final);
479
                                //    }
480
                                //}
481
                                //Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
482
                                    //        //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
483
                                    //        //this.dzMainMenu.SelectLayer.Children.Add(final);
484
                                    //    }
485
                                    //}
486
                                    //Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
482 487

  
483
                                //double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
484
                                //double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
485
                                //final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
488
                                    //double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
489
                                    //double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
490
                                    //final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
486 491

  
487
                                //if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
488
                                //{
489
                                //    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
490
                                //}
492
                                    //if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
493
                                    //{
494
                                    //    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
495
                                    //}
491 496

  
492
                                //this.dzMainMenu.SelectLayer.Children.Add(final); 
493
                                #endregion
497
                                    //this.dzMainMenu.SelectLayer.Children.Add(final); 
498
                                    #endregion
494 499

  
500
                                }
501
                                catch(Exception ex)
502
                                {
503
                                    Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert");
504
                                }
495 505
                            }
496
                        }
497
                        
506
                        }                        
498 507
                    }
499 508
                    break;
500 509
                #endregion
KCOM/Events/Implementation/TopMenuEvent.cs
1749 1749
                        br.Close();
1750 1750

  
1751 1751
                        string filepath = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data);
1752
                        Uri uri;
1753
                        if (!(Uri.TryCreate(filepath, UriKind.Absolute, out uri) && uri.Scheme == Uri.UriSchemeHttp))
1754
                        {
1755
                            throw new Exception();
1756
                        }
1752

  
1753
                        Check_Uri.UriCheck(filepath);
1754

  
1757 1755
                        instanceMain.dzMainMenu.filename = filepath;
1758 1756

  
1759 1757
                        fStream.Close();
......
2869 2867
            //외부 이미지 붙여넣기
2870 2868
            else if (Clipboard.GetImage() != null)
2871 2869
            {
2872
                Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2873

  
2874
                //강인구 Undo/Redo 보류
2875
                UndoData = new Undo_data()
2870
                try
2876 2871
                {
2877
                    IsUndo = false,
2878
                    Event = Event_Type.Create,
2879
                    EventTime = DateTime.Now,
2880
                    Markup_List = new List<Multi_Undo_data>()
2881
                };
2872
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
2882 2873

  
2874
                    //강인구 Undo/Redo 보류
2875
                    UndoData = new Undo_data()
2876
                    {
2877
                        IsUndo = false,
2878
                        Event = Event_Type.Create,
2879
                        EventTime = DateTime.Now,
2880
                        Markup_List = new List<Multi_Undo_data>()
2881
                    };
2883 2882

  
2884
                string temppath = System.IO.Path.GetTempPath();
2885
                //string filename = KCOM.Events.Save.shortCommentKey();
2886
                string filename = KCOM.Events.Save.shortFileKey();
2887 2883

  
2888
                System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2889
                clipboardImage.Save(temppath + "\\" + filename);
2884
                    string temppath = System.IO.Path.GetTempPath();
2885
                    //string filename = KCOM.Events.Save.shortCommentKey();
2886
                    string filename = KCOM.Events.Save.shortFileKey();
2890 2887

  
2891
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2892
                String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2893
                long numByte = fileInfo.Length;
2894
                double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2895
                kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2888
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2889
                    clipboardImage.Save(temppath + "\\" + filename);
2896 2890

  
2897
                if (dLen < 4)
2898
                {
2899
                    System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2900
                    System.IO.FileMode.Open, System.IO.FileAccess.Read);
2901
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2902
                    byte[] data = br.ReadBytes((int)numByte);
2891
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
2892
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
2893
                    long numByte = fileInfo.Length;
2894
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
2895
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
2903 2896

  
2904
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2905
                    br.Close();
2906
                    fStream.Close();
2907
                    fStream.Dispose();
2908
                }
2909
                else
2910
                {
2911
                    this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2912
                    return;
2913
                }
2897
                    if (dLen < 4)
2898
                    {
2899
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
2900
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
2901
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
2902
                        byte[] data = br.ReadBytes((int)numByte);
2914 2903

  
2915
                fileInfo.Delete();
2904
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
2905
                        Check_Uri.UriCheck(filename);
2906
                        br.Close();
2907
                        fStream.Close();
2908
                        fStream.Dispose();
2909
                    }
2910
                    else
2911
                    {
2912
                        this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
2913
                        return;
2914
                    }
2916 2915

  
2917
                //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2918
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2919
                IntPtr hBitmap = bmp.GetHbitmap();
2920
                System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2921
                Image img = new Image();
2922
                //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2923
                if (filename.Contains(".svg"))
2924
                {
2925
                    byte[] imageData = null;
2926
                    DrawingImage image = null;
2927
                    using (System.Net.WebClient web = new System.Net.WebClient())
2916
                    fileInfo.Delete();
2917

  
2918
                    //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
2919
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
2920
                    IntPtr hBitmap = bmp.GetHbitmap();
2921
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
2922
                    Image img = new Image();
2923
                    //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
2924
                    if (filename.Contains(".svg"))
2928 2925
                    {
2929
                        imageData = web.DownloadData(new Uri(filename));
2930
                        System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2931
                        image = SvgReader.Load(stream);
2926
                        byte[] imageData = null;
2927
                        DrawingImage image = null;
2928
                        using (System.Net.WebClient web = new System.Net.WebClient())
2929
                        {
2930
                            imageData = web.DownloadData(new Uri(filename));
2931
                            System.IO.Stream stream = new System.IO.MemoryStream(imageData);
2932
                            image = SvgReader.Load(stream);
2933
                        }
2934
                        img.Source = image;
2935
                    }
2936
                    else
2937
                    {
2938
                        img.Source = new BitmapImage(new Uri(filename));
2932 2939
                    }
2933
                    img.Source = image;
2934
                }
2935
                else
2936
                {
2937
                    img.Source = new BitmapImage(new Uri(filename));
2938
                }
2939 2940

  
2940
                var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2941
                {
2942
                    PointSet = new List<Point>(),
2943
                    //FilePath = img.Source.ToString(),
2944
                    FilePath = filename,
2945
                    ImageData = img.Source,
2946
                    StartPoint = new Point(100, 100),
2947
                    EndPoint = new Point(200, 200),
2948
                    TopRightPoint = new Point(100, 200),
2949
                    LeftBottomPoint = new Point(200, 100)
2950
                };
2941
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
2942
                    {
2943
                        PointSet = new List<Point>(),
2944
                        //FilePath = img.Source.ToString(),
2945
                        FilePath = filename,
2946
                        ImageData = img.Source,
2947
                        StartPoint = new Point(100, 100),
2948
                        EndPoint = new Point(200, 200),
2949
                        TopRightPoint = new Point(100, 200),
2950
                        LeftBottomPoint = new Point(200, 100)
2951
                    };
2951 2952

  
2952
                currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2953
                currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2954
                currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2953
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
2954
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
2955
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
2955 2956

  
2956
                currentControl.PointSet = new List<Point>
2957
                    currentControl.PointSet = new List<Point>
2957 2958
                                        {
2958 2959
                                            currentControl.StartPoint,
2959 2960
                                            currentControl.LeftBottomPoint,
......
2961 2962
                                            currentControl.TopRightPoint,
2962 2963
                                        };
2963 2964

  
2964
                multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2965
                UndoData.Markup_List.Add(multi_Undo_Data);
2966
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2967

  
2968
                ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2969
                currentControl.CommentID = Events.Save.shortGuid();
2965
                    multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
2966
                    UndoData.Markup_List.Add(multi_Undo_Data);
2967
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2970 2968

  
2971
                currentControl.ApplyTemplate();
2972
                currentControl.SetImage();
2969
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
2970
                    currentControl.CommentID = Events.Save.shortGuid();
2973 2971

  
2974
                ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2975
                Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2976
                this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2972
                    currentControl.ApplyTemplate();
2973
                    currentControl.SetImage();
2977 2974

  
2978
                double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2979
                double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2980
                final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2975
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
2976
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
2977
                    this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
2981 2978

  
2979
                    double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
2980
                    double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
2981
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
2982
                }
2983
                catch(Exception ex)
2984
                {
2985
                    this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert");
2986
                }
2982 2987
            }
2983 2988
        }
2984 2989

  
KCOM/Events/Save.cs
104 104
                    ml_markupdata.Add(new MARKUP_DATA
105 105
                    {
106 106
                        ID = value.ID,
107
                        DATA = value.Data,
107
                        DATA = value.Data, 
108 108
                        DATA_TYPE = value.Data_Type,
109 109
                        PAGENUMBER = value.PageNumber,
110 110
                        MARKUPINFO_VERSION_ID = UserState.MarkupVersionID,
KCOM/KCOM.csproj
248 248
    <Compile Include="AbstractDatabase.cs" />
249 249
    <Compile Include="AppSQLiteDatabase.cs" />
250 250
    <Compile Include="Common\Check_Inferface.cs" />
251
    <Compile Include="Common\Check_Uri.cs" />
251 252
    <Compile Include="Common\Converter\CmpUrlChange.cs" />
252 253
    <Compile Include="Common\Converter\CommentTypeImgConverter.cs" />
253 254
    <Compile Include="Common\Converter\enumStringColorConverter.cs" />
......
323 324
      <DependentUpon>ConversationView.xaml</DependentUpon>
324 325
    </Compile>
325 326
    <Compile Include="Messenger\MessageBase.cs" />
327
    <Compile Include="UriCheck.cs" />
326 328
    <Compile Include="Web References\Get_FinalImage\Reference.cs">
327 329
      <AutoGen>True</AutoGen>
328 330
      <DesignTime>True</DesignTime>
KCOM/MainWindow.xaml.cs
583 583
                }
584 584
                else if (Clipboard.GetImage() != null) //외부 이미지 붙여넣기
585 585
                {
586
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
587

  
588
                    //Undo/Redo 보류
589
                    UndoData = new Undo_data()
586
                    try
590 587
                    {
591
                        IsUndo = false,
592
                        Event = Event_Type.Create,
593
                        EventTime = DateTime.Now,
594
                        Markup_List = new List<Multi_Undo_data>()
595
                    };
588
                        Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
596 589

  
597
                    string temppath = System.IO.Path.GetTempPath();
598
                    //string filename = KCOM.Events.Save.shortCommentKey();
599
                    string filename = KCOM.Events.Save.shortFileKey();
600

  
601
                    System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
602
                    clipboardImage.Save(temppath + "\\" + filename);
603

  
604
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
605
                    String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
606
                    long numByte = fileInfo.Length;
607
                    double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
608
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
609

  
610
                    if (dLen < 4)
611
                    {
612
                        System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
613
                        System.IO.FileMode.Open, System.IO.FileAccess.Read);
614
                        System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
615
                        byte[] data = br.ReadBytes((int)numByte);
616

  
617
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
618
                        br.Close();
619
                        fStream.Close();
620
                        fStream.Dispose();
621
                    }
622
                    else
623
                    {
624
                        dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
625
                        return;
626
                    }
590
                        //Undo/Redo 보류
591
                        UndoData = new Undo_data()
592
                        {
593
                            IsUndo = false,
594
                            Event = Event_Type.Create,
595
                            EventTime = DateTime.Now,
596
                            Markup_List = new List<Multi_Undo_data>()
597
                        };
598

  
599
                        string temppath = System.IO.Path.GetTempPath();
600
                        //string filename = KCOM.Events.Save.shortCommentKey();
601
                        string filename = KCOM.Events.Save.shortFileKey();
602

  
603
                        System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
604
                        clipboardImage.Save(temppath + "\\" + filename);
605

  
606
                        System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename);
607
                        String strFile = System.IO.Path.GetFileName(fileInfo.FullName);
608
                        long numByte = fileInfo.Length;
609
                        double dLen = Convert.ToDouble(fileInfo.Length / 1000000);
610
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
611

  
612
                        if (dLen < 4)
613
                        {
614
                            System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName,
615
                            System.IO.FileMode.Open, System.IO.FileAccess.Read);
616
                            System.IO.BinaryReader br = new System.IO.BinaryReader(fStream);
617
                            byte[] data = br.ReadBytes((int)numByte);
627 618

  
628
                    fileInfo.Delete();
619
                            filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data);
620
                            Check_Uri.UriCheck(filename);
629 621

  
630
                    //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
631
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
632
                    IntPtr hBitmap = bmp.GetHbitmap();
633
                    System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
634
                    Image img = new Image();
635
                    img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
622
                            br.Close();
623
                            fStream.Close();
624
                            fStream.Dispose();
625
                        }
626
                        else
627
                        {
628
                            dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert");
629
                            return;
630
                        }
636 631

  
637
                    var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
638
                    {
639
                        PointSet = new List<Point>(),
640
                        FilePath = img.Source.ToString(),
641
                        ImageData = img.Source,
642
                        StartPoint = new Point(100, 100),
643
                        EndPoint = new Point(200, 200),
644
                        TopRightPoint = new Point(100, 200),
645
                        LeftBottomPoint = new Point(200, 100)
646
                    };
632
                        fileInfo.Delete();
647 633

  
648
                    currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
649
                    currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
650
                    currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
634
                        //System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage();
635
                        System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage);
636
                        IntPtr hBitmap = bmp.GetHbitmap();
637
                        System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
638
                        Image img = new Image();
639
                        img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename));
651 640

  
652
                    currentControl.PointSet = new List<Point>
641
                        var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
642
                        {
643
                            PointSet = new List<Point>(),
644
                            FilePath = img.Source.ToString(),
645
                            ImageData = img.Source,
646
                            StartPoint = new Point(100, 100),
647
                            EndPoint = new Point(200, 200),
648
                            TopRightPoint = new Point(100, 200),
649
                            LeftBottomPoint = new Point(200, 100)
650
                        };
651

  
652
                        currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
653
                        currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
654
                        currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
655

  
656
                        currentControl.PointSet = new List<Point>
653 657
                                        {
654 658
                                            currentControl.StartPoint,
655 659
                                            currentControl.LeftBottomPoint,
......
657 661
                                            currentControl.TopRightPoint,
658 662
                                        };
659 663

  
660
                    multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
661
                    UndoData.Markup_List.Add(multi_Undo_Data);
662
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
664
                        multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
665
                        UndoData.Markup_List.Add(multi_Undo_Data);
666
                        ViewerDataModel.Instance.UndoDataList.Add(UndoData);
663 667

  
664
                    ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
665
                    currentControl.CommentID = Events.Save.shortGuid();
668
                        ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
669
                        currentControl.CommentID = Events.Save.shortGuid();
666 670

  
667
                    currentControl.ApplyTemplate();
668
                    currentControl.SetImage();
671
                        currentControl.ApplyTemplate();
672
                        currentControl.SetImage();
669 673

  
670
                    ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
671
                    Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
672
                    this.dzMainMenu.SelectLayer.Children.Add(final);
674
                        ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
675
                        Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
676
                        this.dzMainMenu.SelectLayer.Children.Add(final);
673 677

  
674
                    double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
675
                    double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
676
                    final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
678
                        double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
679
                        double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
680
                        final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
681
                    }
682
                    catch(Exception ex)
683
                    {
684
                        DialogMessage_Alert("" + ex, "Alert");
685
                    }
677 686
                }
678 687
            }
679 688
        }
KCOM/Views/MainMenu.xaml.cs
4647 4647
                                    }
4648 4648
                                    else
4649 4649
                                    {
4650
                                        
4650 4651
                                        string extension = System.IO.Path.GetExtension(filename).ToUpper();
4651 4652
                                        if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG")
4652 4653
                                        {
......
6193 6194
                        string guid = Save.shortGuid();
6194 6195

  
6195 6196
                        fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte);
6197
                        //Check_Uri.UriCheck();
6196 6198
                        fileUploader.RunCompleted += (ex, arg) =>
6197 6199
                        {
6198 6200
                            filename = arg.Result;
......
6212 6214
                                }                                
6213 6215
                            }
6214 6216

  
6215

  
6216

  
6217 6217
                            if (symbolsvg == true)
6218 6218
                            {
6219
                                //Common.Converter.SvgConverter svgConverter = new Common.Converter.SvgConverter();
6220
                                var defaultBitmapImage = new BitmapImage();
6221
                                defaultBitmapImage.BeginInit();
6222
                                defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
6223
                                defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
6224
                                defaultBitmapImage.UriSource = new Uri(filename);
6225
                                defaultBitmapImage.EndInit();
6226

  
6227
                                System.Drawing.Bitmap image;
6228

  
6229
                                if (defaultBitmapImage.IsDownloading)
6219
                                try
6230 6220
                                {
6231
                                    defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
6232
                                    {
6233
                                        defaultBitmapImage.Freeze();
6234
                                        //GC.Collect();
6221
                                    var defaultBitmapImage = new BitmapImage();
6222
                                    defaultBitmapImage.BeginInit();
6223
                                    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
6224
                                    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
6225
                                    Check_Uri.UriCheck(filename);
6226
                                    defaultBitmapImage.UriSource = new Uri(filename);
6227
                                    defaultBitmapImage.EndInit();
6235 6228

  
6236
                                        image = GetBitmap(defaultBitmapImage);
6229
                                    System.Drawing.Bitmap image;
6237 6230

  
6238
                                        image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
6239

  
6240
                                        Process potrace = new Process
6231
                                    if (defaultBitmapImage.IsDownloading)
6232
                                    {
6233
                                        defaultBitmapImage.DownloadCompleted += (ex2, arg2) =>
6241 6234
                                        {
6242
                                            StartInfo = new ProcessStartInfo
6235
                                            defaultBitmapImage.Freeze();
6236
                                            image = GetBitmap(defaultBitmapImage);
6237
                                            image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
6238
                                            Process potrace = new Process
6243 6239
                                            {
6244
                                                //FileName = @"http://cloud.devdoftech.co.kr:5977/UserData/"+ "potrace.exe",
6245
                                                FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
6246
                                                //Arguments = "-s -u 1", //SVG
6247
                                                //Arguments = "- -o- --svg",
6248
                                                //Arguments = filename2 + "  --backend svg",
6249
                                                //Arguments = @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp" + "  --backend svg -i",
6250
                                                //Arguments = "-b svg -i " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
6251
                                                Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
6252
                                                RedirectStandardInput = true,
6253
                                                RedirectStandardOutput = true,
6254
                                                //RedirectStandardError = Program.IsDebug,
6255
                                                RedirectStandardError = true,
6256
                                                UseShellExecute = false,
6257
                                                CreateNoWindow = true,
6258
                                                WindowStyle = ProcessWindowStyle.Hidden
6259
                                            },
6260
                                            //EnableRaisingEvents = false
6261
                                        };
6262

  
6263
                                        StringBuilder svgBuilder = new StringBuilder();
6264
                                        potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) => {
6265
                                            svgBuilder.AppendLine(e2.Data);
6266
                                        };
6267

  
6268

  
6269
                                        //potrace.WaitForExit();
6240
                                                StartInfo = new ProcessStartInfo
6241
                                                {
6242
                                                    FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe",
6243
                                                    Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp",
6244
                                                    RedirectStandardInput = true,
6245
                                                    RedirectStandardOutput = true,
6246
                                                    RedirectStandardError = true,
6247
                                                    UseShellExecute = false,
6248
                                                    CreateNoWindow = true,
6249
                                                    WindowStyle = ProcessWindowStyle.Hidden
6250
                                                },
6251
                                            };
6270 6252

  
6271
                                        potrace.EnableRaisingEvents = true;
6272
                                        potrace.Start();
6273
                                        potrace.Exited += (sender, e) => {
6274
                                            byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
6275
                                            //kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
6276
                                            svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
6277
                                            if (symbolselectindex == 0)
6253
                                            StringBuilder svgBuilder = new StringBuilder();
6254
                                            potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) =>
6278 6255
                                            {
6279
                                                SymbolSave(symbolname, svgfilename, data);
6280
                                            }
6281
                                            else
6256
                                                svgBuilder.AppendLine(e2.Data);
6257
                                            };
6258

  
6259
                                            potrace.EnableRaisingEvents = true;
6260
                                            potrace.Start();
6261
                                            potrace.Exited += (sender, e) =>
6282 6262
                                            {
6283
                                                SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
6284
                                            }
6263
                                                byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg");
6264
                                                svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes);
6265
                                                Check_Uri.UriCheck(svgfilename);
6266
                                                if (symbolselectindex == 0)
6267
                                                {
6268
                                                    SymbolSave(symbolname, svgfilename, data);
6269
                                                }
6270
                                                else
6271
                                                {
6272
                                                    SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
6273
                                                }
6285 6274

  
6286
                                            DataBind();
6275
                                                DataBind();
6276
                                            };
6277
                                            potrace.WaitForExit();
6287 6278
                                        };
6288
                                        potrace.WaitForExit();
6289
                                        //potrace.WaitForExit();
6290
                                    };
6279
                                    }
6280
                                    else
6281
                                    {
6282
                                        //GC.Collect();
6283
                                    }
6291 6284
                                }
6292
                                else
6285
                                catch(Exception ee)
6293 6286
                                {
6294

  
6295
                                    //GC.Collect();
6287
                                    DialogMessage_Alert("" + ee, "Alert");
6296 6288
                                }
6297 6289
                            }
6298 6290
                        };                                             
......
6414 6406
        }
6415 6407
        private void MarkupNamePromptClose(string data, WindowClosedEventArgs args)
6416 6408
        {
6417
            Save save = new Save();
6418
            if (args.PromptResult != null)
6409
            try
6419 6410
            {
6420
                if (args.DialogResult.Value)
6411
                Save save = new Save();
6412
                if (args.PromptResult != null)
6421 6413
                {
6422
                    PngBitmapEncoder _Encoder = symImage(data);
6423

  
6424
                    System.IO.MemoryStream fs = new System.IO.MemoryStream();
6425
                    _Encoder.Save(fs);
6426
                    System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
6414
                    if (args.DialogResult.Value)
6415
                    {
6416
                        PngBitmapEncoder _Encoder = symImage(data);
6427 6417

  
6428
                    byte[] Img_byte = fs.ToArray();
6418
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
6419
                        _Encoder.Save(fs);
6420
                        System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs);
6429 6421

  
6430
                    kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
6431
                    filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Save.shortGuid() + ".png", Img_byte);
6422
                        byte[] Img_byte = fs.ToArray();
6432 6423

  
6433
                    if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
6434
                    {
6435
                        save.SymbolSave(args.PromptResult, filename, data);
6436
                    }
6437
                    else
6438
                    {
6439
                        save.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
6424
                        kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload();
6425
                        filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Save.shortGuid() + ".png", Img_byte);
6426
                        Check_Uri.UriCheck(filename);
6427
                        if (symbolPanel_Instance.RadTab.SelectedIndex == 0)
6428
                        {
6429
                            save.SymbolSave(args.PromptResult, filename, data);
6430
                        }
6431
                        else
6432
                        {
6433
                            save.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT);
6434
                        }
6435
                        DataBind();
6440 6436
                    }
6441
                    DataBind();
6442 6437
                }
6443 6438
            }
6439
            catch(Exception ex)
6440
            {
6441
                DialogMessage_Alert("" + ex, "Alert");
6442
            }
6444 6443
        }
6445 6444

  
6446 6445
        public PngBitmapEncoder symImage(string data)

내보내기 Unified diff

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