示例#1
0
 //----< Helper function for view file return message>-------------------------
 private void viewSelectedFile(string file)
 {
     file = file.Substring(0, file.Length - 1);
     Console.WriteLine(file);
     if (fileShowed)
     {
         Console.WriteLine("about to display files");
         fileShowed = false;
         System.Windows.Application.Current.Dispatcher.Invoke((Action) delegate
         {
             ViewFile viewFile = new ViewFile();
             string dir        = Directory.GetCurrentDirectory();
             String pathTemp;
             if (dir.Contains("Debug"))
             {
                 pathTemp = System.IO.Path.GetFullPath("../../../../codeRepository/localClientFiles/" + file);
             }
             else
             {
                 pathTemp = System.IO.Path.GetFullPath("codeRepository/localClientFiles/" + file);
             }
             Paragraph paragraph = new Paragraph();
             paragraph.Inlines.Add(new Run(File.ReadAllText(pathTemp)));
             viewFile.codeview.Blocks.Add(paragraph);
             viewFile.Show();
         });
     }
 }
        //----< Opens a new pop up window to view the content of file >------

        private void viewSelectedFile(string file)
        {
            System.Windows.Application.Current.Dispatcher.Invoke((Action) delegate {
                ViewFile viewFile   = new ViewFile();
                String path         = System.IO.Path.GetFullPath(file);
                Paragraph paragraph = new Paragraph();
                paragraph.Inlines.Add(new Run(File.ReadAllText(path)));
                viewFile.codeview.Blocks.Add(paragraph);
                viewFile.Show();
            });
        }