Esempio n. 1
0
 Project IProjectFactory.CreateProject(object creationArgs)
 {
     if (creationArgs != null)
     {
         string path = null;
         if (creationArgs is string)
         {
             path = (string) creationArgs;
             if (((path.Length == 0) || !Directory.Exists(path)) || !Path.IsPathRooted(path))
             {
                 path = null;
             }
         }
         if (path == null)
         {
             throw new ArgumentException("The specified folder is invalid.");
         }
         return this.CreateProject(path);
     }
     IMxUIService service = (IMxUIService) this._serviceProvider.GetService(typeof(IMxUIService));
     FolderBrowser browser = new FolderBrowser();
     browser.Description = "Select the folder you want to create a shortcut to:";
     browser.StartLocation = FolderBrowserLocation.MyComputer;
     browser.Style = FolderBrowserStyles.ShowTextBox | FolderBrowserStyles.RestrictToFileSystem;
     if (browser.ShowDialog(service.DialogOwner) == DialogResult.OK)
     {
         string directoryPath = browser.DirectoryPath;
         if ((directoryPath != null) && (directoryPath.Length != 0))
         {
             if (!Directory.Exists(directoryPath) || !Path.IsPathRooted(directoryPath))
             {
                 throw new ArgumentException("The selected folder is invalid.");
             }
             return this.CreateProject(directoryPath);
         }
     }
     return null;
 }
Esempio n. 2
0
 private void OnClickPickerButton(object sender, EventArgs e)
 {
     FolderBrowser browser = new FolderBrowser();
     browser.Style = FolderBrowserStyles.RestrictToFileSystem;
     browser.StartLocation = FolderBrowserLocation.MyComputer;
     browser.Description = "Select the file location:";
     browser.Style = FolderBrowserStyles.ShowTextBox | FolderBrowserStyles.RestrictToFileSystem;
     if (browser.ShowDialog(this) == DialogResult.OK)
     {
         string directoryPath = browser.DirectoryPath;
         if (((directoryPath != null) && (directoryPath.Length != 0)) && Path.IsPathRooted(directoryPath))
         {
             this._locationText.Text = directoryPath;
         }
     }
 }