public void WriteToFile(string operation, int Index) { StationHelper.SaveStation(NameStation, LincStation, NumOfOpen, operation, Index); this.deleteToolStripMenuItem.DropDownItems.Clear(); this.playToolStripMenuItem.DropDownItems.Clear(); MenuItemAdd(); ColorHelper.SaveColor(this.BackColor.ToArgb()); StationHelper.LoadStation(NameStation, LincStation, NumOfOpen); }
public void DelStation(int SelectIndex) { var dellString = "Удалить " + ListStatinName.Items[SelectIndex].ToString() + "?"; var rezult = MessageBox.Show(ListStatinName, dellString, "Подтвеждение удаления", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (rezult == System.Windows.Forms.DialogResult.Yes) { // _nameStation.Items.RemoveAt(SelectIndex); // LincStation.Items.RemoveAt(SelectIndex); StationHelper.SaveStation(NameStation, LincStation, NumOfOpen, "Удалить", SelectIndex); StationHelper.LoadStation(NameStation, LincStation, NumOfOpen); _operation = null; LoadMainForm(); } }
public void PlayStation(int selectIndex) { progressBar1.Value = 0; IsPlay = true; if (selectIndex != -1 && selectIndex <= (LincStation.Items.Count - 1)) { LincStation.SelectedIndex = selectIndex; Player.OpenFile(LincStation.SelectedItem.ToString()); progressBar1.Minimum = 0; progressBar1.Maximum = 100; progressBar1.Step = 1; timer1.Interval = 900; timer1.Start(); bPlayStop.Text = "Стоп"; //Прослушиваний +1 //var i = Convert.ToInt32(NumOfOpen.Items[selectIndex]); //i += 1; NumOfOpen.Items[selectIndex] = Convert.ToInt32(NumOfOpen.Items[selectIndex]) + 1; StationHelper.SaveStation(NameStation, LincStation, NumOfOpen, "Изменить", selectIndex); } }
public void Operations(string operation) { switch (operation) { case "Изменить": { TextUrl.Enabled = true; panel1.Visible = true; bAdd.Text = "Изменить"; if (_doOperation) { NameStation.Items[_selectIndex] = TextName.Text; LincStation.Items[_selectIndex] = TextUrl.Text; WriteToFile("Изменить", _selectIndex); _doOperation = false; bAdd.Text = "Ok"; } { if (_selectIndex >= 0) { TextName.Text = NameStation.Items[_selectIndex].ToString(); TextUrl.Text = LincStation.Items[_selectIndex].ToString(); } } } LoadMainForm(); break; case "Удалить": { DelStation(_selectIndex); LoadMainForm(); break; } case "Переименовать": { bAdd.Text = "Переименовать"; } if (_doOperation) { NameStation.Items[_selectIndex] = TextName.Text; LincStation.Items[_selectIndex] = TextUrl.Text; WriteToFile("Переименовать", _selectIndex); _doOperation = false; TextUrl.ReadOnly = false; TextUrl.Enabled = true; bAdd.Text = "Ok"; TextName.Text = TextUrl.Text = null; } { panel1.Visible = true; TextUrl.Enabled = false; if (_selectIndex >= 0) { TextName.Text = NameStation.Items[_selectIndex].ToString(); TextUrl.Text = LincStation.Items[_selectIndex].ToString(); } LoadMainForm(); break; } case "Добавить": { if (_doOperation) { NameStation.Items.Add(TextName.Text); LincStation.Items.Add(TextUrl.Text); StationHelper.SaveStation(NameStation, LincStation, NumOfOpen, "Добавить", NameStation.Items.Count - 1); TextName.Text = TextUrl.Text = null; LoadMainForm(); MenuItemAdd(); bAdd.Text = "OK"; _doOperation = false; } else { bAdd.Text = "Добавить"; TextName.Text = TextUrl.Text = null; } LoadMainForm(); break; } } }