DBMigratorVsix/DBMigratorWindowCommand.cs
/// <summary>
/// Shows the tool window when the menu item is clicked.
/// </summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event args.</param>
Shows the tool window when the menu item is clicked.
Shows the tool window when the menu item is clicked .
private void Execute(object sender, EventArgs e)
        {
            this.package.JoinableTaskFactory.RunAsync(async delegate
            {
                var window = (DBMigratorWindow)await this.package.ShowToolWindowAsync(typeof(DBMigratorWindow), 0, true, this.package.DisposalToken);
                var test = (DTE2)await ServiceProvider.GetServiceAsync(typeof(DTE));
                var items = (Array)test.ToolWindows.SolutionExplorer.SelectedItems;
                var uis = items.Cast<UIHierarchyItem>();
                var projectItems = uis.Select(s => s.Object).Cast<ProjectItem>();
                var folderNames = projectItems.Select(s => s.FileNames[1]);
                var folderPath = folderNames.First();
                window.SetMigrationPath(folderPath);
                if ((null == window) || (null == window.Frame))
                {
                    throw new NotSupportedException("Cannot create tool window");
                }
            });
        }
private void Execute ( object sender , EventArgs e ) { this . package . JoinableTaskFactory . RunAsync ( async delegate { var window = ( DBMigratorWindow ) await this . package . ShowToolWindowAsync ( typeof ( DBMigratorWindow ) , 0 , true , this . package . DisposalToken ) ; var test = ( DTE2 ) await ServiceProvider . GetServiceAsync ( typeof ( DTE ) ) ; var items = ( Array ) test . ToolWindows . SolutionExplorer . SelectedItems ; var uis = items . Cast < UIHierarchyItem > ( ) ; var projectItems = uis . Select ( s => s . Object ) . Cast < ProjectItem > ( ) ; var folderNames = projectItems . Select ( s => s . FileNames [ 1 ] ) ; var folderPath = folderNames . First ( ) ; window . SetMigrationPath ( folderPath ) ; if ( ( null == window ) || ( null == window . Frame ) ) { throw new NotSupportedException ( " " ) ; } } ) ; }
Shows the tool window when the menu item is clicked.
Shows the tool window when the menu item is clicked .
sender
object
The event sender.
The event sender .
e
EventArgs
The event args.
The event args .