/// <summary>
        /// Sets up the theme of the game lobby and performs initialization.
        /// </summary>
        private void NGameLobby_Load(object sender, EventArgs e)
        {
            CnCNetData.ConnectionBridge.OnUserJoinedChannel += new RConnectionBridge.ChannelJoinEventHandler(Instance_OnUserJoinedChannel);
            CnCNetData.ConnectionBridge.OnUserLeaveChannel += new RConnectionBridge.ChannelLeaveEventHandler(Instance_OnUserLeaveChannel);
            CnCNetData.ConnectionBridge.OnUserQuit += new RConnectionBridge.StringEventHandler(Instance_OnUserQuit);
            CnCNetData.ConnectionBridge.PrivmsgParsed += new RConnectionBridge.PrivmsgParsedEventHandler(Instance_PrivmsgParsed);
            CnCNetData.ConnectionBridge.OnCtcpParsed += new RConnectionBridge.CTCPParsedEventHandler(Instance_OnCtcpParsed);
            CnCNetData.ConnectionBridge.OnUserKicked += new RConnectionBridge.UserKickedEventHandler(Instance_OnUserKicked);
            SharedUILogic.GameProcessExited += GameProcessExited;

            MapSharer.OnMapDownloadFailed += MapSharer_OnMapDownloadFailed;
            MapSharer.OnMapDownloadComplete += MapSharer_OnMapDownloadComplete;
            MapSharer.OnMapUploadFailed += MapSharer_OnMapUploadFailed;
            MapSharer.OnMapUploadComplete += MapSharer_OnMapUploadComplete;

            defaultGame = DomainController.Instance().getDefaultGame().ToLower();

            this.Font = SharedLogic.getCommonFont();
            lbChatBox.Font = SharedLogic.getListBoxFont();

            startingLocationIndicators = SharedUILogic.LoadStartingLocationIndicators();

            enemyStartingLocationIndicator = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "enemyslocindicator.png");

            PlayerNamesOnPlayerLocations = new List<string>[8];
            PlayerColorsOnPlayerLocations = new List<int>[8];
            for (int id = 0; id < 8; id++)
            {
                PlayerNamesOnPlayerLocations[id] = new List<string>();
                PlayerColorsOnPlayerLocations[id] = new List<int>();
            }

            coopBriefingFont = new System.Drawing.Font("Segoe UI", 11.25f, FontStyle.Regular);
            playerNameOnPlayerLocationFont = new Font("Segoe UI", 8.25f, FontStyle.Regular);
            TeamIdentifiers = SharedUILogic.GetTeamIdentifiers();

            this.Icon = Icon.ExtractAssociatedIcon(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "clienticon.ico");
            this.BackgroundImage = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "gamelobbybg.png");
            panel1.BackgroundImage = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "gamelobbypanelbg.png");
            panel2.BackgroundImage = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "gamelobbyoptionspanelbg.png");

            btn133px = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "133pxbtn.png");
            btn133px_c = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "133pxbtn_c.png");

            imgKick = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "kick.png");
            imgKick_c = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "kick_c.png");
            imgBan = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "ban.png");
            imgBan_c = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "ban_c.png");

            btnLaunchGame.BackgroundImage = btn133px;
            btnLockGame.BackgroundImage = btn133px;
            btnLeaveGame.BackgroundImage = btn133px;
            btnChangeMap.BackgroundImage = btn133px;

            SharedUILogic.SetBackgroundImageLayout(this);

            sndButtonSound = new SoundPlayer(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "button.wav");
            sndJoinSound = new SoundPlayer(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "joingame.wav");
            sndLeaveSound = new SoundPlayer(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "leavegame.wav");
            sndMessageSound = new SoundPlayer(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "message.wav");

            sharpenPreview = DomainController.Instance().getImageSharpeningCnCNetStatus();

            string[] mpColorNames = DomainController.Instance().getMPColorNames().Split(',');
            for (int cmbId = 1; cmbId < 9; cmbId++)
            {
                getPlayerColorCMBFromId(cmbId).AddItem("Random", Color.White);
            }

            MPColors = SharedUILogic.GetMPColors();

            cListBoxFocusColor = SharedUILogic.GetColorFromString(DomainController.Instance().getListBoxFocusColor());

            for (int colorId = 1; colorId < 9; colorId++)
            {
                for (int cmbId = 1; cmbId < 9; cmbId++)
                {
                    getPlayerColorCMBFromId(cmbId).AddItem(mpColorNames[colorId - 1], MPColors[colorId]);
                }
            }

            iNumLoadingScreens = DomainController.Instance().getLoadScreenCount();

            string[] sides = DomainController.Instance().getSides().Split(',');

            for (int sideId = 0; sideId < sides.Length; sideId++)
                SideComboboxPrerequisites.Add(new SideComboboxPrerequisite());

            Image[] sideImages = SharedUILogic.LoadSideImages();

            for (int pId = 1; pId < 9; pId++)
            {
                LimitedComboBox cmb = getPlayerSideCMBFromId(pId);
                cmb.Items.Add(new DropDownItem("Random", sideImages[0]));
                cmb.FocusColor = cListBoxFocusColor;
            }
            int i = 1;
            foreach (string sideName in sides)
            {
                for (int pId = 1; pId < 9; pId++)
                {
                    getPlayerSideCMBFromId(pId).Items.Add(new DropDownItem(sideName, sideImages[i]));
                }

                i++;
            }
            for (int pId = 1; pId < 9; pId++)
            {
                getPlayerSideCMBFromId(pId).Items.Add(new DropDownItem("Spectator", sideImages[i]));
            }

            string panelBorderStyle = DomainController.Instance().getPanelBorderStyle();
            if (panelBorderStyle == "FixedSingle")
            {
                panel1.BorderStyle = BorderStyle.FixedSingle;
                panel2.BorderStyle = BorderStyle.FixedSingle;
            }
            else if (panelBorderStyle == "Fixed3D")
            {
                panel1.BorderStyle = BorderStyle.Fixed3D;
                panel2.BorderStyle = BorderStyle.Fixed3D;
            }
            else
            {
                panel1.BorderStyle = BorderStyle.None;
                panel2.BorderStyle = BorderStyle.None;
            }

            IniFile clIni = new IniFile(ProgramConstants.gamepath + "Resources\\GameOptions.ini");

            Color cLabelColor = SharedUILogic.GetColorFromString(DomainController.Instance().getUILabelColor());

            Color cAltUiColor = SharedUILogic.GetColorFromString(DomainController.Instance().getUIAltColor());

            Color cBackColor = SharedUILogic.GetColorFromString(DomainController.Instance().getUIAltBackgroundColor());

            toolTip1.BackColor = cBackColor;
            toolTip1.ForeColor = cLabelColor;

            coopBriefingForeColor = SharedUILogic.GetColorFromString(DomainController.Instance().getBriefingForeColor());

            int displayedItems = lbChatBox.DisplayRectangle.Height / lbChatBox.ItemHeight;

            customScrollbar1.ThumbBottomImage = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "sbThumbBottom.png");
            customScrollbar1.ThumbBottomSpanImage = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "sbThumbBottomSpan.png");
            customScrollbar1.ThumbMiddleImage = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "sbMiddle.png");
            customScrollbar1.ThumbTopImage = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "sbThumbTop.png");
            customScrollbar1.ThumbTopSpanImage = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "sbThumbTopSpan.png");
            customScrollbar1.UpArrowImage = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "sbUpArrow.png");
            customScrollbar1.DownArrowImage = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "sbDownArrow.png");
            customScrollbar1.BackgroundImage = Image.FromFile(ProgramConstants.gamepath + ProgramConstants.RESOURCES_DIR + "sbBackground.png");
            customScrollbar1.Scroll += customScrollbar1_Scroll;
            customScrollbar1.Maximum = lbChatBox.Items.Count - Convert.ToInt32(displayedItems * 0.2);
            customScrollbar1.Minimum = 0;
            customScrollbar1.ChannelColor = cBackColor;
            customScrollbar1.LargeChange = 27;
            customScrollbar1.SmallChange = 9;
            customScrollbar1.Value = 0;

            lbChatBox.MouseWheel += lbChatBox_MouseWheel;

            pNameTextBoxes = new TextBox[8];
            for (int tbId = 0; tbId < pNameTextBoxes.Length; tbId++)
            {
                pNameTextBoxes[tbId] = new TextBox();
                TextBox pNameTextBox = pNameTextBoxes[tbId];
                pNameTextBox.Location = getPlayerNameCMBFromId(tbId + 1).Location;
                pNameTextBox.Size = getPlayerNameCMBFromId(tbId + 1).Size;
                pNameTextBox.BorderStyle = BorderStyle.FixedSingle;
                pNameTextBox.Font = cmbP1Name.Font;
                pNameTextBox.GotFocus += playerNameTextBox_GotFocus;
                pNameTextBox.ForeColor = cAltUiColor;
                pNameTextBox.BackColor = cBackColor;
                panel1.Controls.Add(pNameTextBox);
                pNameTextBox.Visible = false;
            }

            pSideLabels = new TextBox[8];
            for (int labelId = 0; labelId < pSideLabels.Length; labelId++)
            {
                pSideLabels[labelId] = new TextBox();
                TextBox forcedSideBox = pSideLabels[labelId];
                forcedSideBox.Anchor = AnchorStyles.Top | AnchorStyles.Left;
                forcedSideBox.BackColor = cBackColor;
                forcedSideBox.BorderStyle = BorderStyle.FixedSingle;
                forcedSideBox.ForeColor = cLabelColor;
                Point sLocation = getPlayerSideCMBFromId(labelId + 1).Location;
                forcedSideBox.Location = sLocation;
                forcedSideBox.Size = getPlayerSideCMBFromId(labelId + 1).Size;
                panel1.Controls.Add(forcedSideBox);
                forcedSideBox.Visible = false;
                forcedSideBox.GotFocus += playerNameTextBox_GotFocus;
            }

            string[] checkBoxes = clIni.GetStringValue("GameLobby", "CheckBoxes", "none").Split(',');
            foreach (string checkBoxName in checkBoxes)
            {
                if (clIni.SectionExists(checkBoxName))
                {
                    string chkText = clIni.GetStringValue(checkBoxName, "Text", "No description");
                    string associatedSpawnIniOption = clIni.GetStringValue(checkBoxName, "AssociateSpawnIniOption", "none");
                    AssociatedCheckBoxSpawnIniOptions.Add(associatedSpawnIniOption);
                    string associatedCustomIni = clIni.GetStringValue(checkBoxName, "AssociateCustomIni", "none");
                    AssociatedCheckBoxCustomInis.Add(associatedCustomIni);
                    bool defaultValue = clIni.GetBooleanValue(checkBoxName, "DefaultValue", false);
                    bool reversed = clIni.GetBooleanValue(checkBoxName, "Reversed", false);
                    string[] location = clIni.GetStringValue(checkBoxName, "Location", "0,0").Split(',');
                    Point pLocation = new Point(Convert.ToInt32(location[0]), Convert.ToInt32(location[1]));
                    string toolTip = clIni.GetStringValue(checkBoxName, "ToolTip", String.Empty);

                    UserCheckBox chkBox = new UserCheckBox(cLabelColor, cAltUiColor, chkText);
                    chkBox.AutoSize = true;
                    chkBox.Location = pLocation;
                    chkBox.Name = checkBoxName;
                    if (defaultValue)
                        chkBox.Checked = true;
                    else
                        chkBox.Checked = false;
                    if (!isHost)
                        chkBox.IsEnabled = false;
                    chkBox.CheckedChanged += new UserCheckBox.OnCheckedChanged(GenericChkBox_CheckedChanged);

                    if (!String.IsNullOrEmpty(toolTip))
                    {
                        toolTip1.SetToolTip(chkBox, toolTip);
                        toolTip1.SetToolTip(chkBox.label1, toolTip);
                        toolTip1.SetToolTip(chkBox.button1, toolTip);
                    }

                    IsCheckBoxReversed.Add(reversed);

                    CheckBoxes.Add(chkBox);
                    if (pLocation.X < 435 && pLocation.Y < 236)
                    {
                        CheckBoxes[CheckBoxes.Count - 1].Anchor = AnchorStyles.Top | AnchorStyles.Left;
                        this.panel2.Controls.Add(CheckBoxes[CheckBoxes.Count - 1]);
                    }
                    else
                    {
                        UserCheckBox nChkBox = CheckBoxes[CheckBoxes.Count - 1];
                        nChkBox.Anchor = AnchorStyles.None;
                        string anchor = clIni.GetStringValue(checkBoxName, "Anchors", "none");

                        if (anchor == "Bottom,Left")
                            CheckBoxes[CheckBoxes.Count - 1].Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
                        else if (anchor == "Right")
                            CheckBoxes[CheckBoxes.Count - 1].Anchor = nChkBox.Anchor | AnchorStyles.Right;
                        else if (anchor == "Top,Left")
                            CheckBoxes[CheckBoxes.Count - 1].Anchor = AnchorStyles.Top | AnchorStyles.Left;
                        else if (anchor == "Bottom")
                            CheckBoxes[CheckBoxes.Count - 1].Anchor = nChkBox.Anchor | AnchorStyles.Bottom;

                        this.Controls.Add(CheckBoxes[CheckBoxes.Count - 1]);
                    }

                    chkBox.Initialize();
                }
                else
                    throw new Exception("No data exists for CheckBox " + checkBoxName + "!");
            }

            Color comboBoxNondefaultColor = SharedUILogic.GetColorFromString(DomainController.Instance().getComboBoxNondefaultColor());

            if ((comboBoxNondefaultColor.R == 0 &&
                comboBoxNondefaultColor.G == 0 &&
                comboBoxNondefaultColor.B == 0) || isHost)
                comboBoxNondefaultColor = cAltUiColor;

            string[] comboBoxes = clIni.GetStringValue("GameLobby", "ComboBoxes", "none").Split(',');
            foreach (string comboBoxName in comboBoxes)
            {
                if (clIni.SectionExists(comboBoxName))
                {
                    LimitedComboBox cmbBox = SharedUILogic.SetUpComboBoxFromIni(comboBoxName, clIni, toolTip1,
                        cmbP1Name.Font, cAltUiColor, comboBoxNondefaultColor);
                    string sideErrorSetDescr = clIni.GetStringValue(comboBoxName, "SideErrorSetDescr", "none");
                    string associateSpawnIniOption = clIni.GetStringValue(comboBoxName, "AssociateSpawnIniOption", "none");

                    if (!isHost)
                    {
                        cmbBox.CanDropDown = false;
                    }

                    cmbBox.DrawItem += cmbGeneric_DrawItem;

                    cmbBox.SelectedIndexChanged += new EventHandler(GenericGameOptionChanged);

                    ComboBoxes.Add(cmbBox);
                    if (cmbBox.Location.X < 436 && cmbBox.Location.Y < 237)
                        this.panel2.Controls.Add(cmbBox);
                    else
                        this.Controls.Add(cmbBox);
                    AssociatedComboBoxSpawnIniOptions.Add(associateSpawnIniOption);
                    ComboBoxSidePrereqErrorDescriptions.Add(sideErrorSetDescr);
                    ComboBoxDataWriteModes.Add((DataWriteMode)cmbBox.Tag);
                }
                else
                    throw new Exception("No data exists for ComboBox " + comboBoxName + "!");
            }

            string sideOptionPrerequisites = clIni.GetStringValue("GameLobby", "SideOptionPrerequisites", "none");
            if (sideOptionPrerequisites != "none")
            {
                string[] sideOptionPrereqArray = sideOptionPrerequisites.Split(',');
                int numSides = sideOptionPrereqArray.Length / 3;

                for (int sId = 0; sId < numSides; sId++)
                {
                    string sideName = sideOptionPrereqArray[sId * 3];
                    string comboBoxName = sideOptionPrereqArray[sId * 3 + 1];
                    int requiredIndex = Convert.ToInt32(sideOptionPrereqArray[sId * 3 + 2]);

                    int sideId = getSideIndexByName(sides, sideName);
                    int comboBoxId = ComboBoxes.FindIndex(c => c.Name == comboBoxName);

                    if (sideId == -1)
                        throw new Exception("Nonexistent side name: " + sideName);
                    if (comboBoxId == -1)
                        throw new Exception("Nonexistent ComboBox name: " + comboBoxName);

                    SideComboboxPrerequisites[sideId].SetData(comboBoxId, requiredIndex);
                }
            }

            string[] labels = clIni.GetStringValue("GameLobby", "Labels", "none").Split(',');
            foreach (string labelName in labels)
            {
                if (clIni.SectionExists(labelName))
                {
                    string text = clIni.GetStringValue(labelName, "Text", "no text defined here!");
                    string[] location = clIni.GetStringValue(labelName, "Location", "0,0").Split(',');
                    Point pLocation = new Point(Convert.ToInt32(location[0]), Convert.ToInt32(location[1]));
                    string toolTip = clIni.GetStringValue(labelName, "ToolTip", String.Empty);

                    Label label = new Label();
                    label.Anchor = AnchorStyles.Top | AnchorStyles.Left;
                    label.AutoSize = true;
                    label.BackColor = Color.Transparent;
                    label.Location = pLocation;
                    label.Name = labelName;
                    label.Text = text;
                    label.ForeColor = cLabelColor;

                    if (!String.IsNullOrEmpty(toolTip))
                    {
                        toolTip1.SetToolTip(label, toolTip);
                    }

                    if (pLocation.X < 436 && pLocation.Y < 237)
                        this.panel2.Controls.Add(label);
                    else
                        this.Controls.Add(label);
                }
                else
                    throw new Exception("No data exists for label " + labelName + "!");
            }

            InitReadyBoxes(cLabelColor, cAltUiColor);

            SharedUILogic.SetControlColor(cLabelColor, cBackColor, cAltUiColor, cListBoxFocusColor, this);

            DisableSoundsBox = new UserCheckBox(cLabelColor, cAltUiColor, "Disable sounds");
            DisableSoundsBox.Location = new Point(325, 243);
            DisableSoundsBox.Anchor = AnchorStyles.Top | AnchorStyles.Left;
            DisableSoundsBox.AutoSize = true;
            DisableSoundsBox.Name = "chkDisableSounds";
            DisableSoundsBox.Checked = false;
            this.Controls.Add(DisableSoundsBox);

            currentMap = CnCNetData.MapList[0];
            currentGameMode = currentMap.GameModes[0];
            lblGameMode.Text = "Game Mode: " + currentGameMode;
            lblMapName.Text = "Map: " + currentMap.Name;
            lblMapAuthor.Text = "By " + currentMap.Author;
            LoadPreview();

            btnP1Ban.BackgroundImage = imgBan;
            btnP2Ban.BackgroundImage = imgBan;
            btnP3Ban.BackgroundImage = imgBan;
            btnP4Ban.BackgroundImage = imgBan;
            btnP5Ban.BackgroundImage = imgBan;
            btnP6Ban.BackgroundImage = imgBan;
            btnP7Ban.BackgroundImage = imgBan;
            btnP8Ban.BackgroundImage = imgBan;

            btnP1Kick.BackgroundImage = imgKick;
            btnP2Kick.BackgroundImage = imgKick;
            btnP3Kick.BackgroundImage = imgKick;
            btnP4Kick.BackgroundImage = imgKick;
            btnP5Kick.BackgroundImage = imgKick;
            btnP6Kick.BackgroundImage = imgKick;
            btnP7Kick.BackgroundImage = imgKick;
            btnP8Kick.BackgroundImage = imgKick;

            if (isHost)
            {
                updatePlayers = false;
                CopyPlayerDataToUI();
                updatePlayers = true;

                // Set up the timer used for automatic refreshing of the game listing
                timer = new Timer();
                timer.Interval = 5000;
                timer.Tick += new EventHandler(UpdateGameListing);
                timer.Start();

                // Set up the timer used for automatically refreshing game options to other players
                gameOptionRefreshTimer = new Timer();
                gameOptionRefreshTimer.Interval = 5000;
                gameOptionRefreshTimer.Tick += new EventHandler(GenericGameOptionChanged);
                gameOptionRefreshTimer.Tick += new EventHandler(CopyPlayerDataFromUI);
            }
            else
            {
                btnChangeMap.Enabled = false;
                btnLockGame.Enabled = false;
                btnLaunchGame.Text = "I'm Ready";
                CnCNetData.ConnectionBridge.OnChannelModesChanged += new RConnectionBridge.ChannelModeEventHandler(Instance_OnChannelModesChanged);
                btnP1Kick.Enabled = false;
                btnP2Kick.Enabled = false;
                btnP3Kick.Enabled = false;
                btnP4Kick.Enabled = false;
                btnP5Kick.Enabled = false;
                btnP6Kick.Enabled = false;
                btnP7Kick.Enabled = false;
                btnP8Kick.Enabled = false;

                btnP1Ban.Enabled = false;
                btnP2Ban.Enabled = false;
                btnP3Ban.Enabled = false;
                btnP4Ban.Enabled = false;
                btnP5Ban.Enabled = false;
                btnP6Ban.Enabled = false;
                btnP7Ban.Enabled = false;
                btnP8Ban.Enabled = false;

                // Send version info to host
                CnCNetData.ConnectionBridge.SendMessage("NOTICE " + ChannelName + " " + CTCPChar1 + CTCPChar2 + "VERSION " + ProgramConstants.GAME_VERSION + CTCPChar2);
            }

            gameLobbyPersistentCheckBox = DomainController.Instance().getGameLobbyPersistentCheckBox();

            UpdateGameListing(null, EventArgs.Empty);

            resizeTimer = new System.Windows.Forms.Timer();
            resizeTimer.Interval = 500;
            resizeTimer.Tick += new EventHandler(resizeTimer_Tick);

            string[] windowSize = DomainController.Instance().getWindowSizeCnCNet().Split('x');
            int sizeX = Convert.ToInt32(windowSize[0]);
            if (sizeX > Screen.PrimaryScreen.Bounds.Width + 10)
                sizeX = Screen.PrimaryScreen.Bounds.Width - 10;
            int sizeY = Convert.ToInt32(windowSize[1]);
            if (sizeY > Screen.PrimaryScreen.Bounds.Height - 40)
                sizeY = Screen.PrimaryScreen.Bounds.Height - 40;

            this.ClientSize = new Size(sizeX, sizeY);
            this.Location = new Point((Screen.PrimaryScreen.Bounds.Width - this.Size.Width) / 2,
                (Screen.PrimaryScreen.Bounds.Height - this.Size.Height) / 2);

            SharedUILogic.ParseClientThemeIni(this);

            tbChatInputBox.Select();
        }
        private void GameSelectionForm_Load(object sender, EventArgs e)
        {
            cLabelColor = SharedUILogic.GetColorFromString(DomainController.Instance().getUILabelColor());
            cAltUIColor = SharedUILogic.GetColorFromString(DomainController.Instance().getUIAltColor());
            cBackColor = SharedUILogic.GetColorFromString(DomainController.Instance().getUIAltBackgroundColor());

            this.BackgroundImage = Image.FromFile(ProgramConstants.RESOURCES_DIR + "followedgamesbg.png");

            sp = new SoundPlayer(ProgramConstants.RESOURCES_DIR + "button.wav");
            btnOK.BackColor = cBackColor;
            btnOK.ForeColor = cAltUIColor;

            btn92px = Image.FromFile(ProgramConstants.RESOURCES_DIR + "92pxbtn.png");
            btn92px_c = Image.FromFile(ProgramConstants.RESOURCES_DIR + "92pxbtn_c.png");
            btnOK.BackgroundImage = btn92px;

            lblDescription.ForeColor = cLabelColor;

            string myGame = DomainController.Instance().getDefaultGame();

            // Generate selection boxes for games
            GameCollection gc = GameCollection.Instance;

            GameImages = gc.GetGameImages();

            int gameCount = gc.GetGameCount();

            int yPoint = lblDescription.Location.Y + lblDescription.Height + 10;
            int xPoint = lblDescription.Location.X;

            for (int i = 0; i < gameCount; i++)
            {
                if (!gc.IsGameSupported(i))
                    continue;

                if (String.IsNullOrEmpty(gc.GetGameBroadcastingChannelNameFromIndex(i)))
                    continue;

                string gameName = gc.GetFullGameNameFromIndex(i);

                PictureBox pb = new PictureBox();
                pb.Name = "pb" + gameName;
                pb.Location = new Point(xPoint, yPoint);
                pb.Size = GameImages[i].Size;
                pb.Image = GameImages[i];
                pb.BackColor = Color.Transparent;
                this.Controls.Add(pb);

                UserCheckBox checkBox = new UserCheckBox(cLabelColor, cAltUIColor, gameName);
                checkBox.LabelText = gameName;
                checkBox.Anchor = AnchorStyles.Top | AnchorStyles.Left;
                checkBox.AutoSize = true;
                checkBox.Location = new Point(xPoint + pb.Size.Width + 3, yPoint);
                checkBox.Name = "chk" + i;
                checkBox.Tag = i;
                checkBox.label1.BackColor = Color.Transparent;
                checkBox.Checked = gc.IsGameFollowed(i);
                checkBox.CheckedChanged += checkBox_CheckedChanged;
                this.Controls.Add(checkBox);

                checkBox.Initialize();

                if (gc.GetGameIdentifierFromIndex(i).Equals(myGame.ToLower()))
                {
                    checkBox.Enabled = false; // You cannot unfollow the game that you're playing
                }

                yPoint += pb.Size.Height + 3;
            }

            this.Size = new Size(this.Width, yPoint + GameImages[0].Size.Height + btnOK.Height + 16);
        }
        /// <summary>
        /// Creates new player ready boxes and adds them to the player options panel.
        /// </summary>
        /// <param name="cLabelColor">Color of labels in the UI.</param>
        /// <param name="cAltUiColor">Color of highlighted items in the UI.</param>
        private void InitReadyBoxes(Color cLabelColor, Color cAltUiColor)
        {
            chkP1Ready = new UserCheckBox(cLabelColor, cAltUiColor, "Ready");
            chkP1Ready.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            chkP1Ready.AutoSize = true;
            chkP1Ready.Location = new Point(498, 26);
            chkP1Ready.Name = "chkP1Ready";
            panel1.Controls.Add(chkP1Ready);

            chkP2Ready = new UserCheckBox(cLabelColor, cAltUiColor, "Ready");
            chkP2Ready.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            chkP2Ready.AutoSize = true;
            chkP2Ready.Location = new Point(498, 52);
            chkP2Ready.Name = "chkP2Ready";
            panel1.Controls.Add(chkP2Ready);

            chkP3Ready = new UserCheckBox(cLabelColor, cAltUiColor, "Ready");
            chkP3Ready.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            chkP3Ready.AutoSize = true;
            chkP3Ready.Location = new Point(498, 78);
            chkP3Ready.Name = "chkP3Ready";
            panel1.Controls.Add(chkP3Ready);

            chkP4Ready = new UserCheckBox(cLabelColor, cAltUiColor, "Ready");
            chkP4Ready.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            chkP4Ready.AutoSize = true;
            chkP4Ready.Location = new Point(498, 105);
            chkP4Ready.Name = "chkP4Ready";
            panel1.Controls.Add(chkP4Ready);

            chkP5Ready = new UserCheckBox(cLabelColor, cAltUiColor, "Ready");
            chkP5Ready.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            chkP5Ready.AutoSize = true;
            chkP5Ready.Location = new Point(498, 131);
            chkP5Ready.Name = "chkP5Ready";
            panel1.Controls.Add(chkP5Ready);

            chkP6Ready = new UserCheckBox(cLabelColor, cAltUiColor, "Ready");
            chkP6Ready.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            chkP6Ready.AutoSize = true;
            chkP6Ready.Location = new Point(498, 157);
            chkP6Ready.Name = "chkP6Ready";
            panel1.Controls.Add(chkP6Ready);

            chkP7Ready = new UserCheckBox(cLabelColor, cAltUiColor, "Ready");
            chkP7Ready.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            chkP7Ready.AutoSize = true;
            chkP7Ready.Location = new Point(498, 183);
            chkP7Ready.Name = "chkP7Ready";
            panel1.Controls.Add(chkP7Ready);

            chkP8Ready = new UserCheckBox(cLabelColor, cAltUiColor, "Ready");
            chkP8Ready.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            chkP8Ready.AutoSize = true;
            chkP8Ready.Location = new Point(498, 209);
            chkP8Ready.Name = "chkP8Ready";
            panel1.Controls.Add(chkP8Ready);
        }