private void ParseEmployee(bool skip)
        {
            string txt = textEmp.Text.Trim();

            Employee[] emps = parser.Parse(ref txt);
            if ((emps.Length == 1) && (textEmp.Text != txt))
            {
                textEmp.Text = txt;
                textEmp.EnableForInput();
                textEmp.SelectAll();
            }
            else
            {
                for (int i = 0; i < emps.Length; i++)
                {
                    textEmp.Text =
                        textEmp.Text.Replace(
                            (Environment.CurCultureInfo.TwoLetterISOLanguageName.Equals("ru")
                                                                 ? emps[i].ShortName
                                                                 : emps[i].ShortEngName), "").Trim(new[] { ' ', ',', ';' });
                }
            }

            if (!skip)
            {
                comboBoxEmp.DroppedDown = false;
            }
            if (parser.CandidateCount == 0)
            {
                buttonSelect.Text = label + "...";
            }
            else if (parser.CandidateCount == 1)
            {
                buttonSelect.Text = singleLabel;
            }
            else
            {
                buttonSelect.Text = label + "..." + parser.CandidateCount;
                if (parser.CandidateCount < 9)
                {
                    ShowEmployees(parser.CandidateEmployees);
                    var findForm = FindForm();
                    if (findForm != null)
                    {
                        findForm.Cursor = Cursors.Default;
                    }
                }
                else
                {
                    ShowEmployees(null);
                }
            }

            if (parser.SplitToBits(textEmp.Text.Trim()).Length > 1)
            {
                textEmp.SelectAll();
            }

            ThrowEvent(emps);
        }
예제 #2
0
        private void OnValueTextBoxKeyDown(object sender, KeyRoutedEventArgs e)
#endif
        {
#if MIGRATION
            if (e.Key == Key.Enter)
#else
            if (e.Key == VirtualKey.Enter)
#endif
            {
                if (this.UpdateValueFromText())
                {
                    this.UpdateValueText();
                    _valueTextBox.SelectAll();
                    e.Handled = true;
                }
            }
        }