Example #1
0
        private void ButtonSaveBlinds_Click(object sender, EventArgs e)
        {
            TreeNode node = treeView1.SelectedNode;

            while (node.Parent != null)
            {
                node = node.Parent;
            }
            BlindSaver saver = (BlindSaver)node.Tag;

            saver.name = treeView1.SelectedNode.Text;
            saver.blinds.Clear();
            for (int i = 0; i < dataGridViewBlinds.RowCount; i++)
            {
                string          format = "{0}/{1}";
                DataGridViewRow row    = dataGridViewBlinds.Rows[i];
                if (Convert.ToString(row.Cells[2].Value) != "")
                {
                    format += "+{2}";
                }
                if (Convert.ToString(row.Cells[0].Value) == "")
                {
                    break;
                }
                saver.blinds.Add(new BlindInfo(String.Format(format, row.Cells[0].Value, row.Cells[1].Value, row.Cells[2].Value)));
            }
            changed = true;
            MessageBox.Show("Blinds updated");
        }
Example #2
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            panel1.Visible = e.Node != null;
            if (e.Node == null)
            {
                return;
            }

            if (e.Node.Level == 0)
            {
                dataGridViewBlinds.Rows.Clear();


                BlindSaver saver = (BlindSaver)e.Node.Tag;


                for (int i = 0; i < saver.blinds.Count; i++)
                {
                    BlindInfo       blind    = saver.blinds[i];
                    int             rowindex = dataGridViewBlinds.Rows.Add();
                    DataGridViewRow row      = dataGridViewBlinds.Rows[rowindex];
                    row.Cells[0].Value = blind.Smallblind;
                    row.Cells[1].Value = blind.Bigblind;
                    if (blind.Ante > 0)
                    {
                        row.Cells[2].Value = blind.Ante;
                    }
                }

                panelBlinds.Visible = true;
                panelBlinds.Height  = panel1.Height - 20;
                panelWin.Visible    = false;

                return;
            }
            if (e.Node.Level == 1)
            {
                Award aw = (Award)e.Node.Tag;

                for (int i = 0; i < dataGridViewWin.Rows.Count; i++)
                {
                    dataGridViewWin.Rows[i].Cells[1].Value = "";
                }

                for (int i = 0; i < aw.wins.Count; i++)
                {
                    dataGridViewWin.Rows[i].Cells[1].Value = aw.wins[i];
                }
                textBoxPlayerCount.Text = Convert.ToString(aw.playercount);

                panelBlinds.Visible = false;
                panelWin.Top        = panelBlinds.Top;
                panelWin.Visible    = true;
            }
        }
Example #3
0
        public Hashtable LoadXml(Boolean UpdateUi)
        {
            XmlDataDocument document = new XmlDataDocument();
            document.Load(XMLFILE);
            XmlNode node = document.FirstChild;
            XmlNode ChildNode,ChildNode2;
            Hashtable results = new Hashtable();
            while (node != null)
            {

                if (node.Name == "Sites")
                {
                    ChildNode = node.FirstChild;
                    while(ChildNode != null)
                    {
                        if (ChildNode.Name == "Site")
                        {
                            ChildNode2 = ChildNode.FirstChild;
                            BlindSaver saver = new BlindSaver();
                            while (ChildNode2 != null)
                            {
                                if (ChildNode2.Name == "GameStructure")
                                    saver.Load(ChildNode2);

                                ChildNode2 = ChildNode2.NextSibling;
                            }

                            //Tallennetaan saver saitin nimen mukaisesti hajautustauluun
                            results.Add(ChildNode.Attributes["name"].Value,saver);

                        }

                        ChildNode = ChildNode.NextSibling;
                    }
                }

                node = node.NextSibling;
            }

            if (UpdateUi)
            {
                treeView1.BeginUpdate();
                treeView1.Nodes.Clear();

                //Lisätään kasinon nimen mukainen eka node
                foreach (string sitename in results.Keys)
                {
                    BlindSaver data = (BlindSaver) results[sitename];
                    TreeNode parentnode = treeView1.Nodes.Add(sitename);
                    parentnode.Tag = data;
                    TreeNode childnode;
                    //Lisätään structien nimen mukaiset alanodet, joille annetaan
                    //nimeksi structin nimi, ja tagiin heitetään saver objekti
                    foreach (Award aw in data.awards)
                    {
                        childnode = parentnode.Nodes.Add(aw.name);
                        childnode.Tag = aw;
                    }
                }

                treeView1.EndUpdate();

            }
            return results;
        }
