public MainWindow() { InitializeComponent(); string path = LoadFilePath(); if (!string.IsNullOrEmpty(path)) { this._currentOpenFilename = System.IO.Path.GetFileName(path); BitmapImage bi = GetBitmapImage(new Uri(path), BitmapCacheOption.OnLoad); CanvasARGB canvas = CanvasARGB.CreateCanvasFromBitmap(bi); _originalImage = canvas; _lastImage = CanvasARGB.Clone(canvas); _currentImage = CanvasARGB.Clone(canvas); } Helper_SetAppTitle(string.Empty); ShowImage(false); }
private void MenuItem_Click(object sender, RoutedEventArgs e) { var ofd = new Microsoft.Win32.OpenFileDialog() { Filter = "*.*|*.*|Bitmap Files (*.bmp)|*.bmp|JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif" }; var result = ofd.ShowDialog(); if (result == false) { return; } this._currentOpenFilename = ofd.FileName; BitmapImage bi = GetBitmapImage(new Uri(ofd.FileName), BitmapCacheOption.OnLoad); CanvasARGB canvas = CanvasARGB.CreateCanvasFromBitmap(bi); _originalImage = canvas; SaveFilePath(ofd.FileName); _lastImage = CanvasARGB.Clone(canvas); ShowImage(false); }