예제 #1
0
        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();
        }
예제 #2
0
        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();
            }
        }