Example #4
0
        private void comboBoxCasinos_SelectedIndexChanged(object sender, EventArgs e)
        {
            comboBoxGame.BeginUpdate();
            comboBoxGame.Items.Clear();
            comboBoxBlinds.BeginUpdate();
            comboBoxBlinds.Items.Clear();

            if (comboBoxCasinos.SelectedIndex == -1)
            {
                comboBoxGame.EndUpdate();
                comboBoxBlinds.EndUpdate();

                return;
            }

            BlindSaver saver = (BlindSaver)structures[comboBoxCasinos.SelectedItem];

            // add gametypes
            foreach (Award award in saver.awards)
            {
                comboBoxGame.Items.Add(award);
            }
            if (comboBoxGame.Items.Count > 0)
                comboBoxGame.SelectedIndex = 0;
            // add blind sizes to combobox
            foreach (BlindInfo blind in saver.blinds)
                comboBoxBlinds.Items.Add(blind);

            comboBoxBlinds.EndUpdate();
            comboBoxGame.EndUpdate();

            if (comboBoxBlinds.Items.Count > 0)
                comboBoxBlinds.SelectedIndex = 0;
            blindstruct = saver;
            if (party != null)
                party.SetBlindStructure(blindstruct.blinds);
        }
Example #5
0
        public Hashtable LoadXml(Boolean UpdateUi)
        {
            XmlDataDocument document = new XmlDataDocument();

            document.Load(XMLFILE);
            XmlNode   node = document.FirstChild;
            XmlNode   ChildNode, ChildNode2;
            Hashtable results = new Hashtable();

            while (node != null)
            {
                if (node.Name == "Sites")
                {
                    ChildNode = node.FirstChild;
                    while (ChildNode != null)
                    {
                        if (ChildNode.Name == "Site")
                        {
                            ChildNode2 = ChildNode.FirstChild;
                            BlindSaver saver = new BlindSaver();
                            while (ChildNode2 != null)
                            {
                                if (ChildNode2.Name == "GameStructure")
                                {
                                    saver.Load(ChildNode2);
                                }

                                ChildNode2 = ChildNode2.NextSibling;
                            }

                            //Tallennetaan saver saitin nimen mukaisesti hajautustauluun
                            results.Add(ChildNode.Attributes["name"].Value, saver);
                        }

                        ChildNode = ChildNode.NextSibling;
                    }
                }



                node = node.NextSibling;
            }

            if (UpdateUi)
            {
                treeView1.BeginUpdate();
                treeView1.Nodes.Clear();

                //Lisätään kasinon nimen mukainen eka node
                foreach (string sitename in results.Keys)
                {
                    BlindSaver data       = (BlindSaver)results[sitename];
                    TreeNode   parentnode = treeView1.Nodes.Add(sitename);
                    parentnode.Tag = data;
                    TreeNode childnode;
                    //Lisätään structien nimen mukaiset alanodet, joille annetaan
                    //nimeksi structin nimi, ja tagiin heitetään saver objekti
                    foreach (Award aw in data.awards)
                    {
                        childnode     = parentnode.Nodes.Add(aw.name);
                        childnode.Tag = aw;
                    }
                }

                treeView1.EndUpdate();
            }
            return(results);
        }