Example #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.DiagramLibraryNodeToDragDrop(DiagramsListView, VM.SelectedNode, true);
     }
 }
 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);
     }
 }
Example #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;
     }
Example #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);
     }
 }
Example #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;
     }
 }
Example #6
0
        public static string BitmapToPngTempFile(Bitmap image, string title)
        {
            string tempPath = IntegrationUtils.GetTempPathAndCreateIfNecessary();

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

            string filePath = FolderUtils.CleanPath(Path.Combine(tempPath, string.IsNullOrWhiteSpace(title) ? $"chordious.{random}.png" : $"chordious.{FolderUtils.CleanTitle(title)}.{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);
        }
Example #7
0
 public void DiagramToClipboard(ObservableDiagram diagram, float scaleFactor)
 {
     IntegrationUtils.DiagramToClipboard(diagram, scaleFactor);
 }
Example #8
0
 public void TextToClipboard(string text)
 {
     IntegrationUtils.TextToClipboard(text);
 }