private void NewGame_Cancel(object sender, EventArgs e) { Views.MenuView menu = new Views.MenuView(); ViewModel.MenuViewModel menuVM = new ViewModel.MenuViewModel(); menuVM.NewGameEvent += new EventHandler(Menu_New); menuVM.LoadGameEvent += new EventHandler(Menu_Load); menuVM.QuitGameEvent += new EventHandler(Menu_Quit); menu.DataContext = menuVM; ChangeView(menu); }
private void ToMenu() { Views.MenuView menu = new Views.MenuView(); ViewModel.MenuViewModel menuVM = new ViewModel.MenuViewModel(); menuVM.NewGameEvent += new EventHandler(Menu_New); menuVM.LoadGameEvent += new EventHandler(Menu_Load); menuVM.QuitGameEvent += new EventHandler(Menu_Quit); menu.DataContext = menuVM; ChangeView(menu); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); Views.MenuView menu = new Views.MenuView(); ViewModel.MenuViewModel menuVM = new ViewModel.MenuViewModel(); menuVM.NewGameEvent += new EventHandler(Menu_New); menuVM.LoadGameEvent += new EventHandler(Menu_Load); menuVM.QuitGameEvent += new EventHandler(Menu_Quit); menu.DataContext = menuVM; _mainViewModel = new ViewModel.MainViewModel(menu); _mainWindow = new View.MainWindow(); _mainWindow.DataContext = _mainViewModel; _mainWindow.Show(); }