示例#1
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            if (Utils.IsValidIpAddress(Utils.ParseIPFromIPPort(txtBox_serverip.Text)) && Utils.IsValidPort(Utils.ParsePortFromIPPort(txtBox_serverip.Text)))
            {
                string defaultnick = txtBox_defaultnick.Text;
                if (String.IsNullOrWhiteSpace(txtBox_defaultnick.Text))
                {
                    defaultnick = ConfigFile.GetUserConfig("defaultnick");
                }

                if (!FavFile.AddServer(new Server(txtBox_serverip.Text, defaultnick), defaultnick))
                {
                    lbl_error.Text = "Something is broken (maybe you already have this server ?) !";
                    ShowErrorLabel(3000);
                }
                else
                {
                    FavFile.GenerateFavList();
                    FavFile.Save();
                    this.Close();
                }
            }
            else
            {
                lbl_error.Text = "Incorrect IP Format";
                ShowErrorLabel(3000);
            }
        }
示例#2
0
 private void toolStripBtn_deleteServer_Click(object sender, EventArgs e)
 {
     if (tabCtrl_serversLists.SelectedIndex == 0)
     {
         FavFile.DeleteServer(grid_serverList.GetSelectedServer());
         FavFile.Save();
     }
 }