Пример #1
0
        public MainWindow()
        {
            InitializeComponent();

            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                using (var dbContext = new TodoDbContext())
                {
                    dbContext.Database.Migrate();
                }

                var newTodoItemViewModel = new NewTodoItemViewModel(() => new TodoDbContext());
                NewTodoItemView.DataContext = newTodoItemViewModel;
                var showTodoListViewModel = new ShowTodoListViewModel(() => new TodoDbContext());
                ShowTodoListView.DataContext = showTodoListViewModel;

                showTodoListViewModel.Observe(newTodoItemViewModel);
                showTodoListViewModel.Initialize();

                Resources.Add("RemoveTodoItemCommand", new RemoveTodoItemCommand(() => new TodoDbContext()));
            }
        }
        public ShowTodoListViewModelTest()
        {
            _target = new ShowTodoListViewModel(CreateDbContext);

            _target.Observe(_newTodoItemViewModel);
        }