Esempio n. 1
0
        public void SetupStartPage()
        {
            uscStartPage startPage = new uscStartPage(this.m_paProcon);

            startPage.ConnectionPage += new uscStartPage.ConnectionPageHandler(startPage_ConnectionPage);

            this.pnlWindows.Controls.Add(startPage);
            startPage.Dock = DockStyle.Fill;
            this.m_dicPages.Add("Start Page", startPage);
            this.cboServerList.ComboBox.Items.Insert(0, startPage);
            this.cboServerList.SelectedItem = startPage;
        }
Esempio n. 2
0
        private void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index != -1)
            {
                e.DrawBackground();
                e.DrawFocusRectangle();

                if (this.cboServerList.ComboBox.Items[e.Index] is uscServerConnection)
                {
                    uscServerConnection drawItem = ((uscServerConnection)this.cboServerList.ComboBox.Items[e.Index]);

                    if (drawItem.Client.CurrentServerInfo != null)
                    {
                        if (drawItem.Client.State == ConnectionState.Connected && drawItem.Client.IsLoggedIn == true)
                        {
                            e.Graphics.DrawImage(this.iglIcons.Images["tick-button.png"], e.Bounds.Left + 57, e.Bounds.Top + 1, this.iglIcons.ImageSize.Width, this.iglIcons.ImageSize.Height);
                        }
                        else if (drawItem.Client.State == ConnectionState.Error)
                        {
                            e.Graphics.DrawImage(this.iglIcons.Images["cross-button.png"], e.Bounds.Left + 57, e.Bounds.Top + 1, this.iglIcons.ImageSize.Width, this.iglIcons.ImageSize.Height);
                        }
                        else
                        {
                            e.Graphics.DrawImage(this.iglIcons.Images["exclamation-button.png"], e.Bounds.Left + 57, e.Bounds.Top + 1, this.iglIcons.ImageSize.Width, this.iglIcons.ImageSize.Height);
                        }

                        e.Graphics.DrawString(String.Format("[{0}/{1}] {2} [{3}]", drawItem.Client.CurrentServerInfo.PlayerCount, drawItem.Client.CurrentServerInfo.MaxPlayerCount, drawItem.Client.CurrentServerInfo.ServerName, drawItem.Client.HostNamePort), this.cboServerList.Font, SystemBrushes.WindowText, e.Bounds.Left + 75, e.Bounds.Top);

                        if (drawItem.Client.Game != null)
                        {
                            if (drawItem.Client.CurrentServerInfo.GameMod == GameMods.None)
                            {
                                e.Graphics.DrawImage(this.iglGameIcons.Images[String.Format("{0}.png", drawItem.Client.Game.GameType).ToLower()], e.Bounds.Left + 2, e.Bounds.Top + 1, this.iglGameIcons.ImageSize.Width, this.iglGameIcons.ImageSize.Height);
                            }
                            else
                            {
                                e.Graphics.DrawImage(this.iglGameIcons.Images[String.Format("{0}.{1}.png", drawItem.Client.Game.GameType, drawItem.Client.CurrentServerInfo.GameMod).ToLower()], e.Bounds.Left + 2, e.Bounds.Top + 1, this.iglGameIcons.ImageSize.Width, this.iglGameIcons.ImageSize.Height);
                            }
                        }
                    }
                    else
                    {
                        if (drawItem.Client.State == ConnectionState.Connected && drawItem.Client.IsLoggedIn == true)
                        {
                            e.Graphics.DrawImage(this.iglIcons.Images["tick-button.png"], e.Bounds.Left + 2, e.Bounds.Top + 1, this.iglIcons.ImageSize.Width, this.iglIcons.ImageSize.Height);
                        }
                        else if (drawItem.Client.State == ConnectionState.Error)
                        {
                            e.Graphics.DrawImage(this.iglIcons.Images["cross-button.png"], e.Bounds.Left + 2, e.Bounds.Top + 1, this.iglIcons.ImageSize.Width, this.iglIcons.ImageSize.Height);
                        }
                        else
                        {
                            e.Graphics.DrawImage(this.iglIcons.Images["exclamation-button.png"], e.Bounds.Left + 2, e.Bounds.Top + 1, this.iglIcons.ImageSize.Width, this.iglIcons.ImageSize.Height);
                        }

                        e.Graphics.DrawString(drawItem.Client.HostNamePort, this.cboServerList.Font, SystemBrushes.WindowText, e.Bounds.Left + 21, e.Bounds.Top);
                    }
                }
                else if (this.cboServerList.ComboBox.Items[e.Index] is uscStartPage)
                {
                    uscStartPage drawItem = ((uscStartPage)this.cboServerList.ComboBox.Items[e.Index]);

                    e.Graphics.DrawImage(this.iglIcons.Images["home.png"], e.Bounds.Left + 2, e.Bounds.Top + 1, this.iglIcons.ImageSize.Width, this.iglIcons.ImageSize.Height);

                    if (this.m_clocLanguage == null)
                    {
                        e.Graphics.DrawString("Start Page", this.cboServerList.Font, SystemBrushes.WindowText, e.Bounds.Left + 21, e.Bounds.Top);
                    }
                    else
                    {
                        e.Graphics.DrawString(this.m_clocLanguage.GetLocalized("uscStartPage.Title"), this.cboServerList.Font, SystemBrushes.WindowText, e.Bounds.Left + 21, e.Bounds.Top);
                    }
                }

                e.Graphics.Dispose();
            }
        }