private void newBettorButton_Click(object sender, EventArgs e)
        {
            if (newBettorTextBox.Text == (""))
            {
                MessageBox.Show("Voeg een gebruikers naam in!");

                return;
            }

            if (newBettorTextBox.Text.Length > 10)
            {
                MessageBox.Show("Je gebruikers naam mag niet langer zijn dan 10 karakters!");

                return;
            }

            if (newBettorTextBox.Text.Length < 4)
            {
                MessageBox.Show("Je gebruikers naam moet langer zijn dan 3 karakters!");

                return;
            }

            string name = newBettorTextBox.Text;

            Bettor newAddBettor = new Bettor(name);

            this.CreatedAddBettor = newAddBettor;

            this.Close();
        }
Exemple #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            AddBettor form = new AddBettor();

            form.ShowDialog();

            Bettor bettor = form.CreatedAddBettor;

            try
            {
                nameBettorLabel.Text = bettor.ToString();
            }
            catch (System.NullReferenceException)
            {
                Environment.Exit(1);
            }

            walletLabel.Text = money.ToString();

            System.Net.WebClient downloader = new System.Net.WebClient();
            string teamJson;

            teamJson = downloader.DownloadString("https://3513658495623.000webhostapp.com/jsonecho.php?key=71abae66b0d3a4eb39aee4281228eec4");

            List <Team> teams = JsonConvert.DeserializeObject <List <Team> >(teamJson);

            foreach (Team team in teams)
            {
                showTeamsListBox.Items.Add(team.teamname);
            }

            string matchJson;

            matchJson = downloader.DownloadString("https://3513658495623.000webhostapp.com/matchesjsonecho.php?key=71abae66b0d3a4eb39aee4281228eec4");
            List <Match> matches = JsonConvert.DeserializeObject <List <Match> >(matchJson);


            for (int i = 0; i < matches.Count; i++)
            {
                machtesComboBox.Items.Add(matches[i]);
            }
        }