Exemplo n.º 1
0
        public ConsoleContainer()
        {
            InitializeComponent();

            ThreadHelper.JoinableTaskFactory.StartOnIdle(
                async() =>
            {
                await System.Threading.Tasks.Task.Run(
                    async() =>
                {
                    var solutionManager        = ServiceLocator.GetInstance <ISolutionManager>();
                    var productUpdateService   = ServiceLocator.GetInstance <IProductUpdateService>();
                    var packageRestoreManager  = ServiceLocator.GetInstance <IPackageRestoreManager>();
                    var deleteOnRestartManager = ServiceLocator.GetInstance <IDeleteOnRestartManager>();
                    var shell = ServiceLocator.GetGlobalService <SVsShell, IVsShell4>();

                    await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                    RootLayout.Children.Add(new ProductUpdateBar(productUpdateService));
                    RootLayout.Children.Add(new PackageRestoreBar(solutionManager, packageRestoreManager));
                    RootLayout.Children.Add(new RestartRequestBar(deleteOnRestartManager, shell));
                });
            }, VsTaskRunContext.UIThreadIdlePriority);

            // Set DynamicResource binding in code
            // The reason we can't set it in XAML is that the VsBrushes class come from either
            // Microsoft.VisualStudio.Shell.10 or Microsoft.VisualStudio.Shell.11 assembly,
            // depending on whether NuGet runs inside VS10 or VS11.
            InitializeText.SetResourceReference(TextBlock.ForegroundProperty, VsBrushes.WindowTextKey);
        }
Exemplo n.º 2
0
        public ConsoleContainer()
        {
            InitializeComponent();

            // Set DynamicResource binding in code
            // The reason we can't set it in XAML is that the VsBrushes class come from either
            // Microsoft.VisualStudio.Shell.10 or Microsoft.VisualStudio.Shell.11 assembly,
            // depending on whether NuGet runs inside VS10 or VS11.
            InitializeText.SetResourceReference(TextBlock.ForegroundProperty, VsBrushes.WindowTextKey);
        }
Exemplo n.º 3
0
        public ConsoleContainer(IProductUpdateService productUpdateService, IPackageRestoreManager packageRestoreManager)
        {
            InitializeComponent();

            RootLayout.Children.Add(new ProductUpdateBar(productUpdateService));
            RootLayout.Children.Add(new PackageRestoreBar(packageRestoreManager));

            // Set DynamicResource binding in code
            // The reason we can't set it in XAML is that the VsBrushes class come from either
            // Microsoft.VisualStudio.Shell.10 or Microsoft.VisualStudio.Shell.11 assembly,
            // depending on whether NuGet runs inside VS10 or VS11.
            InitializeText.SetResourceReference(TextBlock.ForegroundProperty, VsBrushes.WindowTextKey);
        }
        public ConsoleContainer()
        {
            InitializeComponent();

            Loaded   += ConsoleContainer_Loaded;
            Unloaded += ConsoleContainer_UnLoaded;

            ThreadHelper.JoinableTaskFactory.StartOnIdle(
                async() =>
            {
                await System.Threading.Tasks.Task.Run(
                    async() =>
                {
                    IServiceBrokerProvider serviceBrokerProvider = await ServiceLocator.GetComponentModelServiceAsync <IServiceBrokerProvider>();
                    IServiceBroker serviceBroker = await serviceBrokerProvider.GetAsync();

                    _solutionManager = await serviceBroker.GetProxyAsync <INuGetSolutionManagerService>(
                        NuGetServices.SolutionManagerService,
                        cancellationToken: CancellationToken.None);

                    Assumes.NotNull(_solutionManager);

                    IComponentModel componentModel = await ServiceLocator.GetComponentModelAsync();
                    var productUpdateService       = componentModel.GetService <IProductUpdateService>();
                    var packageRestoreManager      = componentModel.GetService <IPackageRestoreManager>();
                    var deleteOnRestartManager     = componentModel.GetService <IDeleteOnRestartManager>();
                    var shell = await ServiceLocator.GetGlobalServiceAsync <SVsShell, IVsShell4>();

                    await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                    RootLayout.Children.Add(new ProductUpdateBar(productUpdateService));
                    RootLayout.Children.Add(new PackageRestoreBar(_solutionManager, packageRestoreManager, projectContextInfo: null));
                    RootLayout.Children.Add(new RestartRequestBar(deleteOnRestartManager, shell));
                });
            }, VsTaskRunContext.UIThreadIdlePriority).PostOnFailure(nameof(ConsoleContainer));

            // Set DynamicResource binding in code
            // The reason we can't set it in XAML is that the VsBrushes class come from either
            // Microsoft.VisualStudio.Shell.10 or Microsoft.VisualStudio.Shell.11 assembly,
            // depending on whether NuGet runs inside VS10 or VS11.
            InitializeText.SetResourceReference(TextBlock.ForegroundProperty, VsBrushes.WindowTextKey);
        }
Exemplo n.º 5
0
 private void Awake()
 {
     Instance = this;
 }