/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); // An remember the package. Instance = this; // Register the command handlers. CloudExplorerCommand.Initialize(this); ManageAccountsCommand.Initialize(this); PublishProjectMainMenuCommand.Initialize(this); PublishProjectContextMenuCommand.Initialize(this); GenerateConfigurationContextMenuCommand.Initialize(this); // Activity log utils, to aid in debugging. ActivityLogUtils.Initialize(this); ActivityLogUtils.LogInfo("Starting Google Cloud Tools."); _dteInstance = (DTE)Package.GetGlobalService(typeof(DTE)); // Update the installation status of the package. CheckInstallationStatus(); // Ensure the commands UI state is updated when the GCP project changes. CredentialsStore.Default.Reset += (o, e) => ShellUtils.InvalidateCommandsState(); CredentialsStore.Default.CurrentProjectIdChanged += (o, e) => ShellUtils.InvalidateCommandsState(); }
/// <summary> /// Reports that the given command is starting its execution, typically to be called right at the /// begining of the command's handler method. /// </summary> /// <param name="command">The name of the command. Must not be null.</param> /// <param name="invocationSource">From where the command was invoked.</param> public static void ReportCommand(CommandName command, CommandInvocationSource invocationSource) { ActivityLogUtils.LogInfo($"Reporting: Starting command {command} from source {invocationSource}"); s_reporter.Value?.ReportEvent( category: command.ToString(), action: invocationSource.ToString()); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); // An remember the package. Instance = this; // Register the command handlers. CloudExplorerCommand.Initialize(this); ManageAccountsCommand.Initialize(this); PublishProjectMainMenuCommand.Initialize(this); PublishProjectContextMenuCommand.Initialize(this); LogsViewerToolWindowCommand.Initialize(this); GenerateConfigurationContextMenuCommand.Initialize(this); ErrorReportingToolWindowCommand.Initialize(this); // Activity log utils, to aid in debugging. ActivityLogUtils.Initialize(this); ActivityLogUtils.LogInfo("Starting Google Cloud Tools."); _dteInstance = (DTE)GetService(typeof(DTE)); VsVersion = _dteInstance.Version; VsEdition = _dteInstance.Edition; // Update the installation status of the package. CheckInstallationStatus(); // Ensure the commands UI state is updated when the GCP project changes. CredentialsStore.Default.Reset += (o, e) => ShellUtils.InvalidateCommandsState(); CredentialsStore.Default.CurrentProjectIdChanged += (o, e) => ShellUtils.InvalidateCommandsState(); // With this setting we allow more concurrent connections from each HttpClient instance created // in the process. This will allow all GCP API services to have more concurrent connections with // GCP servers. The first benefit of this is that we can upload more concurrent files to GCS. ServicePointManager.DefaultConnectionLimit = MaximumConcurrentConnections; ExportProvider mefExportProvider = GetService <SComponentModel, IComponentModel>().DefaultExportProvider; _shellUtilsLazy = mefExportProvider.GetExport <IShellUtils>(); _gcpOutputWindowLazy = mefExportProvider.GetExport <IGcpOutputWindow>(); _processService = mefExportProvider.GetExport <IProcessService>(); _statusbarService = mefExportProvider.GetExport <IStatusbarService>(); _userPromptService = mefExportProvider.GetExport <IUserPromptService>(); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); // An remember the package. Instance = this; // Register the command handlers. CloudExplorerCommand.Initialize(this); ManageAccountsCommand.Initialize(this); // Activity log utils, to aid in debugging. ActivityLogUtils.Initialize(this); ActivityLogUtils.LogInfo("Starting Google Cloud Tools."); // Analytics reporting. ExtensionAnalytics.ReportStartSession(); _dteInstance = (DTE)Package.GetGlobalService(typeof(DTE)); _dteInstance.Events.DTEEvents.OnBeginShutdown += DTEEvents_OnBeginShutdown; }
/// <summary> /// Reports the begining of the session, to be called when the extension is loaded. /// </summary> public static void ReportStartSession() { ActivityLogUtils.LogInfo($"Reporting: Starting session."); s_reporter.Value?.ReportStartSession(); }
private void DTEEvents_OnBeginShutdown() { ActivityLogUtils.LogInfo("Shutting down Google Cloud Tools."); ExtensionAnalytics.ReportEndSession(); }