Exemple #1
0
        public void Delete(ListView list, bool left)
        {
            string currentPath;

            if (left)
            {
                currentPath = currentPath1;
            }
            else
            {
                currentPath = currentPath2;
            }
            WarningForm warningForm = new WarningForm(false);

            warningForm.ShowDialog();
            if (warningForm.action)
            {
                if (list.SelectedItems.Count > 0)
                {
                    foreach (int i in list.SelectedIndices)
                    {
                        if (list.Items[i].ImageIndex == 0)
                        {
                            Folder folder = new Folder(currentPath + "\\" + list.Items[i].Text);
                            folder.Delete();
                            director.DeleteReport(currentPath + "\\" + list.Items[i].Text);
                            director.BuildReport();
                            reports.Add(director.GetReportItem());
                        }
                        else
                        {
                            CommonFile file = new CommonFile(currentPath + "\\" + list.Items[i].Text);
                            file.Delete();
                            director.DeleteReport(currentPath + "\\" + list.Items[i].Text);
                            director.BuildReport();
                            reports.Add(director.GetReportItem());
                        }
                    }
                }
            }
        }
Exemple #2
0
 private void TextEditorForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (Content != manualContent)
     {
         WarningForm warningForm = new WarningForm(true);
         warningForm.ShowDialog();
         if (warningForm.action)
         {
             try
             {
                 File.WriteAllText(path, Content, Encoding.GetEncoding(1251));
                 manualContent = Content;
                 Close();
             }
             catch
             {
                 MessageBox.Show("Couldn`t save text!", "Error");
             }
         }
     }
 }