void ReleaseDesignerOutlets()
        {
            if (AgeText != null)
            {
                AgeText.Dispose();
                AgeText = null;
            }

            if (MailText != null)
            {
                MailText.Dispose();
                MailText = null;
            }

            if (NameText != null)
            {
                NameText.Dispose();
                NameText = null;
            }

            if (RegButton != null)
            {
                RegButton.Dispose();
                RegButton = null;
            }

            if (RegistratButton != null)
            {
                RegistratButton.Dispose();
                RegistratButton = null;
            }
        }
Exemplo n.º 2
0
 private void OnSendObjectExecute(object obj)
 {
     //MyMessages.Add(new MyMessage { Name = AgeText.ToString(), Message = MollyText });
     _signalRHubSync.SendHelloObject(new MyMessage {
         Name = AgeText.ToString(), Message = MollyText
     });
     MollyText = "";
     AgeText   = 0;
 }
Exemplo n.º 3
0
        public static string Age(List <string> strings)
        {
            if (CampaignCheats.CheckParameters(strings, 0) || CampaignCheats.CheckHelp(strings))
            {
                return($"{FormatMsgHeader.ToString()} \"dcc.age [{AgeText.ToString()}]\".");
            }
            int num = 1;

            if (!int.TryParse(strings[0], out num))
            {
                return(EnterAgeMsg.ToString());
            }
            Hero.MainHero.BirthDay = HeroHelper.GetRandomBirthDayForAge((float)num);
            return(SuccessMsg.ToString());
        }
Exemplo n.º 4
0
        private async void Button_update_user_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (WorkClass.role == 1)
                {
                    person.personid = WorkClass.trener.trenerid;
                }
                else if (WorkClass.role == 0)
                {
                    person.personid = WorkClass.sportsman.sportsmanid;
                }
                else
                {
                    throw new Exception("Не выбрана роль");
                }
                if (!string.IsNullOrEmpty(NameText.Text) && !string.IsNullOrEmpty(SnameText.Text) &&
                    !string.IsNullOrEmpty(PhoneText.Text) && !string.IsNullOrEmpty(AgeText.Text))
                {
                    person.name  = NameText.Text;
                    person.sname = SnameText.Text;
                    person.phone = Convert.ToInt32(PhoneText.Text);
                    person.age   = Convert.ToInt32(AgeText.Text);

                    await UpdateInfoAsync();

                    NameText.Clear();
                    SnameText.Clear();
                    PhoneText.Clear();
                    AgeText.Clear();
                    Name.Text  = String.Empty;
                    Sname.Text = String.Empty;
                    Age.Text   = String.Empty;
                    Phone.Text = String.Empty;

                    await ReadInfoAsync();
                }
                else
                {
                    throw new Exception("Поля не заполнены");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 5
0
 private void Number_reg_TextChanged(object sender, TextChangedEventArgs e)
 {
     try
     {
         if (!(Regex.IsMatch(PhoneText.Text, @"^\d*$")))
         {
             PhoneText.Clear();
             throw new Exception("Error!!! Неправильные символы");
         }
         else if (!(Regex.IsMatch(AgeText.Text, @"^\d*$")))
         {
             AgeText.Clear();
             throw new Exception("Error!!! Неправильные символы");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 6
0
 private void ClearControls()
 {
     NameText.Clear();
     AgeText.Clear();
     GenderCombo.SelectedItem = null;
 }
Exemplo n.º 7
0
        private void AddPlayerButton_Click(object sender, RoutedEventArgs e)
        {
            bool error = false;

            if (string.IsNullOrEmpty(FioText.Text) || string.IsNullOrWhiteSpace(FioText.Text))
            {
                MessageBox.Show("Некорректный ввод! ФИО игрока не может быть пустой строкой или пробелом");
                error = true;
                FioText.Clear();
            }
            foreach (var item in Base.Players)
            {
                if (FioText.Text == item.Name)
                {
                    MessageBox.Show("Ошибка. Игрок с таким ФИО уже существует!");
                    error = true;
                    FioText.Clear();
                }
            }
            if (!Int32.TryParse(NumText.Text, out int number) || number > 99 || number <= 0)
            {
                MessageBox.Show("Игровой номер должен быть положительным числом, не превышающим 99");
                error = true;
                NumText.Clear();
            }
            if (!Int32.TryParse(AgeText.Text, out int age) || age < 15 || age > 50)
            {
                MessageBox.Show("Неприемлимый возраст для профессионального футболиста. \nВозраст находится в пределе от 16 до 50");
                error = true;
                AgeText.Clear();
            }
            if (!Int32.TryParse(GoalsText.Text, out int goals) || goals < 0 || goals > 1300)
            {
                MessageBox.Show("Введенное количество голов превышает успех самого результативного игрока в истории. (введите от 0 до 1330)");
                error = true;
                GoalsText.Clear();
            }
            if (!Int32.TryParse(AssistText.Text, out int assist) || assist < 0 || assist > 2000)
            {
                MessageBox.Show("Слишком большое количество голевых передач (введите от 0 до 4000)");
                error = true;
                AssistText.Clear();
            }

            if (error)
            {
                return;
            }
            var temp = new Player(FioText.Text, goals, assist, PosText.Text, number, age, null, ImText.Text);

            if (AddClBox.Text != "Свободный агент")
            {
                int index = 0;
                foreach (var item in Base.Clubs)
                {
                    if (item.Name == AddClBox.Text)
                    {
                        temp.Club = item;
                        if (Base.Clubs[index].Players == null)
                        {
                            List <Player> list = new List <Player> {
                                temp
                            };
                            Base.Clubs[index].Players = list;
                        }
                        else
                        {
                            Base.Clubs[index].Players.Add(temp);
                        }
                        break;
                    }
                    index++;
                }
                if (index == Base.Clubs.Count)
                {
                    MessageBox.Show("Такой клуб не найден. \nВыберите из списка сушествующих или Свободный агент, обозначающее что игрок не состоит в клубе!");
                    AddClText.Text         = "Свободный агент";
                    AddClBox.SelectedIndex = 0;
                    return;
                }
            }
            else
            {
                temp.Club = Base.freeClub;
                if (Base.freeClub.Players == null)
                {
                    List <Player> list = new List <Player> {
                        temp
                    };
                    Base.freeClub.Players = list;
                }
                else
                {
                    Base.freeClub.Players.Add(temp);
                }
            }
            Base.Players.Add(temp);
            MessageBox.Show("Футболист добавлен");
            DialogResult = true;
        }
Exemplo n.º 8
0
        public static string AgeHero(List <string> strings)
        {
            if (!CampaignCheats.CheckParameters(strings, 2) || CampaignCheats.CheckHelp(strings))
            {
                return($"{FormatMsgHeader.ToString()} \"dcc.age_hero [{HeroNameText.ToString()}] [{AgeText.ToString()}]\".");
            }
            Hero hero = CampaignCheats.GetHero(strings[0].Replace('_', ' '));

            if (hero == null)
            {
                return(HeroNotFoundMsg.ToString());
            }
            if (!int.TryParse(strings[1], out int num))
            {
                return(EnterAgeMsg.ToString());
            }
            hero.BirthDay = HeroHelper.GetRandomBirthDayForAge(num);
            return(SuccessMsg.ToString());
        }