// ------------------------------------------------------------------- /// <summary> /// Displays the response that was generated by a submission. /// </summary> /// <remarks> /// The response is displayed by writing it to the temporary response /// HTML file and then opening the user's default browser. /// </remarks> /// <param name="engine"> /// The submission engine from which to obtain the response. /// </param> private void DisplaySubmissionResponse(SubmissionEngine engine) { StreamWriter writer = new StreamWriter(responseTempPath, false); writer.Write(engine.SubmissionResponse); writer.Close(); System.Diagnostics.Process.Start(responseTempPath); }
// ------------------------------------------------------------------- /// <summary> /// Creates a new instance of the submission wizard. /// </summary> /// <param name="engine"> /// The submission engine instance to use to make the submission. /// </param> /// <param name="dte"> /// The DTE object to use to access Visual Studio services. /// </param> /// <param name="submittables"> /// The array of items to be submitted. /// </param> public SubmitterWizard(SubmissionEngine engine, IServiceProvider sp, ISubmittableItem[] submittables, string username) { InitializeComponent(); this.serviceProvider = sp; this.engine = engine; this.submittables = submittables; Controls.Remove(summaryPage); usernameField.Text = username; wizardDescriptionLabel.Text = Messages.WizardStartDescription; }
// ------------------------------------------------------------------------ private void LoadImportedDefinitions() { SubmissionEngine engine = new SubmissionEngine(); try { engine.OpenDefinitions(new Uri(href)); ITarget root = engine.Root; CopyFrom(root); loaded = true; } catch (Exception) { } }
// ------------------------------------------------------------------------ private void LoadImportedDefinitions() { SubmissionEngine engine = new SubmissionEngine(); try { engine.OpenDefinitions(new Uri(href)); ITarget root = engine.Root; CopyFrom(root); loaded = true; } catch(Exception) { } }
// ------------------------------------------------------------------- /// <summary> /// Displays the submission wizard with the specified array of /// submittable items as its initial selection. /// </summary> /// <param name="items"> /// The initial selection of submittable items. /// </param> private void ShowSubmissionWizard(ISubmittableItem[] items) { IntPtr owningHwnd; IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell)); uiShell.GetDialogOwnerHwnd(out owningHwnd); HWndWrapper windowWrapper = new HWndWrapper(owningHwnd); SubmissionEngine engine = new SubmissionEngine(); SubmitterOptionsPage options = (SubmitterOptionsPage) GetDialogPage(typeof(SubmitterOptionsPage)); Exception openException = null; BackgroundWorkerDialog dlg = new BackgroundWorkerDialog( Messages.LoadingSubmissionTargetsProgress, true, delegate(object sender, DoWorkEventArgs e) { BackgroundWorker worker = (BackgroundWorker)sender; try { Uri uri = new Uri(options.SubmissionDefinitionsUri); engine.OpenDefinitions(uri); } catch (Exception ex) { openException = ex; } }); dlg.ShowDialog(windowWrapper); if (engine.Root != null) { SubmitterWizard wizard = new SubmitterWizard(engine, this, items, options.DefaultUsername); wizard.ShowDialog(windowWrapper); if (engine.HasResponse) { DisplaySubmissionResponse(engine); } } else { if (openException != null) { MessageBox.Show(windowWrapper, String.Format(Messages.LoadingSubmissionTargetsError, openException.Message), Messages.LoadingSubmissionTargetsErrorTitle, MessageBoxButtons.OK); } else { MessageBox.Show(windowWrapper, Messages.LoadingSubmissionTargetsUnknownError, Messages.LoadingSubmissionTargetsErrorTitle, MessageBoxButtons.OK); } } }