示例#1
0
 private void Item_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         ListViewItem item = (ListViewItem)sender;
         if (item != null)
         {
             if (LeftList.Items.Contains(item))
             {
                 if (item.Tag is DirectoryInfo)
                 {
                     lDirectory = (DirectoryInfo)item.Tag;
                     LeftList.Items.Clear();
                     ShowFiles(lDirectory, LeftList, lDirInfo);
                 }
                 else
                 {
                     //MessageBox.Show($"{((FileInfo)item.Tag).FullName} is open");
                     TextViewer textViewer = new TextViewer((FileInfo)item.Tag);
                     textViewer.ShowDialog();
                 }
             }
             else
             {
                 if (item.Tag is DirectoryInfo)
                 {
                     rDirectory = (DirectoryInfo)item.Tag;
                     RightList.Items.Clear();
                     ShowFiles(rDirectory, RightList, rDirInfo);
                 }
                 else
                 {
                     //MessageBox.Show($"{((FileInfo)item.Tag).FullName} is open");
                     TextViewer textViewer = new TextViewer((FileInfo)item.Tag);
                     textViewer.ShowDialog();
                 }
             }
         }
         else
         {
             throw new NullReferenceException("Unable to find file");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private static void FileOpen(FileInfo file)
 {
     var editor = new TextViewer(file);
     editor.ShowDialog();
 }
        private static void FileOpen(FileInfo file)
        {
            var editor = new TextViewer(file);

            editor.ShowDialog();
        }