개정판 c73426a9
issue #926 이미지생성오류(imagecontrol, 외부이미지붙여넣기, symbol)
Change-Id: I5376bab4a5bff122eee8e0f38aa49b0e64d18c0b
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 |
} |
내보내기 Unified diff