public void SelectImageEvent_Clicked(object sender, RoutedEventArgs e) { var ofd = new OpenFileDialog { Filter = "Image Files|*.png;*.jpg;*.jpeg;*.bmp;*.tif;*.tiff", Title = LanguageLibrary.Language.Default.title_select_image, Multiselect = false }; var initialDirectory = Settings.Default.Get("last_folder", string.Empty); if (!string.IsNullOrEmpty(initialDirectory)) { if (Directory.Exists(initialDirectory)) { ofd.InitialDirectory = initialDirectory; } } var dialog = ofd.ShowDialog(); if (dialog != true) { return; } var fileName = ofd.FileName; if (!File.Exists(fileName)) { WpfMessageBox.Show($"'{fileName}' does not exist!", LanguageLibrary.Language.Default.title_error, MessageBoxButton.OK, MessageBoxImage.Error); return; } Settings.Default.Set("last_folder", Path.GetDirectoryName(ofd.FileName)); var extension = Path.GetExtension(fileName); if (extension != null) { var ext = extension.ToLower(); if (ext != ".png" || ext != ".jpg" || ext != ".jpeg") { var temp = Path.GetTempFileName(); Image.FromFile(fileName).Save(temp, ImageFormat.Png); fileName = temp; } } SelectedFile.Text = ofd.SafeFileName; //ColorPreview.Background = _orgColor; /*var c = ((SolidColorBrush)ColorPreview.Background).Color; * var color = Color.FromArgb(c.R, c.G, c.B); * pickColor.Foreground = new SolidColorBrush(Helpers.ContrastColor(color).ToMediaColor()); */ SolidColorPicker.SelectedColor = _orgColor; _mainWindow.SelectedFile = fileName; Settings.Default.Set("dcolor", System.Drawing.Color.FromArgb(_orgColor.R, _orgColor.G, _orgColor.B)); Settings.Default.Set("filename", ofd.FileName); Settings.Default.Save(); _mainWindow.GlyphsViewer.ToolTip = ofd.FileName; var t = Path.GetTempFileName(); var f = Path.GetTempFileName(); File.Copy(Config.BakPriFileLocation, f, true); LogonPriEditor.ModifyLogonPri(f, t, ofd.FileName); var loadedMeta = SharedHelpers.GetFileSize(ofd.FileName); ActualFileSizeTp.Text = loadedMeta.ActualFileSizeHuman; LoadedFileSizeTp.Text = loadedMeta.LoadedFileSizeHuman; PriFileSizeTp.Text = SharedHelpers.GetFileSize(t).ActualFileSizeHuman; File.Delete(t); File.Delete(f); }