Пример #1
0
 private void listViewFilesRight_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (listViewSelectedItemRight + 1 > dirsRight.Length)
     {
         if (Path.GetExtension(filePathRight.Text) == ".txt")
         {
             Form txtForm = new TXTReader(filePathRight.Text);
             txtForm.Show();
         }
         else
         {
             MessageBox.Show("Please select a directory!");
         }
     }
     else
     {
         filesRight = FileHandler.GetAllFiles(pathRight);
         dirsRight  = FileHandler.GetAllDirectories(pathRight);
         listViewFilesRight.Items.Clear();
         if (dirsRight != null)
         {
             foreach (DirectoryInfo dir in dirsRight)
             {
                 listViewFilesRight.Items.Add(dir.ToString());
             }
         }
         if (filesRight != null)
         {
             foreach (FileInfo file in filesRight)
             {
                 listViewFilesRight.Items.Add(file.ToString());
             }
         }
     }
 }
Пример #2
0
        private void buttonOpenText_Click(object sender, EventArgs e)
        {
            string path;

            if (leftSelected)
            {
                path = filePathLeft.Text;
            }
            else
            {
                path = filePathRight.Text;
            }
            if (Path.GetExtension(path) == ".txt")
            {
                Form txtForm = new TXTReader(path);
                txtForm.Show();
            }
            else
            {
                MessageBox.Show("Please select a txt file");
            }
        }