public SettingsMenuViewModel(IPersistentData persistentData, IDialogCoordinator dialogCoordinator, BuildsControlViewModel buildsControlViewModel) { _persistentData = persistentData; _dialogCoordinator = dialogCoordinator; _buildsControlViewModel = buildsControlViewModel; Options = persistentData.Options; DisplayName = L10n.Message("Options"); ChangeBuildsSavePathCommand = new AsyncRelayCommand(ChangeBuildsSavePath); Options.PropertyChanged += OptionsOnPropertyChanged; }
public SettingsMenuViewModel(IPersistentData persistentData, IDialogCoordinator dialogCoordinator, BuildsControlViewModel buildsControlViewModel) { _persistentData = persistentData; _dialogCoordinator = dialogCoordinator; _buildsControlViewModel = buildsControlViewModel; Options = persistentData.Options; DisplayName = L10n.Message("Settings"); ChangeBuildsSavePathCommand = new AsyncRelayCommand(ChangeBuildsSavePath); PropertyChangedEventHandler handler = async (sender, args) => await OptionsChanged(args.PropertyName); Options.PropertyChanged += handler; RequestsClose += _ => { Options.PropertyChanged -= handler; persistentData.Save(); }; }