public PreferencesViewModel(Preferences model)
        {
            this.model = model;

            editing = new Preferences();
            model.CopyTo(editing);

            CommitCommand = new RelayCommand(o => Commit());
            CancelCommand = new RelayCommand(o => Cancel());
        }
예제 #2
0
        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();
        }
예제 #3
0
 public void CopyTo(Preferences dest)
 {
     dest.MatchingMode = MatchingMode;
 }