Exemplo n.º 1
0
        public static int Process(Tag tag)
        {
            // Create the form.

            try
            {
                Form_CreateTag form = new Form_CreateTag(tag);

                if (form.ShowDialog() == DialogResult.OK)
                {
                    TagWorker.UpdateCreateTag(form.ServerTag);
                    return(TagWorker.GetTagByName(form.ServerTag.Name).Id);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error during tag edit\\create", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(-1);
        }
Exemplo n.º 2
0
        private void _button_OK_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            string tagName = _textBox_TagName.Text.Trim();

            if (string.IsNullOrEmpty(tagName))
            {
                MsgBox.ShowError(ErrorTitle, ErrorMessageTitle);
                DialogResult = DialogResult.None;

                Cursor = Cursors.Default;
                return;
            }
            var tag = TagWorker.GetTagByName(tagName);

            if (tag != null && !_isEdit)
            {
                MsgBox.ShowError(ErrorTitle, ErrorMessageExists);
                DialogResult = DialogResult.None;

                Cursor = Cursors.Default;
            }
        }