public PreferencesViewModel(Preferences model) { this.model = model; editing = new Preferences(); model.CopyTo(editing); CommitCommand = new RelayCommand(o => Commit()); CancelCommand = new RelayCommand(o => Cancel()); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); Preferences = Preferences.LoadFrom(PreferencePath); var view = new MainWindow(); MainWindow = view; var model = new MainViewModel(); foreach (var product in Product.LoadFrom()) { model.Products.Add(new ProductViewModel(product)); } model.CloseRequired += delegate { view.Close(); }; view.DataContext = model; view.Show(); }
public void CopyTo(Preferences dest) { dest.MatchingMode = MatchingMode; }