public void PublishClipboard() { BitmapSource image; if (Clipboard.ContainsImage()) { image = Clipboard.GetImage(); } else if (Clipboard.ContainsFileDropList()) { var fileDropList = Clipboard.GetFileDropList(); using (var existingImage = new Bitmap(fileDropList[0])) image = Conversion.BitmapToSource(existingImage); } else { MessageBox.Show(this, "There is no file or image in Clipboard.", "Error", MessageBoxButton.OK, MessageBoxImage.Information); return; } // Open new designer window var designer = new Dyysh.Windows.DesignerWindow(image); designer.Show(); }
public void PublishFile() { string filePath; var openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); openFileDialog.ReadOnlyChecked = true; var result = openFileDialog.ShowDialog(Application.Current.MainWindow as MainWindow); if (result == true) { filePath = openFileDialog.FileName; BitmapSource image; using (var bitmap = new Bitmap(filePath)) image = Conversion.BitmapToSource(bitmap); //image = new BitmapImage( new Uri(filePath) ); // Open new designer window var designer = new Dyysh.Windows.DesignerWindow(image); designer.Show(); } }
private void FinishDrawing() { if (_width * _height >= 9) { this._isMouseDown = false; _x += this.Left; BitmapSource image = captureProvider.CaptureArea(new Int32Rect((int)_x, (int)_y, (int)_width, (int)_height)); if (Settings.Default.UseEditor) { // Open new designer window var designer = new Dyysh.Windows.DesignerWindow(image); designer.Show(); } else { Http.UploadImage(image); } } this.Close(); }