예제 #1
0
        private void okButton_Click(object sender, EventArgs e)
        {
            bool checkNameCollision = editingMode == LabelEditMode.Add ?
                                      true :
                                      !nameBox.Text.Equals(editedLabel.Name, StringComparison.Ordinal);
            int    val = 0;
            Symbol sym = new Symbol()
            {
                Name = nameBox.Text
            };

            if (!Utility.IsWord(nameBox.Text))
            {
                Error.ShowErrorMessage(ErrorMessage.Label_InvalidName);
            }
            else if (checkNameCollision && labelContainer.IsSymbolDefined(sym))
            {
                Error.ShowErrorMessage(ErrorMessage.Label_NameAlreadyDefined);
            }
            else if (!Int32.TryParse(offsetBox.Text, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out val))
            {
                Error.ShowErrorMessage(ErrorMessage.Label_InvalidVariable);
            }
            else
            {
                if (editingMode == LabelEditMode.Edit)
                {
                    labelContainer.RemoveVarLabel(editedLabel);
                }
                editedLabel = new VarLabel(val, nameBox.Text, commentBox.Text);
                labelContainer.AddVarLabel(editedLabel);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
        }
예제 #2
0
 private void removeVariableToolStripMenuItem3_Click(object sender, EventArgs e)
 {
     labelContainer.RemoveVarLabel((VarLabel)varLabelBox.SelectedItem);
     UpdateVarBoxView();
 }