示例#1
0
        public ComboBox PopulateDropDownBox()
        {
            int fixedListMaxIndex = 4;

            if (_comboBoxTaskInput.Items.Count != 0)
            {
                for (int i = 0; i <= fixedListMaxIndex; i++)
                {
                    _comboBoxTaskInput.Items.RemoveAt(_comboBoxTaskInput.Items.Count - 1);
                }

                for (int i = 0; i <= fixedListMaxIndex; i++)
                {
                    _comboBoxTaskInput.Items.Add(DropDownListModel.GetItemAtIndex(fixedListMaxIndex - i));
                }
            }
            else
            {
                for (int i = 0; i <= fixedListMaxIndex; i++)
                {
                    _comboBoxTaskInput.Items.Add(DropDownListModel.GetItemAtIndex(fixedListMaxIndex - i));
                }
            }

            return(_comboBoxTaskInput);
        }
示例#2
0
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     if (_fileLoadPath != string.Empty && statusMsg.Text != "Invalid operation")
     {
         try
         {
             _excelController.AddNewEntryToWorkSheet(_fileLoadPath, _sheetDateTime, ComboBoxTaskInput.Text);
             DropDownListModel.AddToDropDownList(ComboBoxTaskInput.Text);
             statusMsg.Text   = string.Empty;
             this.WindowState = WindowState.Minimized;
         }
         catch
         {
             statusMsg.Foreground = System.Windows.Media.Brushes.Red;
             statusMsg.Text       = "Invalid operation";
         }
     }
 }