コード例 #1
0
ファイル: frmMain.cs プロジェクト: YugoAmr/Procon-1
        private void m_frmConfirmation_ConfirmationSuccess()
        {
            if (this.cboServerList.SelectedItem != null)
            {
                uscServerConnection selectedServer = (uscServerConnection)this.cboServerList.SelectedItem;

                string strConfigFile = String.Format("{0}.cfg", selectedServer.Client.FileHostNamePort);

                selectedServer.Hide();

                // Find another panel to show while we remove this server.
                foreach (KeyValuePair <string, uscPage> kvpPanel in this.m_dicPages)
                {
                    if (kvpPanel.Value != selectedServer)
                    {
                        this.cboServerList.SelectedItem = kvpPanel.Value;
                        break;
                    }
                }

                //this.m_dicConnectionPages[strServerHostnamePort].BFBC2Connection.Destroying();
                if (this.cboServerList.ComboBox.Items.Contains(selectedServer) == true)
                {
                    this.cboServerList.ComboBox.Items.Remove(selectedServer);
                }

                this.m_paProcon.Connections.Remove(selectedServer.Client);
                selectedServer.Dispose();

                this.m_dicPages.Remove(selectedServer.Client.HostNamePort);
                //this.uscServerPlayerTreeviewListing.OnServerDeleted(strServerHostnamePort);

                try
                {
                    if (File.Exists(Path.Combine("Configs", strConfigFile)) == true)
                    {
                        File.Delete(Path.Combine("Configs", strConfigFile));
                    }
                }
                catch (Exception) { }
            }
        }