Example #1
0
        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();
        }
Example #2
0
        private static void ExecuteBindableViewModel()
        {
            var window = new PersonWindow {
                DataContext = new BindablePerson()
                {
                    Name = "rimever"
                }
            };

            window.Show();
            window.Close();
        }
Example #3
0
        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));
        }
Example #4
0
        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;
            }
        }
Example #5
0
        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);
            }
        }