Example #1
0
        /// <summary>
        /// Refreshes the list of files and directories at the specified path
        /// </summary>
        /// <param name="path">Path</param>
        public void SetPath(string path)
        {
            if (!Directory.Exists(path))
            {
                return;
            }

            try
            {
                DirectoryInfo di = new DirectoryInfo(path);
                Files.Clear();
                Files.AddRange(di.GetDirectories());
                Files.AddRange(di.GetFiles());
                Path = path;
                DirectoryName.SetText(Path, false);
                View.Path = Path;
                View.SetFiles(Files);
            }
            catch (UnauthorizedAccessException ex)
            {
                throw new InvalidOperationException("Set path error", ex)
                      {
                          Data =
                          {
                              { "path", path }
                          }
                      };
            }
        }
Example #2
0
 /// <summary>
 /// Refreshes the list of files and directories at the specified path
 /// </summary>
 /// <param name="path">Path</param>
 public void SetPath(string path)
 {
     try
     {
         DirectoryInfo di = new DirectoryInfo(path);
         Files.Clear();
         Files.AddRange(di.GetDirectories());
         Files.AddRange(di.GetFiles());
         Path = path;
         DirectoryName.SetText(Path, false);
         View.Path = Path;
         View.SetFiles(Files);
     }
     catch (UnauthorizedAccessException ex)
     {
         throw new Exception("Set path error", ex);
     }
 }