Пример #1
0
 private void toolClearAll_Click(object sender, EventArgs e)
 {
     if (FileLesson.Index == 0)
     {
         return;
     }
     if (MessageBox.Show("Are you sure you want to remove all lessons?", "Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         foreach (ListViewItem item in lvLessons.Items)
         {
             FileLesson.removeLesson(item.Index);
             lvLessons.Items.Remove(item);
         }
     }
 }
Пример #2
0
        private void toolDeleteLesson_Click(object sender, EventArgs e)
        {
            int selectedCount = lvLessons.SelectedIndices.Count;

            if (selectedCount <= 0)
            {
                return;
            }

            if (MessageBox.Show("Are you sure you want to remove selected (" + selectedCount + ") lessons?", "Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                foreach (ListViewItem item in lvLessons.SelectedItems)
                {
                    FileLesson.removeLesson(item.Index);
                    lvLessons.Items.Remove(item);
                }
            }
        }