示例#1
0
 public void FocusTitle()
 {
     if (!TitleTextBox.IsReadOnly)
     {
         TitleTextBox.Focus();
     }
 }
示例#2
0
        /// <summary>
        /// Checks if the scenario details need saving or not
        /// </summary>
        /// <returns></returns>
        public bool NeedSave()
        {
            BindingExpression be = TitleTextBox.GetBindingExpression(TextBox.TextProperty);

            if (be != null && be.IsDirty)
            {
                return(true);
            }
            be = AuthorTextbox.GetBindingExpression(TextBox.TextProperty);
            if (be != null && be.IsDirty)
            {
                return(true);
            }
            be = DescriptionTextBox.GetBindingExpression(TextBox.TextProperty);
            if (be != null && be.IsDirty)
            {
                return(true);
            }
            be = CreateDatePicker.GetBindingExpression(DatePicker.SelectedDateProperty);
            if (be != null && be.IsDirty)
            {
                return(true);
            }
            be = RatingTextBox.GetBindingExpression(TextBox.TextProperty);
            if (be != null && be.IsDirty)
            {
                return(true);
            }
            return(false);
        }
示例#3
0
        /// <summary>
        /// Updates the Targets of every field. This is done when changes get discarded. So the values get overridden with the values in the source of the binding
        /// </summary>
        private void UpdateTargets()
        {
            BindingExpression be = TitleTextBox.GetBindingExpression(TextBox.TextProperty);

            if (be != null)
            {
                be.UpdateTarget();
            }
            be = AuthorTextbox.GetBindingExpression(TextBox.TextProperty);
            if (be != null)
            {
                be.UpdateTarget();
            }
            be = DescriptionTextBox.GetBindingExpression(TextBox.TextProperty);
            if (be != null)
            {
                be.UpdateTarget();
            }
            be = CreateDatePicker.GetBindingExpression(DatePicker.SelectedDateProperty);
            if (be != null)
            {
                be.UpdateTarget();
            }
            be = RatingTextBox.GetBindingExpression(TextBox.TextProperty);
            if (be != null)
            {
                be.UpdateTarget();
            }
        }
示例#4
0
        /// <summary>
        /// Updates the changes in the scenario values into the datamodel. Occurs when the save button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveDataButton_OnClickDataButton_Click(object sender, RoutedEventArgs e)
        {
            BindingExpression be = TitleTextBox.GetBindingExpression(TextBox.TextProperty);

            if (be != null)
            {
                be.UpdateSource();
            }
            be = AuthorTextbox.GetBindingExpression(TextBox.TextProperty);
            if (be != null)
            {
                be.UpdateSource();
            }
            be = DescriptionTextBox.GetBindingExpression(TextBox.TextProperty);
            if (be != null)
            {
                be.UpdateSource();
            }
            be = CreateDatePicker.GetBindingExpression(DatePicker.SelectedDateProperty);
            if (be != null)
            {
                be.UpdateSource();
            }
            be = RatingTextBox.GetBindingExpression(TextBox.TextProperty);
            if (be != null)
            {
                be.UpdateSource();
            }
            WorkbookModel workbook = new WorkbookModel(Globals.ThisAddIn.Application.ActiveWorkbook);

            workbook.ShouldScanAfterSave = false;
            Globals.ThisAddIn.Application.ActiveWorkbook.Save();
            workbook.ShouldScanAfterSave = true;
        }
示例#5
0
 // new book button clicked
 private void NewBookButton_Click(object sender, EventArgs e)
 {
     addNewBookMode       = true;
     updateBookMode       = false;
     ISBNTextBox.ReadOnly = false;
     if (TitleTextBox.Text != "" || AuthorTextBox.Text != "" ||
         ISBNTextBox.Text != "" || PriceTextBox.Text != "")
     {
         DialogResult response = MessageBox.Show("Are you sure you want to discard all the changes?", "Discard Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (response == DialogResult.Yes)
         {
             ResetAll();
             TitleTextBox.Focus();
             BooksComboBox.Enabled = false;
         }
     }
     else
     {
         ResetAll();
         TitleTextBox.Focus();
         BooksComboBox.Enabled = false;
     }
     EnableTextBoxes(true);
     BookCancelButton.Enabled = true;
 }
示例#6
0
 public CreateNoteDialog()
 {
     InitializeComponent();
     TitleTextBox.Text = "Note title";
     TitleTextBox.SelectAll();
     TitleTextBox.Focus();
 }
示例#7
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            notesTable.Rows.Add(TitleTextBox.Text, BodyTextBox.Text);

            TitleTextBox.Clear();
            BodyTextBox.Clear();
        }
