Example #1
0
        private void okButton_Click(object sender, EventArgs e)
        {
            bool checkNameCollision = editingMode == LabelEditMode.Add ?
                                      true :
                                      !nameBox.Text.Equals(editedLabel.Name, StringComparison.Ordinal);
            int    off = -1;
            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 (!Utility.OffsetStringToInt(offsetBox.Text, out off))
            {
                Error.ShowErrorMessage(ErrorMessage.Label_InvalidOffset);
            }
            else
            {
                if (editingMode == LabelEditMode.Edit)
                {
                    labelContainer.RemoveFuncLabel(editedLabel);
                }
                editedLabel = new FunctionLabel(off, nameBox.Text, commentBox.Text);
                labelContainer.AddFuncLabel(editedLabel);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
        }
Example #2
0
 private void removeFuncLabelMenuItem_Click(object sender, EventArgs e)
 {
     labelContainer.RemoveFuncLabel((FunctionLabel)funcLabelBox.SelectedItem);
     UpdateFuncBoxView();
 }