private void EditProductButton_Clickk(object sender, EventArgs e) { if (edit == -1) { AddProductButton.Hide(); DeleteProductButton.Hide(); } else { AddProductButton.Show(); DeleteProductButton.Show(); } if (edit == 1) { try { Products[ProductsGridView.CurrentCell.RowIndex].Size = ToInt64(SizeTextBox.Text); Products[ProductsGridView.CurrentCell.RowIndex].Name = NameTextBox.Text; Products[ProductsGridView.CurrentCell.RowIndex].Price = ToDouble(PriceTextBox.Text); Products[ProductsGridView.CurrentCell.RowIndex].Date = Convert.ToString(DateTimePickerOfProduct.Value); ProductsGridView.CurrentRow.SetValues(Products[ProductsGridView.CurrentCell.RowIndex].Id, Products[ProductsGridView.CurrentCell.RowIndex].Size, Products[ProductsGridView.CurrentCell.RowIndex].Date, Products[ProductsGridView.CurrentCell.RowIndex].Name, Products[ProductsGridView.CurrentCell.RowIndex].Price); SizeTextBox.Clear(); NameTextBox.Clear(); PriceTextBox.Clear(); } catch (Exception) { MessageBox.Show("Ошибка"); } } edit *= -1; }
public ActDeviceEditPage(ActDevice act) { InitializeComponent(); mAct = act; DeviceActionComboBox.BindControl(mAct, ActDevice.Fields.DeviceAction); SizeTextBox.BindControl(mAct.GetOrCreateInputParam(ActDevice.Fields.Size)); BitRateTextBox.BindControl(mAct.GetOrCreateInputParam(ActDevice.Fields.BitRate)); TimeLimitTextBox.BindControl(mAct.GetOrCreateInputParam(ActDevice.Fields.TimeLimit)); }
private void AddProductButton_Click(object sender, EventArgs e) { try { Products.Add(new StoredProduct(NameTextBox.Text, ToDouble(PriceTextBox.Text), ToInt64(SizeTextBox.Text), Convert.ToString(DateTimePickerOfProduct.Value))); ProductsGridView.Rows.Add(Products[Product.ID - 1].Id, Products[Product.ID - 1].Size, Products[Product.ID - 1].Date, Products[Product.ID - 1].Name, Products[Product.ID - 1].Price); } catch (Exception) { MessageBox.Show("Не все данные введены корректно."); } SizeTextBox.Clear(); NameTextBox.Clear(); PriceTextBox.Clear(); EnabledButtons(); }
private void TitleListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Check if an item is selected // (without this check crash happens after search modify the listbox) if (RecipeIDLabel.Content != null) { bool parseOK = false; int recipeIDInt; string stringRecipeID = RecipeIDLabel.Content.ToString(); parseOK = int.TryParse(stringRecipeID, out recipeIDInt); if (parseOK == false) { MessageBox.Show("recipe ID of recipe selected is not numeric."); return; } var ingredientsList = SelectIngredients(recipeIDInt); string ingredientsString = AppendIngredientsToSingleString(ingredientsList); IngredientTextBlock.DataContext = ingredientsString; // the following takes out extra space and tabs in the directions (To format better) var temp = from recipe in ro.Recipes where recipe.RecipeID == recipeIDInt select recipe.Directions; // Only single item in temp, choose the first one. string temps = temp.ToArray()[0]; DirectionsTextBlock.DataContext = temps.Replace("\t", " ").Replace(" ", " "); SizeTextBox.ScrollToHome(); IngredientsScrollViewer.ScrollToTop(); DirectionsScrollViewer.ScrollToTop(); CommentsScollViewer.ScrollToTop(); } else { //Reset the ingredient TextBlock if nothing is selected ClearDataContexts(); } }
public void FillFileSizeTextBox() { SizeTextBox.Clear(); CurrentPaths = new List <string>(); long allsize = 0; foreach (var item in FileListBox.SelectedItems) { CurrentPaths.Add(PathTextBox.Text + item); } foreach (var path in CurrentPaths) { if (File.Exists(path)) { allsize += GetFileSize(path); } else { SizeTextBox.Clear(); } } GetSizeInValue(allsize); }
private void IsItemSelected(bool selected, ListViewItem item = null) { CurrentlySelectedItem = item; RequiresButton.Enabled = selected; EditButton.Enabled = selected; ChangelogCompilerButton.Enabled = selected; RemoveButton.Enabled = selected; LinkLinkLabel.Enabled = selected; if (item == null) { UpdatedTextBox.Clear(); UpdateModeTextBox.Clear(); SizeTextBox.Clear(); SideTextBox.Clear(); LinkTextBox.Clear(); MD5TextBox.Clear(); MinecraftVersionTextbox.Clear(); RequiresTextBox.Clear(); NotesTextBox.Clear(); } else { Mod selectedMod = (Mod)CurrentlySelectedItem.Tag; UpdatedTextBox.Text = selectedMod.Date.ToLocalTime().ToString(); UpdateModeTextBox.Text = selectedMod.UpdateMode.ToString(); SizeTextBox.Text = selectedMod.Size; SideTextBox.Text = selectedMod.Side.ToString(); LinkTextBox.Text = selectedMod.Link; MD5TextBox.Text = selectedMod.MD5; MinecraftVersionTextbox.Text = selectedMod.MinecraftVersionToString(); RequiresTextBox.Text = selectedMod.RequiresToString(); NotesTextBox.Text = selectedMod.Notes; } }
void SizeTextBox_Click(object sender, EventArgs e) { SizeTextBox.Clear(); }