示例#8
0
        private void SetBindings()
        {
            var todo = new ToDoItemViewModel
            {
                Title    = "I must learn to type",
                Priority = 3
            };

            var titleBinding = new Binding("Title")
            {
                Source = todo
            };

            TitleTextBox.SetBinding(TextBox.TextProperty, titleBinding);

            var priorityBinding = new Binding("Priority")
            {
                Source = todo
            };

            PrioritySlider.SetBinding(Slider.ValueProperty, priorityBinding);

            var blockBinding = new Binding("PriorityAsString")
            {
                Source = todo
            };

            PriorityBlock.SetBinding(TextBlock.TextProperty, blockBinding);
        }
示例#9
0
        /// <summary>
        ///  Add a TodoItem
        /// </summary>
        private void AddTodoButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                _NewTodo.CreationDate = DateTime.Today;
                _NewTodo.Description  = DescriptionTextBox.Text;
                _NewTodo.DueDate      = DueDatePicker.SelectedDate.GetValueOrDefault(DateTime.Today);
                _NewTodo.Title        = TitleTextBox.Text;
                _NewTodo.Priority     = (PriorityFlag)PriorityComboBox.SelectedItem;

                _NewTodo.ID = _Proxy.CreateItem(_NewTodo);

                _NewTodo.PropertyChanged += Item_PropertyChanged;
                _TodoItems.Add(_NewTodo);

                _NewTodo = new TodoItem {
                    Priority = PriorityFlag.Normal, DueDate = DateTime.Today
                };
                NewItemPanel.DataContext = _NewTodo;


                TitleTextBox.Focus();
            }
            catch (Exception ex)
            {
                DescriptionTextBox.Text = _NewTodo.Description;
                TitleTextBox.Text       = _NewTodo.Title;
                MessageBox.Show(ex.Message);
            }
        }
示例#10
0
        private void NewIssue_CheckedChanged(object sender, EventArgs e)
        {
            if (NewIssue.IsChecked.Value)
            {
                ProjectControls.Visibility     = Visibility.Visible;
                SummaryControls.Visibility     = Visibility.Visible;
                DescriptionControls.Visibility = Visibility.Visible;
                IssueTypeControls.Visibility   = Visibility.Visible;
                IssueIDControls.Visibility     = Visibility.Collapsed;

                TitleTextBox.SelectAll();
                TitleTextBox.Focus();
            }
            else
            {
                ProjectControls.Visibility     = Visibility.Collapsed;
                SummaryControls.Visibility     = Visibility.Collapsed;
                DescriptionControls.Visibility = Visibility.Collapsed;
                IssueTypeControls.Visibility   = Visibility.Collapsed;
                IssueIDControls.Visibility     = Visibility.Visible;

                IssueIDTextBox.SelectAll();
                IssueIDTextBox.Focus();
            }

            ValidateData(null, null);
        }
        private bool ValidateForm()
        {
            if (!Regex.Match(TitleTextBox.Text, @"^\D{1,50}$").Success)
            {
                MessageBox.Show("Title must consist of at least 1 character and not exceed 50 characters!");
                TitleTextBox.Focus();
                return(false);
            }

            if (!Regex.Match(ContactTextBox.Text, @"^\D{1,50}$").Success)
            {
                MessageBox.Show("Contact person must consist of at least 1 character and not exceed 50 characters!");
                ContactTextBox.Focus();
                return(false);
            }

            if (!Regex.Match(PhoneTextBox.Text, @"^\d{10}$").Success)
            {
                MessageBox.Show("Phone number must consist of 10 digits!");
                PhoneTextBox.Focus();
                return(false);
            }

            if (!Regex.Match(AddressTextBox.Text, @"^(Вул\.\s\D{1,40}\,\s\d{1,3})$").Success)
            {
                MessageBox.Show("Address must consist of at least 1 character and not exceed 50 characters!");
                AddressTextBox.Focus();
                return(false);
            }

            return(true);
        }
示例#12
0
 private void ClearForm()
 {
     TitleTextBox.Clear();
     FileNameTextBox.Clear();
     AuthorTextBox.Clear();
     AlbumTextBox.Clear();
 }
