Example #1
0
        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;
        }
Example #2
0
 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();
 }
Example #3
0
        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();
 }