public PreferencesWindowViewModel(GameConfigurationSection configurationSection)
 {
     _configurationSection = configurationSection;
     WhiteListedFiles      = new ObservableCollection <WhitelistedFileEditableObject>(configurationSection.WhiteListedFiles.Select(v => new WhitelistedFileEditableObject(v)));
     BasePath       = configurationSection.BasePath;
     SelectBasePath = ReactiveCommand.Create(DoSelectBasePath);
     Ok             = ReactiveCommand.Create(DoSave, _canSave);
     Cancel         = ReactiveCommand.Create(() => ShouldClose?.Invoke(this, false));
     ValidatePreferences();
 }
 private void DoSave()
 {
     _configurationSection.BasePath = BasePath;
     _configurationSection.WhiteListedFilesConfigSection.Clear();
     foreach (var file in WhiteListedFiles)
     {
         _configurationSection.WhiteListedFilesConfigSection.Add(file.Value);
     }
     ShouldClose?.Invoke(this, true);
 }
Esempio n. 3
0
 public NameConfirmVM(string name)
 {
     Ok     = ReactiveCommand.Create(() => ShouldClose?.Invoke(this, true), _canSave);
     Cancel = ReactiveCommand.Create(() => ShouldClose?.Invoke(this, false));
     Name   = name;
 }