示例#13
0
        private void Send()
        {
            StatusBand.Hide();

            #region Validation

            if (TitleTextBox.Text.Length == 0)
            {
                StatusBand.Warning(FindResource("S.Feedback.Warning.Title") as string);
                TitleTextBox.Focus();
                return;
            }

            if (MessageTextBox.Text.Length == 0)
            {
                StatusBand.Warning(FindResource("S.Feedback.Warning.Message") as string);
                MessageTextBox.Focus();
                return;
            }

            #endregion

            StatusBand.Info(FindResource("S.Feedback.Sending").ToString());

            Cursor             = Cursors.AppStarting;
            MainGrid.IsEnabled = false;
            MainGrid.UpdateLayout();

            Persist();

            Cursor             = Cursors.Arrow;
            MainGrid.IsEnabled = true;
        }
示例#14
0
        /// <summary>
        ///     Obsługuje naciśnięcie klawisza na TitleTextBoxie. Po wciśnięciu ENTER otwiera okno wyboru:
        ///         1. dla dopisywania i usuwania wyświetla czasopisma z kartami akcesji
        ///         2. dla zakładania karty wyświetla czasopisma bez kartami akcesji
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TitleTextBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (Mode.ToLower().Trim() == "dopisz" || Mode.ToLower().Trim() == "usun")
                {
                    /*string Query = " SELECT akcesja.kod AS [id],czasop.kod AS [id2], LTRIM(RTRIM(akcesja.tytul)) AS [Tytuł akcesji], LTRIM(RTRIM(akc_syg.syg)) AS [Sygnatura], LTRIM(RTRIM(akcesja.nazwa_inst)) AS [Instytucja sprawcza], LTRIM(RTRIM(akcesja.siedziba)) AS [Siedziba], akcesja.id_kolport, akcesja.id_czest, akcesja.id_akces, akcesja.uwagi, LTRIM(RTRIM(kolport.nazwa_k)) AS [Dostawca] FROM akcesja " +
                     *             " LEFT JOIN czasop ON czasop.kod = akcesja.nr_czasop " +
                     *             " LEFT JOIN kolport ON kolport.id_kolport = akcesja.id_kolport " +
                     *             " LEFT JOIN akc_syg ON akc_syg.kod = akcesja.kod ORDER BY [Tytuł akcesji], [Sygnatura]";
                     *
                     * ShowList(Query, TitleTextBox.Text.Trim(), "dopisz", false, this.MdiParent);*/

                    ShowListWithAkcesja(false);
                }
                else
                {
                    /*string Query = " SELECT czasop.kod AS [id2], LTRIM(RTRIM(czasop.tytul)) AS [Tytuł czasopisma], LTRIM(RTRIM(cza_syg.syg)) AS [Sygnatura], LTRIM(RTRIM(nazwa_inst)) AS [Instytucja sprawcza], LTRIM(RTRIM(siedziba)) AS [Siedziba], " +
                     *             " id_czest, LTRIM(RTRIM(kolport.nazwa_k)) AS [Dostawca], '' AS uwagi, czasop.id_kolport FROM czasop " +
                     *             " LEFT JOIN cza_syg ON czasop.kod = cza_syg.kod " +
                     *             " LEFT JOIN kolport ON kolport.id_kolport = czasop.id_kolport " +
                     *             " WHERE (czasop.kod NOT IN (SELECT nr_czasop FROM akcesja) AND id_rodzaj = ?) ORDER BY [Tytuł czasopisma], [Sygnatura]";
                     *
                     *
                     * ShowList(Query, TitleTextBox.Text.Trim(), "nowa_karta", false, this.MdiParent);*/

                    ShowMagazinesList(false);
                }

                TitleTextBox.Text = TitleTextBox.Text.Trim();
                TitleTextBox.Focus();
                TitleTextBox.Select(TitleTextBox.Text.Length, 0);
            }
        }
        private void NewItem_CheckedChanged(object sender, EventArgs e)
        {
            if (NewItem.IsChecked.Value)
            {
                ItemTypeControls.Visibility    = Visibility.Visible;
                TitleControls.Visibility       = Visibility.Visible;
                DescriptionControls.Visibility = Visibility.Visible;
                ItemIDControls.Visibility      = Visibility.Collapsed;

                TitleTextBox.SelectAll();
                TitleTextBox.Focus();
            }
            else
            {
                ItemTypeControls.Visibility    = Visibility.Collapsed;
                TitleControls.Visibility       = Visibility.Collapsed;
                DescriptionControls.Visibility = Visibility.Collapsed;
                ItemIDControls.Visibility      = Visibility.Visible;

                ItemIDTextBox.SelectAll();
                ItemIDTextBox.Focus();
            }

            ValidateData(null, null);
        }
