Exemplo n.º 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();
        }
Exemplo n.º 2
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();
        }