private void LoadKeys(Window currentWindow) { // create dialog var dialog = new OpenFileDialog(); dialog.FileName = "programmer"; dialog.DefaultExt = "rpk"; dialog.Filter = DialogFilter; if (string.IsNullOrEmpty(Settings.Default.AccessKeysDirectory)) { Settings.Default.AccessKeysDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); } // ask user dialog.InitialDirectory = Settings.Default.AccessKeysDirectory; if (dialog.ShowDialog(currentWindow) != true) { return; } // handle result Settings.Default.AccessKeysDirectory = Path.GetDirectoryName(dialog.FileName); Settings.Default.Save(); IRfidAccess newAccess; try { newAccess = XmlHelper.ReadXmlFile <IRfidAccess>(dialog.FileName, accessModel != null ? accessModel.GetType() : factory.CreateRfidAccess().GetType()); } catch (Exception) { return; } // set loaded access values KeyA = newAccess.KeyA; KeyB = newAccess.KeyB; AccessBits = newAccess.AccessBits; SelectedKey = newAccess.SelectedKey; RaisePropertyChanged(nameof(AccessChanged)); RaisePropertyChanged(nameof(AccessChangedCardReady)); }