示例#16
0
 private void Clear()
 {
     TitleTextBox.ResetText();
     AuthorTextBox.ResetText();
     Author2TextBox.ResetText();
     Author3TextBox.ResetText();
     tKodK.ResetText();
 }
示例#17
0
 private void ApplicationPropertiesDialog_Loaded(object sender, RoutedEventArgs e)
 {
     if (ViewerApplicationControl.Instance != null)
     {
         DataContext = ViewerApplicationControl.Instance.ViewerApplication;
     }
     TitleTextBox.Focus();
 }
示例#18
0
 protected override async Task OnFirstLoad()
 {
     if (NoteId == null)
     {
         TitleTextBox.Focus(FocusState.Programmatic);
     }
     await VM.Load(NoteId);
 }
示例#19
0
 private void ДобавитьИзменитьТовар_Load(object sender, EventArgs e)
 {
     TitleTextBox.Focus();
     this.жанрыTableAdapter.Fill(this.bookWorldDataSet.Жанры);
     this.тип_ТовараTableAdapter.Fill(this.bookWorldDataSet.Тип_Товара);
     TypeComboBox.Text  = "";
     GenreComboBox.Text = "";
 }
示例#20
0
        protected override void Execute(CodeActivityContext context)
        {
            try
            {
                string   _title       = TitleTextBox.Get(context);
                string   _textValue   = LabelTextBox.Get(context);
                string[] _listItem    = OptionsTextBox.Get(context);
                string   _resultValue = null;
                latch = new CountdownEvent(1);
                Thread td = new Thread(() =>
                {
                    DialogActivity.Windows.InputDialogWindow dlg = new DialogActivity.Windows.InputDialogWindow();

                    if (_title != null)
                    {
                        dlg.Title = _title;
                    }

                    if (_textValue != null)
                    {
                        dlg.setTextContent(_textValue);
                    }

                    if (_listItem != null)
                    {
                        if (_listItem.Length <= 1)
                        {
                            dlg.CreateEditBox(IsPassword);
                        }
                        else if (_listItem.Length > 1 && _listItem.Length < 4)
                        {
                            dlg.CreateCheckBox(_listItem);
                        }
                        else
                        {
                            dlg.CreateCombobox(_listItem);
                        }
                    }
                    else
                    {
                        dlg.CreateEditBox(IsPassword);
                    }
                    dlg.ShowDialog();
                    _resultValue = dlg.getValue();
                    dlg.Close();
                    refreshData(latch);
                });
                td.TrySetApartmentState(ApartmentState.STA);
                td.IsBackground = true;
                td.Start();
                latch.Wait();
                Result.Set(context, _resultValue);
            }
            catch (Exception e)
            {
                SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", e.Message);
            }
        }
示例#21
0
        private void ClearForm()
        {
            TitleTextBox.Clear();
            StartBidTextBox.Clear();
            MinStepTextBox.Clear();
            ProductComboBox.SelectedItem = null;

            EditLot.IsEnabled = false;
        }
示例#22
0
 public void SimulateUserInteraction()
 {
     ArticlesListBox.SetSelection("Article 1");
     TitleTextBox.SetContent("");
     ArticlesListBox.SetSelection("Article 2");
     //SaveButton.SetEnabled(false);
     Console.WriteLine("TextBox: " + TitleTextBox.Content);
     Console.WriteLine("Button: " + SaveButton.IsEnabled);
 }
示例#23
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            new LogController().AddLogEntry(TitleTextBox.Text, DateTimePicker.Value, StartTimeTimePicker.Value, EndTimeTimePicker.Value, HoursWorkedTimePicker.Value, DescriptionTextBox.Text, AuthorTextBox.Text);

            TitleTextBox.Clear();
            DescriptionTextBox.Clear();
            AuthorTextBox.Clear();
            MessageBox.Show("New log entry added!", "Log added!");
        }
示例#24
0
 private void ProductsGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     currentProduct           = (Product)e.AddedItems[0];
     TitleTextBox.DataContext = currentProduct.ProductDescriptors[0];
     TitleTextBox.SetBinding(TextBox.TextProperty, "Title");
     BodyTextBox.DataContext = currentProduct.ProductDescriptors[0];
     BodyTextBox.SetBinding(TextBox.TextProperty, "Body");
     relateds = WrapRelateds(currentProduct, from p in catalog.Products select p);
     RelatedGrid.ItemsSource = relateds;
 }
 /// <summary>
 /// Clears fields and sets necessary fields to prepare for
 /// save.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NewBookButton_Click(object sender, EventArgs e)
 {
     AuthorTextBox.Clear();
     TitleTextBox.Clear();
     ISBNTextBox.Clear();
     PriceTextBox.Clear();
     BookSelectBox.Enabled = false;
     SaveButton.Enabled    = true;
     CancelButton.Enabled  = true;
 }
