예제 #1
0
 /// <summary>
 /// Validate the Text using the Validator
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void textBoxText_Validating(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (Validator != null)
     {
         InputBoxValidatingArgs args = new InputBoxValidatingArgs();
         args.Text = textBoxText.Text;
         Validator(this, args);
         if (args.Cancel)
         {
             e.Cancel = true;
             errorProviderText.SetError(textBoxText, args.Message);
         }
     }
 }
예제 #2
0
        private void Validate_EditSection(object sender, InputBoxValidatingArgs e)
        {
            string text = e.Text;
            if (text.Length == 0)
            {
                e.Cancel = true;
                e.Message = "Section name is required";
                return;
            }

            byte[] bName = Encoding.Unicode.GetBytes(text);

            foreach (Section section in xsd[0].sectionCollection.Sections)
            {
                if (section.NameEqualsTo(bName))
                {
                    MessageBox.Show("Duplicate section name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            if (null != lstSection.SelectedItem)
            {
                Section section = (Section)lstSection.SelectedItem;
                section.Name = bName;
            }
            updateStatus();
        }
예제 #3
0
        private void Validate_AddSection(object sender, InputBoxValidatingArgs e)
        {
            string text = e.Text;
            if (text.Length == 0)
            {
                e.Cancel = true;
                e.Message = "Section name is required";
                return;
            }

            byte[] bName = Encoding.Unicode.GetBytes(text);

            if (xsd.Count < 1)
            {
                newXsd();
                setupGrid();
            }

            foreach (Section section in xsd[0].sectionCollection.Sections)
            {
                if (section.NameEqualsTo(bName))
                {
                    MessageBox.Show("Duplicate section name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            xsd[0].sectionCollection.Sections.Add(new Section(0, bName));
            updateStatus();
            lstSection.ClearSelected();
            lstSection.SelectedIndex = lstSection.Items.Count - 1;
            lstSection.Focus();

            dataSectionRows.DataSource = ((Section)lstSection.SelectedItem).XStrings.Rows;
        }
예제 #4
0
 /// <summary>
 /// Validate the Text using the Validator
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void textBoxText_Validating(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (Validator != null) {
         InputBoxValidatingArgs args = new InputBoxValidatingArgs();
         args.Text = textBoxText.Text;
         Validator(this, args);
         if (args.Cancel) {
             e.Cancel = true;
             errorProviderText.SetError(textBoxText, args.Message);
         }
     }
 }