public void PreenchePartida(PartidaPaladins partida)
        {
            this.partida = partida;
            deleteStripButton.Visible = true;

            List <ComboBox> comboBoxes_ally  = form_Controls.OfType <ComboBox>().ToList().Where(x => x.Name.Contains("ally")).ToList();
            List <ComboBox> comboBoxes_enemy = form_Controls.OfType <ComboBox>().ToList().Where(x => x.Name.Contains("enemy")).ToList();

            int i = 0;

            foreach (Champion_Paladins champion in partida.Time_Aliado)
            {
                comboBoxes_ally[i].SelectedIndex = champions.FindIndex(x => x.Nome == champion.Nome);
                if (champion == partida.SeuHeroi)
                {
                    SelecionaHeroi(form_Controls.OfType <PictureBox>().ToList().Where(x => x.Name.Contains(comboBoxes_ally[i].Name.Substring(3))).ToList(), new EventArgs());
                }
                i++;
            }

            i = 0;

            foreach (Champion_Paladins champion in partida.Time_Inimigo)
            {
                comboBoxes_enemy[i].SelectedIndex = champions.FindIndex(x => x.Nome == champion.Nome);
                i++;
            }

            cb_mapa.SelectedItem   = partida.Mapa;
            mtxb_ally_points.Text  = partida.pontosAliado.ToString();
            mtxb_enemy_points.Text = partida.pontosInimigo.ToString();
        }
 private void novoStripButton_Click(object sender, EventArgs e)
 {
     PreencheCampos();
     deleteStripButton.Visible = false;
     mtxb_ally_points.Text     = "";
     mtxb_enemy_points.Text    = "";
     this.partida = null;
 }
        private void bt_Salvar_Click(object sender, EventArgs e)
        {
            List <ComboBox> comboBoxes_ally  = form_Controls.OfType <ComboBox>().ToList().Where(x => x.Name.Contains("ally")).ToList();
            List <ComboBox> comboBoxes_enemy = form_Controls.OfType <ComboBox>().ToList().Where(x => x.Name.Contains("enemy")).ToList();

            List <Champion_Paladins> aliados  = new List <Champion_Paladins>();
            List <Champion_Paladins> inimigos = new List <Champion_Paladins>();

            foreach (ComboBox comboBox in comboBoxes_ally)
            {
                aliados.Add((comboBox.SelectedItem as Champion_Paladins));
            }

            foreach (ComboBox comboBox in comboBoxes_ally)
            {
                inimigos.Add((comboBox.SelectedItem as Champion_Paladins));
            }

            int pont_aliado, pont_inimigo;

            if (string.IsNullOrEmpty(mtxb_ally_points.Text) || string.IsNullOrEmpty(mtxb_enemy_points.Text))
            {
                MessageBox.Show("Invira valores válidos para a pontuação", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            pont_aliado  = int.Parse(mtxb_ally_points.Text);
            pont_inimigo = int.Parse(mtxb_enemy_points.Text);

            string mapa = cb_mapa.SelectedItem.ToString();

            Partida.Vencedor vencedor = (pont_aliado > pont_inimigo) ? Partida.Vencedor.Aliado : Partida.Vencedor.Inimigo;



            if (this.partida == null)
            {
                this.partida = new PartidaPaladins(vencedor, seu_heroi, aliados.ToArray(), inimigos.ToArray(), pont_aliado, pont_inimigo, mapa, DateTime.Now);
            }
            else
            {
                partidas.Remove(partida);
                this.partida.Altera(vencedor, seu_heroi, aliados.ToArray(), inimigos.ToArray(), pont_aliado, pont_inimigo, mapa);
            }

            partidas.Add(this.partida);

            File.WriteAllText(JSON_PATH, JsonConvert.SerializeObject(partidas));

            deleteStripButton.Visible = true;

            Form alert = new frm_NotificationOK("Salvo com sucesso");

            alert.ShowDialog();
        }
        private void PreencheCampos()
        {
            if (!File.Exists(JSON_PATH))
            {
                FileStream file = File.Create(JSON_PATH);
                file.Close();
            }

            deleteStripButton.Visible = false;

            LeArquivo(Properties.Resources.champions_paladins);
            LeArquivo(Properties.Resources.maps_paladins);

            form_Controls = this.Controls;
            List <ComboBox>   comboBoxes   = form_Controls.OfType <ComboBox>().ToList().Where(x => !x.Name.Contains("mapa")).ToList();
            List <PictureBox> pictureBoxes = form_Controls.OfType <PictureBox>().ToList();

            int cont_ally = 0, cont_enemy = 0;

            for (int i = 0; i < comboBoxes.Count; i++)
            {
                Champion_Paladins[] championsTemp = new Champion_Paladins[champions.Count];
                champions.CopyTo(championsTemp);
                comboBoxes[i].DataSource    = championsTemp;
                comboBoxes[i].DisplayMember = "Nome";

                PictureBox pictureBox = pictureBoxes.Where(x => x.Name.Contains(comboBoxes[i].Name.Substring(3))).ToArray()[0];
                Label      label      = form_Controls.OfType <Label>().ToList().Where(x => x.Name.Contains(comboBoxes[i].Name.Substring(3))).ToList()[0];

                if (comboBoxes[i].Name.Contains("ally"))
                {
                    comboBoxes[i].SelectedItem = champions[cont_ally];
                    pictureBox.Image           = champions[cont_ally].GetImage();
                    label.Text = champions[cont_ally].Classe;
                    cont_ally++;
                }
                else
                {
                    comboBoxes[i].SelectedItem = champions[cont_enemy];
                    pictureBox.Image           = champions[cont_enemy].GetImage();
                    label.Text = champions[cont_enemy].Classe;
                    cont_enemy++;
                }

                pictureBox.BringToFront();
                comboBoxes[i].SelectedIndexChanged += new EventHandler(AtualizaDados);
            }

            cb_mapa.DataSource = mapas.OrderBy(x => x).ToList();
            pb_mapa.Image      = (Bitmap)Properties.Resources.ResourceManager.GetObject((cb_mapa.SelectedItem as string).ToLower().Replace(" ", "_"));

            seu_heroi = (Champion_Paladins)comboBoxes.Where(x => x.Name.Contains("ally1")).ToList()[0].SelectedItem;
            partida   = null;
        }
        private void bt_Ok_Click(object sender, EventArgs e)
        {
            if (this.sender.Name.Contains("HS"))
            {
                PartidaHS partida = (PartidaHS)dataGridPartida.SelectedRows[0].DataBoundItem;
                retornaPartidaHS(partida);
            }
            else
            {
                PartidaPaladins partida = (PartidaPaladins)dataGridPartida.SelectedRows[0].DataBoundItem;
                retornaPartidaPaladins(partida);
            }

            Close();
        }