/*********************************** END OF VARIABLE DEFINITIONS ***********************************************************************/





        public Form_Configuration(Form_Main parent)
        {
            InitializeComponent();
            this.parent_form = parent;
            configuration = Program.getConfiguration();
            
            
            // Default: Team 1 is down
            team1_up = false;


            
        }
        // For the Main Form thread
        public void Main()
        {
            if (this.game_form != null)
                this.game_form.Dispose();

            this.game_form = new Form_Main(xmlDoc);

            if (radioButton_camera.Checked)
                this.game_form.setCaptureDeviceIndex(capture_device_index);
            else
            {
                this.game_form.setLoadedVideoPath(loaded_video_path);
            }

            
            //send the configuration to the main (parent) form:
            // check if the position of the team has changed to also switch the team points:
            if (team1_up != configuration.TeamAup)
            {
                String temp_up_points = game_form.textBox_scoreteamup.Text;
                game_form.textBox_scoreteamup.Text = game_form.textBox_scoreteamdown.Text;
                game_form.textBox_scoreteamdown.Text = temp_up_points;

                configuration.TeamAup = team1_up; // now we can save the current team positions
            }

            // set the correct team labels
            if (team1_up)
            {
                game_form.textBox_teamupname.Text = configuration.Teama.Name;
                game_form.textBox_teamdownname.Text = configuration.Teamb.Name;
                game_form.radioButton_playerupleft.Text = configuration.Teama.Player1.Name;
                game_form.radioButton_playerupright.Text = configuration.Teama.Player2.Name;
                game_form.radioButton_playerdownleft.Text = configuration.Teamb.Player1.Name;
                game_form.radioButton_playerdownright.Text = configuration.Teamb.Player2.Name;
            }
            else
            {
                game_form.textBox_teamupname.Text = configuration.Teamb.Name;
                game_form.textBox_teamdownname.Text = configuration.Teama.Name;
                game_form.radioButton_playerupleft.Text = configuration.Teamb.Player1.Name;
                game_form.radioButton_playerupright.Text = configuration.Teamb.Player2.Name;
                game_form.radioButton_playerdownleft.Text = configuration.Teama.Player1.Name;
                game_form.radioButton_playerdownright.Text = configuration.Teama.Player2.Name;
            }



            

            Application.EnableVisualStyles();
            Application.Run(game_form);
        }
Beispiel #3
0
        public void loadRallies(Form_Main mainForm)
        {
            XmlNode rootNode;
            rootNode = xmlDoc.DocumentElement;

            List<long> list_timestamps = new List<long>();
            ImageList imageList_screenshots = new ImageList();
            imageList_screenshots.ImageSize = new Size(84, 68);

            mainForm.listView_screenshots.Items.Clear();


            List<Set> sets = new List<Set>();
            sets.Add(new Set(1));
            sets.Add(new Set(2));
            sets.Add(new Set(3));

            XmlNodeList rallies = xmlDoc.GetElementsByTagName("Spielzug");

            for (int i = 0; i < rallies.Count; i++)
            {
                int setnr = Convert.ToInt32(rallies[i].SelectSingleNode("@Satz").InnerText);
                long starttime = Convert.ToInt64(rallies[i].SelectSingleNode("@ID").InnerText);
                list_timestamps.Add(starttime);
                

                Rally rally = new Rally(starttime,setnr);


                rally.Kill = (rallies[i].SelectSingleNode("@Erfolg").InnerText == "True");
                rally.Smash = (rallies[i].SelectSingleNode("@Smash").InnerText == "True");
                rally.Drop = (rallies[i].SelectSingleNode("@Drop").InnerText == "True");
                rally.BigPoint = (rallies[i].SelectSingleNode("@Bigpoint").InnerText == "True");
                rally.Timeout = (rallies[i].SelectSingleNode("@Timeout").InnerText == "True");
                rally.Standardposition = (rallies[i].SelectSingleNode("@Standardseite").InnerText == "True");
 

                // Get All Positions
                XmlNode xmlposition = rallies[i].SelectSingleNode("Aufschlag");
                rally.Service_pos = getPosition(xmlposition);

                xmlposition = rallies[i].SelectSingleNode("Annahme");
                rally.Reception_pos = getPosition(xmlposition);

                rally.Reception_pos.Player = new Person();
                String playername = rallies[i].SelectSingleNode("ReceptionPlayer/Player/@Name").InnerText;
                rally.Reception_pos.Player = readPlayer(playername);


                XmlNodeList defenceplayers = rallies[i].SelectNodes("Punktchance_aus_Defence/Player");
                List<Person> defenceplayerslist = new List<Person>();
                for (int c = 0; c < defenceplayers.Count; c++)
                {
                    string name = defenceplayers[c].SelectSingleNode("@Name").InnerText;
                    defenceplayerslist.Add(readPlayer(name));
                }
                rally.Reception_pos.Defenceplayers = defenceplayerslist;



                xmlposition = rallies[i].SelectSingleNode("Zuspiel");
                rally.Set_pos = getPosition(xmlposition);

                xmlposition = rallies[i].SelectSingleNode("Anlauf");
                rally.Takeoff_pos = getPosition(xmlposition);

                xmlposition = rallies[i].SelectSingleNode("Angriff");
                rally.Approach_pos = getPosition(xmlposition);

                xmlposition = rallies[i].SelectSingleNode("Abwehr");
                rally.Defence_pos = getPosition(xmlposition);



                // Set Screenshot
                CaptureStream capture_stream = new CaptureStream();
                Bitmap screenshot = capture_stream.createScreenshot(starttime, false);
                if (screenshot != null)
                {

                    imageList_screenshots.Images.Add(screenshot);
                    mainForm.setImageListScreenshots(imageList_screenshots);

                    int screenshot_index = i;
                    ListViewItem screenshot_item = new ListViewItem("", screenshot_index);

                    mainForm.listView_screenshots.Items.Add(screenshot_item);
                    mainForm.listView_screenshots.LargeImageList = mainForm.getImageListScreenshots();
                    mainForm.listView_screenshots.Refresh();
                }


                

                sets[setnr - 1].Rallies.Add(rally);
                
            }

            mainForm.Game.Sets = sets;
            mainForm.List_timestamps = list_timestamps;
        }