public static async Task ShowDialog( PythonProjectNode project, IInterpreterRegistryService service, string requirementsPath, bool browseForExisting = false ) { using (var view = new AddVirtualEnvironmentView(project, service, project.ActiveInterpreter.Configuration.Id, requirementsPath)) { var wnd = new AddVirtualEnvironment(project.Site, view); if (browseForExisting) { var path = project.Site.BrowseForDirectory(IntPtr.Zero, project.ProjectHome); if (string.IsNullOrEmpty(path)) { throw new OperationCanceledException(); } view.VirtualEnvName = path; view.WillInstallRequirementsTxt = false; await view.WaitForReady(); if (view.WillAddVirtualEnv) { await view.Create().HandleAllExceptions(project.Site, typeof(AddVirtualEnvironment)); return; } view.ShowBrowsePathError = true; view.BrowseOrigPrefix = VirtualEnv.GetOrigPrefixPath(path); } wnd.VirtualEnvPathTextBox.ScrollToEnd(); wnd.VirtualEnvPathTextBox.SelectAll(); wnd.VirtualEnvPathTextBox.Focus(); wnd.ShowModal(); var op = wnd._currentOperation; if (op != null) { await op; } } }
public static async Task ShowDialog( PythonProjectNode project, IInterpreterOptionsService service, bool browseForExisting = false ) { using (var view = new AddVirtualEnvironmentView(project, service, project.Interpreters.ActiveInterpreter)) { var wnd = new AddVirtualEnvironment(view); if (browseForExisting) { var path = project.Site.BrowseForDirectory(IntPtr.Zero, project.ProjectHome); if (string.IsNullOrEmpty(path)) { throw new OperationCanceledException(); } view.VirtualEnvName = path; view.WillInstallRequirementsTxt = false; await view.WaitForReady(); if (view.WillAddVirtualEnv) { await view.Create().HandleAllExceptions(SR.ProductName, typeof(AddVirtualEnvironment)); return; } view.ShowBrowsePathError = true; view.BrowseOrigPrefix = DerivedInterpreterFactory.GetOrigPrefixPath(path); } wnd.VirtualEnvPathTextBox.ScrollToEnd(); wnd.VirtualEnvPathTextBox.SelectAll(); wnd.VirtualEnvPathTextBox.Focus(); wnd.ShowModal(); var op = wnd._currentOperation; if (op != null) { await op; } } }