コード例 #1
0
 private void DiagramImage_MouseMove(object sender, MouseEventArgs e)
 {
     if (sender is Image image && image.DataContext is ObservableDiagram od && e.LeftButton == MouseButtonState.Pressed)
     {
         IntegrationUtils.DiagramToDragDrop(image, od);
     }
 }
コード例 #2
0
 private void DiagramImage_MouseMove(object sender, MouseEventArgs e)
 {
     if (sender is Image image && image.DataContext is ObservableDiagram od && e.LeftButton == MouseButtonState.Pressed)
     {
         IntegrationUtils.DiagramLibraryNodeToDragDrop(DiagramsListView, VM.SelectedNode, true);
     }
 }
コード例 #3
0
 private void DiagramLibraryNode_Drop(object sender, DragEventArgs e)
 {
     if (sender is FrameworkElement element && element.DataContext is ObservableDiagramLibraryNode destinationNode)
     {
         IntegrationUtils.DragDropToDiagramLibraryNode(e.Data, destinationNode, IntegrationUtils.GetDropAction(e.KeyStates));
         e.Handled = true;
     }
コード例 #4
0
 private void DiagramLibraryNode_MouseMove(object sender, MouseEventArgs e)
 {
     if (sender is FrameworkElement element && element.DataContext is ObservableDiagramLibraryNode sourceNode && e.LeftButton == MouseButtonState.Pressed)
     {
         IntegrationUtils.DiagramLibraryNodeToDragDrop(element, sourceNode, false);
     }
 }
コード例 #5
0
 private void DiagramsListView_Drop(object sender, DragEventArgs e)
 {
     if (sender == DiagramsListView && VM.NodeIsSelected)
     {
         IntegrationUtils.DragDropToDiagramLibraryNode(e.Data, VM.SelectedNode, IntegrationUtils.GetDropAction(e.KeyStates));
         e.Handled = true;
     }
 }
コード例 #6
0
ファイル: ImageUtils.cs プロジェクト: Aphexus/Chordious
        public static string BitmapToPngTempFile(Bitmap image, string title)
        {
            string tempPath = IntegrationUtils.GetTempPathAndCreateIfNecessary();

            string random = Path.GetRandomFileName().Substring(0, 8);

            string filePath = Path.Combine(tempPath, string.IsNullOrWhiteSpace(title) ? $"chordious.{random}.png" : $"chordious.{title.Trim()}.{random}.png");

            using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write))
            {
                BitmapEncoder encoder = new PngBitmapEncoder();

                BitmapImage    bmpImage      = BitmapToBitmapImage(image, ImageFormat.Png);
                BitmapMetadata frameMetadata = GetExportMetadata(ExportFormat.PNG);

                BitmapFrame frame = BitmapFrame.Create(bmpImage, null, frameMetadata, null);

                encoder.Frames.Add(frame);
                encoder.Save(fs);
            }

            return(filePath);
        }
コード例 #7
0
 public void DiagramToClipboard(ObservableDiagram diagram, float scaleFactor)
 {
     IntegrationUtils.DiagramToClipboard(diagram, scaleFactor);
 }
コード例 #8
0
 public void TextToClipboard(string text)
 {
     IntegrationUtils.TextToClipboard(text);
 }