示例#1
0
        private void wieldEffectValue_SelectedIndexChanged(object sender, EventArgs e)
        {
            AffectedForm affectedForm = null;

            if (wieldEffectValue.SelectedItem == "New...")
            {
                affectedForm = new AffectedForm();
            }
            else if (wieldEffectValue.SelectedItem != null)
            {
                affectedForm = new AffectedForm(_wieldAffects[wieldEffectValue.SelectedIndex - 1].AsBsonDocument);
            }
            else
            {
                return;
            }

            affectedForm.ShowDialog();

            if (affectedForm.DialogResult == DialogResult.OK)
            {
                if (affectedForm.attribute != null)
                {
                    _wieldAffects.Add(affectedForm.attribute);
                    wieldEffectValue.Items.Add(affectedForm.attribute["k"].AsString + " (" + affectedForm.attribute["v"].AsDouble.ToString() + ")");
                }
            }
            else if (affectedForm.DialogResult == DialogResult.Abort)
            {
                _wieldAffects.RemoveAt(wieldEffectValue.SelectedIndex - 1);
                wieldEffectValue.Items.RemoveAt(wieldEffectValue.SelectedIndex);
            }
            else if (affectedForm.DialogResult == DialogResult.Cancel)
            {
                //user cancelled do nothing
            }

            affectedForm.Close();
        }
示例#2
0
文件: ItemsTab.cs 项目: vadian/Novus
        private void wieldEffectValue_SelectedIndexChanged(object sender, EventArgs e)
        {
            AffectedForm affectedForm = null;
            if (wieldEffectValue.SelectedItem == "New...") {
                affectedForm = new AffectedForm();
            }
            else if (wieldEffectValue.SelectedItem != null) {
                affectedForm = new AffectedForm(_wieldAffects[wieldEffectValue.SelectedIndex - 1].AsBsonDocument);
            }
            else {
                return;
            }

            affectedForm.ShowDialog();

            if (affectedForm.DialogResult == DialogResult.OK) {
                if (affectedForm.attribute != null) {
                    _wieldAffects.Add(affectedForm.attribute);
                    wieldEffectValue.Items.Add(affectedForm.attribute["k"].AsString + " (" + affectedForm.attribute["v"].AsDouble.ToString() + ")");
                }
            }
            else if (affectedForm.DialogResult == DialogResult.Abort) {
                _wieldAffects.RemoveAt(wieldEffectValue.SelectedIndex - 1);
                wieldEffectValue.Items.RemoveAt(wieldEffectValue.SelectedIndex);
            }
            else if (affectedForm.DialogResult == DialogResult.Cancel) {
                //user cancelled do nothing
            }

            affectedForm.Close();
        }