Exemplo n.º 1
0
        public static async Task InitializeAsync(AsyncPackage package)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);

            OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

            Instance = new RegisterPSActivityInsightsCommand(package, commandService);
        }
Exemplo n.º 2
0
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await JoinableTaskFactory.RunAsync(async() =>
            {
                Logger.Setup();
                this.logger = LogManager.GetLogger(typeof(PSActivityInsights));

                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                try
                {
                    if (Utilities.IsReady())
                    {
                        await this.StartPulseTrackingAsync();
                    }

                    if (!Utilities.HasBinary())
                    {
                        async void cb(object o, AsyncCompletedEventArgs a)
                        {
                            if (Utilities.IsRegistered())
                            {
                                await StartPulseTrackingAsync();
                            }
                        }
                        Utilities.DownloadBinaryAndThen(cb);
                    }
                }
                catch (Exception e)
                {
                    logger.Error(e);
                }
            });

            await RegisterPSActivityInsightsCommand.InitializeAsync(this);

            await OpenPSActivityInsightsDashboard.InitializeAsync(this);
        }