/// <summary> /// Attempts to run the template wizard. /// </summary> /// <param name="shell">The <see cref="IVsUIShell">shell</see> associated with the wizard.</param> /// <returns>True if the wizard completed successfully; otherwise, false if the wizard was canceled.</returns> protected override bool TryRunWizard( IVsUIShell shell ) { Arg.NotNull( shell, nameof( shell ) ); var mapper = new ViewModelReplacementsMapper( Project ); var model = new ViewModelItemTemplateWizardViewModel(); // map replacements to model mapper.Map( Context.Replacements, model ); // only show the dialog if the context is interactive if ( Context.IsInteractive ) { var view = new ViewModelItemTemplateWizard( model ); // show the wizard if ( !( view.ShowDialog( shell ) ?? false ) ) return false; } // map model back to replacements mapper.Map( model, Context.Replacements ); return true; }
/// <summary> /// Initializes a new instance of the <see cref="ViewModelItemTemplateWizard"/> class. /// </summary> /// <param name="model">The <see cref="ViewItemTemplateWizardViewModel">model</see> for the view.</param> public ViewModelItemTemplateWizard( ViewModelItemTemplateWizardViewModel model ) : this() { DataContext = model; }