Пример #1
0
 private void addRealmbutton_Click(object sender, EventArgs e)
 {
     RealmDialog dialog = new RealmDialog(newRealmAddressLabel.Text, "");
     if (dialog.ShowDialog(this) == DialogResult.OK)
     {
         RealmList.AddRealm(dialog.RealmName, dialog.RealmAddress);
         realmListComboBox.SelectedIndex = realmListComboBox.Items.Add(dialog.RealmName);
         checkListsEmpty();
         newRealmAddressLabel.Text = "";
         addRealmbutton.Visible = false;
         addStatusMessage("Realmlist added.");
     }
 }
Пример #2
0
        private void modifyRealmButton_Click(object sender, EventArgs e)
        {
            String realmName = realmListComboBox.Text;
            String realmAddress = RealmList.GetRealmAddress(realmName);

            RealmDialog dialog = new RealmDialog(realmAddress, realmName);
            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                if (realmAddress != dialog.RealmAddress)
                {
                    RealmList.ModifyRealmAddress(realmName, dialog.RealmAddress);
                    selectedRealmAddressLabel.Text = dialog.RealmAddress;
                    checkNewRealmAddress();
                }
                if (realmName != dialog.RealmName)
                {
                    RealmList.ModifyRealmName(realmName, dialog.RealmName);

                    var i = 0;
                    foreach (String s in realmListComboBox.Items)
                    {
                        if (s == realmName)
                            break;
                        ++i;
                    }
                    realmListComboBox.Items.Remove(realmName);
                    realmListComboBox.SelectedIndex = realmListComboBox.Items.Add(dialog.RealmName);
                }
                addStatusMessage("Realmlist modified.");
            }
            checkListsEmpty();
        }