Exemplo n.º 1
0
        private void ProjectsDataGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (ProjectsDataGrid.SelectedItem == null)
            {
                return;
            }

            int     index = ProjectsDataGrid.SelectedIndex;
            AppUser user  = _viewModel.Projects[index].Supervisor;

            if (user.Id == 0)
            {
                MessageBox.Show("Для проекта не назначен руководитель.", "Внимание", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            PersonInfoWindow personInfo = new PersonInfoWindow(user, _viewModel.Projects[index].Name);

            personInfo.Show();
        }
Exemplo n.º 2
0
        private async void RegisterImpl(object o)
        {
            LoaderManager.Instance.ShowLoader();
            await Task.Run(() => Thread.Sleep(1000));

            LoaderManager.Instance.HideLoader();

            if (countAge() < 0 || countAge() > 135)
            {
                MessageBox.Show(ErrorMessage);
            }
            else
            {
                Person person = null;

                await Task.Run((() =>
                {
                    person = new Person(_name, _surname, _email, _birthDate);
                }));

                PersonInfoWindow personInfoWindow = new PersonInfoWindow(person);
                personInfoWindow.Show();
            }
        }
Exemplo n.º 3
0
        private async void RegisterImpl(object o)
        {
            LoaderManager.Instance.ShowLoader();
            await Task.Run(() => Thread.Sleep(1000));

            LoaderManager.Instance.HideLoader();

            Person person = null;

            await Task.Run((() =>
            {
                try
                {
                    person = new Person(_name, _surname, _email, _birthDate);
                }
                catch (InvalidFormatEmailException ex)
                {
                    Console.WriteLine($"Error: {ex.Message}");
                    Console.WriteLine($"Invalid value: {ex.Email}");
                }
                catch (BirthdateInFutureException ex1)
                {
                    Console.WriteLine($"Error: {ex1.Message}");
                    Console.WriteLine($"Invalid value: {ex1.Age}");
                }
                catch (BirthdateInPastException ex2)
                {
                    Console.WriteLine($"Error: {ex2.Message}");
                    Console.WriteLine($"Invalid value: {ex2.Age}");
                }
            }));

            PersonInfoWindow personInfoWindow = new PersonInfoWindow(person);

            personInfoWindow.Show();
        }