private void Change_B_Click(object sender, EventArgs e) { try { if (Products_LB.SelectedItems.Count == 1) { PositionListBox dialog = new PositionListBox(Products_LB.Items.Cast <String>().ToList()); dialog.Text = "Изменение информации"; dialog.Title_L.Text = "Изменение информации"; dialog.Info_TB.Text = Products_LB.SelectedItem.ToString(); if (dialog.ShowDialog() == DialogResult.OK) { OperationsProducts product = new OperationsProducts(); product.Change(Products_LB.SelectedItem.ToString(), dialog.Info_TB.Text); Products[Products_LB.SelectedIndex] = dialog.Info_TB.Text; } } else { throw new Exception("Необходимо выбрать одну позицию для изменения"); } } catch (Exception Ex) { Error(Ex); } }
private void Main_Load(object sender, EventArgs e) { try { OperationsVersions = new OperationsVersions(); OperationsFiles = new OperationsFiles(); OperationsProducts = new OperationsProducts(); Server = new Services.Server(OperationsFiles, OperationsVersions); CheckerStatus_T.Start(); logger.Info("Сборка пройдена успешно"); Server.Start(); logger.Info("Запуск сервера успешно выполнен"); ShowProducts(); using (RegistryKey registryKeyStartup = Registry.CurrentUser.OpenSubKey(pathRegistryKeyStartup, true)) { value = (String)registryKeyStartup.GetValue("SZMK.ServerUpdater"); } if (!String.IsNullOrEmpty(value)) { AddAutoRun_TSM.Text = "Удалить из автозагрузки"; } } catch (Exception Ex) { Error(Ex); } }
private void Add_B_Click(object sender, EventArgs e) { try { PositionListBox dialog = new PositionListBox(Products_LB.Items.Cast <String>().ToList()); if (dialog.ShowDialog() == DialogResult.OK) { OperationsProducts product = new OperationsProducts(); product.Add(dialog.Info_TB.Text); Products.Add(dialog.Info_TB.Text); } } catch (Exception Ex) { Error(Ex); } }
private void Main_Load(object sender, EventArgs e) { try { Products_DGV.AutoGenerateColumns = false; products = new OperationsProducts(); Operationsbots = new OperationsBots(); Operationsserver = new OperationsServer(); Server = new Server(); telegram = new BotTelegram(); Server.Start(); telegram.StartAsync(); LoadProducts(); } catch (Exception Ex) { Error(Ex.Message); } }
private void Delete_B_Click(object sender, EventArgs e) { try { if (Products_LB.SelectedItems.Count == 1) { if (MessageBox.Show("Вы действтельно хотите удалить продукт, также удалятся все загруженные версии?!", "Внимание", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { OperationsProducts product = new OperationsProducts(); product.Delete(Products_LB.SelectedItem.ToString()); Products.Remove(Products[Products_LB.SelectedIndex]); } } else { throw new Exception("Необходимо выбрать одну позицию для удаления"); } } catch (Exception Ex) { Error(Ex); } }
private void Main_Load(object sender, EventArgs e) { try { OperationsVersions = new OperationsVersions(); OperationsFiles = new OperationsFiles(); OperationsProducts = new OperationsProducts(); Server = new Services.Server(OperationsFiles, OperationsVersions); CheckerStatus_T.Start(); logger.Info("Сборка пройдена успешно"); Server.Start(); logger.Info("Запуск сервера успешно выполнен"); ShowProducts(); } catch (Exception Ex) { Error(Ex); } }