コード例 #1
0
        private void MetroCounterTextBox_Validating(object sender, CancelEventArgs e)
        {
            if (iradarform == null)
            {
                return;
            }
            string cnt = Text;

            radarForm = Activator.CreateInstance(iradarform, args) as IRadarForm;

            IRadarParameters iParam = radarForm.GetRadarParameters(cnt);

            if (!IsEmpty && !radarForm.Find(iParam))
            {
                if (EnableAddOnFly && radarForm.CanOpenNew)
                {
                    DialogResult result = MetroMessageBox.Show(GlobalInfo.MainForm, Properties.Resources.Msg_InsertNewCode,
                                                               Properties.Resources.Warning, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (result == DialogResult.Yes)
                    {
                        radarForm.OpenNew(iParam);
                        Focus();
                    }
                }
                else if (MustExistData)
                {
                    MessageBox.Show(GlobalInfo.MainForm, Properties.Resources.Msg_CodeNotFound,
                                    Properties.Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Focus();
                }
                e.Cancel = MustExistData;
            }
            else
            {
                if (cnt == string.Empty)
                {
                    Description = string.Empty;
                    return;
                }
            }
            Description = radarForm.Description;
        }
コード例 #2
0
        public void UpdateDescription()
        {
            if (DescriptionControl == null)
            {
                return;
            }

            if (iradarform != null)
            {
                radarForm = Activator.CreateInstance(iradarform, args) as IRadarForm;
            }

            IRadarParameters iParam = radarForm.GetRadarParameters(Text);

            DescriptionControl.Text = (Text != string.Empty && radarForm.Find(iParam))
                                        ? radarForm.Description
                                        : string.Empty;

            radarForm.Dispose();
        }