示例#26
0
        public void AddShareSkillDetails(ShareSkillDetails skillObj)
        {
            //Enter Title data from Excel
            driver.WaitForElementIsVisible(TitleTextBox);
            TitleTextBox.SendKeys(skillObj.Title);

            //Enter Description data from Excel
            DescriptionTextBox.SendKeys(skillObj.Description);

            //Select Category based on Excel data
            driver.WaitForElementIsVisible(CategoryDropDown);
            SelectElement categorySelect = new SelectElement(CategoryDropDown);

            categorySelect.SelectByText(skillObj.Category);

            //Select Subcategory based on Excel data
            SelectElement subCategorySelect = new SelectElement(SubCategoryDropDown);

            subCategorySelect.SelectByText(skillObj.SubCategory);

            //Enter Text in Tag and perform keyboard action "Enter"
            TagTextBox.SendKeys(skillObj.Tags + Keys.Enter);

            //Select Service Type based on Excel data
            SelectRadioButton(ServiceType, ServiceTypeLabel, skillObj.ServiceType);

            //Select Location Type based on Excel data
            SelectRadioButton(LocationType, LocationTypeLabel, skillObj.LocationType);

            //Enter Startdate based on Excel data
            StartDate.SendKeys(skillObj.StartDate);

            //Enter Enddate based on Excel data
            EndDate.SendKeys(skillObj.EndDate);

            //Select days based on excel data and enter start and end time
            SelectAvailableDays(skillObj.SelectDay, skillObj.StartTime, skillObj.EndTime);

            //Select SkillTrade based on Excel data
            SelectRadioButton(SkillTrade, SkillTradeLabel, skillObj.SkillTrade);

            //Enter Text in Tag and perform keyboard action "Enter"
            SkillExchange.SendKeys(skillObj.SkillExchange + Keys.Enter);

            //Click WorkSample and upload the file through AutoIT
            driver.WaitForElementIsVisible(WorkSamples);
            WorkSamples.Click();
            UploadFileByAutoIT();

            //Select Active/Hidden based on Excel data
            SelectRadioButton(Active, ActiveLabel, skillObj.Active);

            //Save ShareSkill data
            SaveButton.Click();
        }
示例#27
0
        private void RestoreDefaultValues()
        {
            TitleTextBox.Clear();
            DescriptionTextBox.Clear();
            StartDatePicker.Value = _dateTimeProvider.Today;
            DueDatePicker.Value   = _dateTimeProvider.Today;

            StatusBox.SelectedIndex   = 0;
            PriorityBox.SelectedIndex = 0;
            UsersBox.SelectedIndex    = 0;
        }
        private bool ValidateForm()
        {
            if (!Regex.Match(TitleTextBox.Text, @"^\D{1,50}$").Success)
            {
                MessageBox.Show("Country title must consist of at least 1 character and not exceed 50 characters!");
                TitleTextBox.Focus();
                return(false);
            }

            return(true);
        }
示例#29
0
        private bool Correct()
        {
            try
            {
                _note.Name = TitleTextBox.Text;
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message, "Note Add Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                TitleTextBox.Focus();
                return(false);
            }

            //NoteCategory
            _note.NoteCategory = (NoteCategory)CategoryComboBox.SelectedItem;

            try
            {
                _note.Text = NoteTextBox.Text;
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message, "Note Add Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                TitleTextBox.Focus();
                return(false);
            }

            try
            {
                _note.LastEditDate = ModifiedDatePicker.Value;
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message, "Note Add Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                TitleTextBox.Focus();
                return(false);
            }
            catch (FormatException e)
            {
                MessageBox.Show(e.Message, "Note Add Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                TitleTextBox.Focus();
                return(false);
            }
            _note.CreationDate = CreationDatePicker.Value;


            return(true);
        }
示例#30
0
        private void ClearButton_Click(object sender, EventArgs e)
        {
            //Clear Textboxes
            TitleTextBox.Clear();
            PriceTextBox.Clear();
            ExtendedPriceTextBox.Clear();
            DiscountedPriceTextBox.Clear();
            DiscountTextBox.Clear();
            QuantityTextBox.Clear();

            //Set focus on Quantity
            QuantityTextBox.Focus();
        }