public async void Proceed() { if (!Person.IsUserBorn(DateValue) || !Person.IsUserNotDead(DateValue)) { MessageBox.Show("Incorrect birth date. Birth date must" + " not be in the future and not more than 135 years from now."); return; } if (!Person.IsEMailValid(EMailValue)) { MessageBox.Show("Incorrect E-Mail format."); return; } if (_person == null) { _mwvm.AddNewUser(new Person(FirstNameValue, LastNameValue, EMailValue, DateValue)); } else { _mwvm.EditUser(new Person(FirstNameValue, LastNameValue, EMailValue, DateValue)); } _pw.Close(); }
private static void ExecuteBindableViewModel() { var window = new PersonWindow { DataContext = new BindablePerson() { Name = "rimever" } }; window.Show(); window.Close(); }
public void BindingAssert() { var window = new PersonWindow { DataContext = new PersonViewModel(new Person() { Name = "rimever" }) }; window.Show(); window.Close(); GC.Collect(); dotMemory.Check(memory => Assert.AreEqual(0, memory.GetObjects(where => where.Type.Is <PersonViewModel>()).ObjectsCount)); }
private static void ExecuteWeakPersonViewModel() { var p = new Person() { Name = "rim" }; foreach (var _ in Enumerable.Range(0, 2)) { var window = new PersonWindow { DataContext = new WeakPersonViewModel(p) }; window.Show(); window.Close(); window = null; } }
public void Close(WindowsEnum window) { switch (window) { case WindowsEnum.Main: _mainWindow.Close(); break; case WindowsEnum.Person: _personWindow.Close(); break; default: throw new ArgumentOutOfRangeException(nameof(window), window, null); } }