/// <summary> /// Fill dropdown lists /// </summary> private void FillForm() { ViewComboBox.Items.Add(new RadComboBoxItem(LocalizeString("NoneSelectedText"), string.Empty)); ViewComboBox.AppendDataBoundItems = true; ViewComboBox.DataSource = DnnPathHelper.GetViewNames("Category"); ViewComboBox.DataBind(); var allCats = HccApp.CatalogServices.Categories.FindAllSnapshotsPaged(1, 5000); var categories = CategoriesHelper.ListFullTreeWithIndentsForComboBox(allCats, false); CategoryComboBox.Items.Add(new RadComboBoxItem(LocalizeString("NoneSelectedText"), string.Empty)); CategoryComboBox.AppendDataBoundItems = true; CategoryComboBox.DataSource = categories; CategoryComboBox.DataTextField = "Text"; CategoryComboBox.DataValueField = "Value"; CategoryComboBox.DataBind(); var columns = HccApp.ContentServices.Columns.FindAll(); FillComboBox(ddlPreContentColumnId, columns, "DisplayName", "Bvin", Convert.ToString(ModuleSettings["DefaultPreContentColumnId"])); FillComboBox(ddlPostContentColumnId, columns, "DisplayName", "Bvin", Convert.ToString(ModuleSettings["DefaultPostContentColumnId"])); FillSortingCheckboxList(); }
private void AddDataItem_Click(object sender, RoutedEventArgs e) { ItemController CallItem = new ItemController(); //var combo = CategoryComboBox.SelectedValue.ToString(); //MessageBox.Show(CategoryComboBox.Text); if (ItemNameTextBox.Text.Length == 0 && QuantityTextBox.Text.Length == 0 && CategoryComboBox.Text == "") { ItemNameErrorMessage.Text = "Item Name Can't Be Empty!"; QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!"; CategoryErrorMessage.Text = "You Must Choose Category Item!"; ItemNameTextBox.Focus(); QuantityTextBox.Focus(); CategoryComboBox.Focus(); } else if (ItemNameTextBox.Text.Length == 0 && QuantityTextBox.Text.Length == 0) { ItemNameErrorMessage.Text = "Item Name Can't Be Empty!"; QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!"; ItemNameTextBox.Focus(); QuantityTextBox.Focus(); } else if (ItemNameTextBox.Text.Length == 0 && CategoryComboBox.Text == "") { ItemNameErrorMessage.Text = "Item Name Can't Be Empty!"; CategoryErrorMessage.Text = "You Must Choose Category Item!"; ItemNameTextBox.Focus(); CategoryComboBox.Focus(); } else if (QuantityTextBox.Text.Length == 0 && CategoryComboBox.Text == "") { CategoryErrorMessage.Text = "You Must Choose Category Item!"; QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!"; QuantityTextBox.Focus(); CategoryComboBox.Focus(); } else if (ItemNameTextBox.Text.Length == 0) { ItemNameErrorMessage.Text = "Item Name Can't Be Empty!"; ItemNameTextBox.Focus(); } else if (QuantityTextBox.Text.Length == 0) { QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!"; QuantityTextBox.Focus(); } else if (CategoryComboBox.Text == "") { CategoryErrorMessage.Text = "You Must Choose Category Item!"; CategoryComboBox.Focus(); } else { string Iname = ItemNameTextBox.Text; int Iqty = Convert.ToInt32(QuantityTextBox.Text); int Icat = Convert.ToInt32(CategoryComboBox.SelectedValue.ToString()); CallItem.AddItem(Iname, Iqty, Icat, email, name, roles); } }
private void CategoryComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (CategoryComboBox.ValidateEmpty()) { CategoryComboBox.BackColor = System.Drawing.Color.White; } }
private void UpdateDataItem_Click(object sender, RoutedEventArgs e) { ItemController CallItem = new ItemController(); if (ItemNameTextBox.Text.Length == 0 && QuantityTextBox.Text.Length == 0 && CategoryComboBox.Text == "") { ItemNameErrorMessage.Text = "Item Name Can't Be Empty!"; QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!"; CategoryErrorMessage.Text = "You Must Choose Category Item!"; ItemNameTextBox.Focus(); QuantityTextBox.Focus(); CategoryComboBox.Focus(); } else if (ItemNameTextBox.Text.Length == 0 && QuantityTextBox.Text.Length == 0) { ItemNameErrorMessage.Text = "Item Name Can't Be Empty!"; QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!"; ItemNameTextBox.Focus(); QuantityTextBox.Focus(); } else if (ItemNameTextBox.Text.Length == 0 && CategoryComboBox.Text == "") { ItemNameErrorMessage.Text = "Item Name Can't Be Empty!"; CategoryErrorMessage.Text = "You Must Choose Category Item!"; ItemNameTextBox.Focus(); CategoryComboBox.Focus(); } else if (QuantityTextBox.Text.Length == 0 && CategoryComboBox.Text == "") { CategoryErrorMessage.Text = "You Must Choose Category Item!"; QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!"; QuantityTextBox.Focus(); CategoryComboBox.Focus(); } else if (ItemNameTextBox.Text.Length == 0) { ItemNameErrorMessage.Text = "Item Name Can't Be Empty!"; ItemNameTextBox.Focus(); } else if (QuantityTextBox.Text.Length == 0) { QuantityErrorMessage.Text = "Item Quantity Can't Be Empty!"; QuantityTextBox.Focus(); } else if (CategoryComboBox.Text == "") { CategoryErrorMessage.Text = "You Must Choose Category Item!"; CategoryComboBox.Focus(); } else { string Iname = ItemNameTextBox.Text; int Iqty = Convert.ToInt32(QuantityTextBox.Text); int Icat = Convert.ToInt32(CategoryComboBox.SelectedValue.ToString()); CallItem.UpdateItem(Convert.ToInt16((dataGrid.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text), Iname, Iqty, Icat); } }
private void AddCollectionButton_Click(object sender, EventArgs e) { bool needReset = false; ConfirmDialogForm confirm = null; if (ruler.IsGameStarted) { confirm = GetConfirmStatus("Сбросить игру?"); needReset = confirm.Yes; } else { needReset = true; } if (needReset) { ResetGame(); if (newCollectionDialogForm == null) { newCollectionDialogForm = new NewCollectionDialogForm(); } SoundPlayer.PlaySettingsSound(); newCollectionDialogForm.StartPosition = FormStartPosition.Manual; newCollectionDialogForm.Location = this.Location; newCollectionDialogForm.StartPosition = FormStartPosition.CenterParent; newCollectionDialogForm.BackgroundImageLayout = ImageLayout.Stretch; this.Enabled = false; newCollectionDialogForm.NewCollectionTextBox.Focus(); newCollectionDialogForm.ShowDialog(this); var newCollectionName = newCollectionDialogForm.CollectionName; this.Enabled = true; if (!string.IsNullOrEmpty(newCollectionName) && newCollectionName?.Length > 2) { this.Invoke((Action)(() => this.Enabled = false)); new Thread(() => { Thread.CurrentThread.IsBackground = true; this.Invoke((Action)(() => baseForm.ShowStatusMessage($"ПОИСК ИЗОБРАЖЕНИЙ ПО КАТЕГОРИИ '{newCollectionName.ToUpper()}' ..."))); this.Invoke((Action)(() => customImageCollectionConfigurator.GenerateImageCollectionByCategory(baseForm, newCollectionName, 180, 190))); this.Invoke((Action)(() => buttonManager.AssignImages(newCollectionName))); this.Invoke((Action)(() => buttonManager.HideButtonImages())); this.Invoke((Action)(() => CategoryComboBox.DataSource = libManager.GetCategories().ToList())); this.Invoke((Action)(() => CategoryComboBox.SelectedIndex = CategoryComboBox.FindStringExact(newCollectionName))); this.Invoke((Action)(() => newCollectionDialogForm.ResetCollectionName())); this.Invoke((Action)(() => this.Enabled = true)); this.Invoke((Action)(() => baseForm.HideStatusMessage())); SoundPlayer.PlayShuffleSound(); }).Start(); } } confirm?.Dispose(); this.Enabled = true; }
private bool ValidateUserInputs() { int failedCount = 0; if (!NameTextBox.ValidateEmpty()) { NameTextBox.BackColor = Color.OrangeRed; failedCount++; } if (!NameTextBox.ValidateUniqeName()) { MessageBox.Show("Fail to add as the name alread exists"); NameTextBox.BackColor = Color.OrangeRed; failedCount++; } if (!AmountTextBox.ValidateEmpty()) { AmountTextBox.BackColor = Color.OrangeRed; failedCount++; } if (!AmountTextBox.ValidatePositiveNumber()) { MessageBox.Show("The amount should be positive"); AmountTextBox.BackColor = Color.OrangeRed; failedCount++; } if (!CategoryComboBox.ValidateEmpty()) { CategoryComboBox.BackColor = Color.OrangeRed; failedCount++; } if (!CurrencyComboBox.ValidateEmpty()) { CurrencyComboBox.BackColor = Color.OrangeRed; failedCount++; } if (!OccuredTimePicker.ValidateEmpty()) { OccuredTimePicker.BackColor = Color.OrangeRed; OccuredTimePicker.Focus(); failedCount++; } if (failedCount > 0) { return(false); } else { return(true); } }
public IdentificationAssistant() { InitializeComponent(); CategoryComboBox.SelectedIndex = 0; EventComboBox.DataSource = new BindingSource(BCAMEx.Events, null); EventComboBox.DisplayMember = "Value"; EventComboBox.ValueMember = "Key"; this.SetDoubleBuffered(); EventComboBox.SetDoubleBuffered(); CategoryComboBox.SetDoubleBuffered(); CamIDNumericUpDown.ValueChange2 += CamIDNumericUpDown_ValueChanged; SubCamIDNumericUpDown.ValueChange2 += CamIDNumericUpDown_ValueChanged; }
//Shows Converter Menu private void ShowConverter() { //Show the converter menu's controls and labels CategoryLabel.Show(); CategoryComboBox.Show(); InstructionLabel.Show(); ValueOfLabel.Show(); UserInputTextBox.Show(); FromLabel.Show(); InitialUnitsComboBox.Show(); ToLabel.Show(); ResultingUnitsComboBox.Show(); BackButtonLabel.Show(); BackButton.Show(); DividerLabel.Show(); UserInputTextBox.Focus(); }
private void RemoveCollectionButton_Click(object sender, EventArgs e) { SoundPlayer.PlayRemovePlayerSound(); var confirm = GetConfirmStatus("Удалить коллекцию?"); if (confirm.Yes) { var collectionName = CategoryComboBox.Text; libManager.RemoveCategory(collectionName); var categories = libManager.GetCategories(); this.Invoke((Action)(() => CategoryComboBox.DataSource = categories.ToList())); this.Invoke((Action)(() => CategoryComboBox.Refresh())); fileManager.DeleteCollection(collectionName, libManager.LibraryPath); } confirm.Dispose(); this.Enabled = true; }
//Overrided method accepting a category parameter obtained from menu selection private void ShowConverter(String category) { //Shows the converter menu's controls and labels CategoryLabel.Show(); CategoryComboBox.Show(); InstructionLabel.Show(); ValueOfLabel.Show(); UserInputTextBox.Show(); FromLabel.Show(); InitialUnitsComboBox.Show(); ToLabel.Show(); ResultingUnitsComboBox.Show(); ConvertSubmissionButton.Show(); BackButtonLabel.Show(); BackButton.Show(); DividerLabel.Show(); //Selects the category field in the converter CategoryComboBox.SelectedIndex = CategoryComboBox.FindStringExact(category); //Shows the default units of measurement ShowDefaultUnits(category); UserInputTextBox.Focus(); }
//Hides Converter Menu private void HideConverter() { CategoryLabel.Hide(); CategoryComboBox.Hide(); InstructionLabel.Hide(); ValueOfLabel.Hide(); UserInputTextBox.Hide(); FromLabel.Hide(); InitialUnitsComboBox.Hide(); ToLabel.Hide(); ResultingUnitsComboBox.Hide(); ConvertSubmissionButton.Hide(); BackButtonLabel.Hide(); BackButton.Hide(); DividerLabel.Hide(); InitialValueLabel.Hide(); InitialUnitsLabel.Hide(); EqualsLabel.Hide(); ResultingUnitsLabel.Hide(); ResultingValueLabel.Hide(); //When navigating back to the main menu its important to clear the field values for the ComboBoxes ClearUnitsComboBoxes(); }
private void CustomPaintButton_Click(object sender, EventArgs e) { SoundPlayer.PlaySettingsSound(); bool needReset = false; ConfirmDialogForm confirm = null; if (ruler.IsGameStarted) { confirm = GetConfirmStatus("Сбросить игру?"); needReset = confirm.Yes; } else { needReset = true; } if (needReset) { ResetGame(); var collectionNameDialog = new CustomCollectionNameDialogForm(); collectionNameDialog.StartPosition = FormStartPosition.Manual; collectionNameDialog.Location = this.Location; collectionNameDialog.StartPosition = FormStartPosition.CenterParent; collectionNameDialog.BackgroundImageLayout = ImageLayout.Stretch; this.Enabled = false; collectionNameDialog.ShowDialog(this); this.Enabled = true; var newCollectionName = collectionNameDialog.GetCollectionName(); if (libManager.GetCategories().Contains(newCollectionName)) { baseForm.ShowStatusMessage($"Коллекция {newCollectionName} уже существует", error: true, true); return; } if (!string.IsNullOrEmpty(newCollectionName)) { var collectionPath = Path.Combine(libManager.LibraryPath, newCollectionName); if (fileManager.IsDirectoryExist(collectionPath)) { var popUpMessage = new TimedPopUp(); popUpMessage.Set($"Коллекция {newCollectionName} уже существует"); popUpMessage.ShowError(3000); this.Invoke((Action)(() => this.Enabled = true)); return; } collectionNameDialog.Dispose(); collectionNameDialog = null; paintForm = new PaintForm(this, baseForm, newCollectionName); new Thread(() => { this.Invoke((Action)(() => paintForm.StartPosition = FormStartPosition.Manual)); this.Invoke((Action)(() => paintForm.Location = this.Location)); this.Invoke((Action)(() => paintForm.StartPosition = FormStartPosition.CenterParent)); this.Invoke((Action)(() => paintForm.BackgroundImageLayout = ImageLayout.Stretch)); this.Invoke((Action)(() => this.Enabled = false)); this.Invoke((Action)(() => paintForm.ShowDialog(this))); List <CustomImage> newCollection = paintForm.GetCollection(); SaveCustomImageCollection(newCollectionName, newCollection); this.Invoke((Action)(() => CategoryComboBox.DataSource = libManager.GetCategories().ToList())); this.Invoke((Action)(() => CategoryComboBox.SelectedIndex = CategoryComboBox.FindStringExact(newCollectionName))); paintForm.Dispose(); paintForm = null; this.Invoke((Action)(() => this.Enabled = true)); }).Start(); } } confirm?.Dispose(); this.Enabled = true; }