// Notifications handlers private void OnRestart(object obj) { Window.DataContext = null; Window.DataContext = WindowVM; WindowVM.ChangeViewModel(HelloVM); WindowVM.OnRestart(); GameVM = new GameViewModel(); }
public void CloseWindow() { TestSubject = new WindowVM(); TestSubject.UIAccess.IsDirectAccessEnabled = true; TestSubject.Show(); TestSubject.UIAccess.Window.Close(); }
public void Show() { TestSubject = new WindowVM(); TestSubject.UIAccess.IsDirectAccessEnabled = true; TestSubject.Show(); Assert.AreEqual(1, ApplicationVM.Current.Windows.Count); Assert.AreEqual(TestSubject, ApplicationVM.Current.MainWindow); Assert.That(TestSubject.UIAccess.HasWindow, Is.True, "HasWindow"); //in automated unit test this will be not allays true Assert.That(TestSubject.UIAccess.Window.IsActive, Is.True, "Window.IsActive"); Thread.Sleep(500); TestSubject.CloseAction.Execute(null); }
private void Window_Initialized(object sender, EventArgs e) { XmlSerializer ser = new XmlSerializer(typeof(WindowVM)); if (!Directory.Exists(@"C:\\SqlConsoleGui\\")) { Directory.CreateDirectory(@"C:\\SqlConsoleGui\\"); } using (Stream stream = new FileStream(serializationFile, FileMode.OpenOrCreate)) { if (stream.Length == 0) { window = new WindowVM(); } else { window = (WindowVM)ser.Deserialize(stream); } window.Bind(); this.DataContext = window; } }
private void OnEndGame(object obj) { GameVM.StopGame(); SummaryVM.Score = GameVM.Score; WindowVM.ChangeViewModel(SummaryVM); }
private void OnScored(object obj) { WindowVM.OnScored(); }
private void OnStartGame(object obj) { GameVM.StartGame(); WindowVM.ChangeViewModel(GameVM); }