private void OnSetAsCurrentAccountCommand() { ExtensionAnalytics.ReportCommand(CommandName.SetCurrentAccountCommand, CommandInvocationSource.Button); Debug.WriteLine($"Setting current account: {CurrentAccountName}"); CredentialsStore.Default.CurrentAccount = CurrentUserAccount.UserAccount; _owner.Close(); }
/// <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> private void ShowToolWindow(object sender, EventArgs e) { ExtensionAnalytics.EnsureAnalyticsOptIn(); ExtensionAnalytics.ReportCommand(CommandName.OpenManageAccountsDialog, CommandInvocationSource.ToolsMenu); ManageAccountsWindow.PromptUser(); }
private void OnOpenConCloudConsoleCommand() { ExtensionAnalytics.ReportCommand(CommandName.OpenWebsiteForGcsBucket, CommandInvocationSource.Button); var url = $"https://console.cloud.google.com/storage/browser/{_bucket.Name}/?project={CredentialsStore.Default.CurrentProjectId}"; Debug.WriteLine($"Starting bucket browsing at: {url}"); Process.Start(url); }
private void OnOpenWebsite() { ExtensionAnalytics.ReportCommand(CommandName.OpenWebsiteForGceInstanceCommand, CommandInvocationSource.Button); var url = Instance.GetDestinationAppUri(); Debug.WriteLine($"Opening Web Site: {url}"); Process.Start(url); }
private void OpenDownload() { ExtensionAnalytics.ReportCommand(CommandName.OpenMySQLInstallerDownload, CommandInvocationSource.Button); var url = $"https://dev.mysql.com/downloads/installer/"; Debug.WriteLine($"Opening page to download MySQL Installer: {url}"); Process.Start(url); _owner.Close(); }
private async void OnAddAccountCommand() { ExtensionAnalytics.ReportCommand(CommandName.AddAccountCommand, CommandInvocationSource.Button); Debug.WriteLine("Stating the oauth login flow."); if (await AccountsManager.StartAddAccountFlowAsync()) { Debug.WriteLine($"The user logged in: {CredentialsStore.Default.CurrentAccount.AccountName}"); _owner.Close(); } }
public void DoucleClickedItem(UserAccountViewModel userAccount) { ExtensionAnalytics.ReportCommand(CommandName.DoubleClickedAccountCommand, CommandInvocationSource.ListItem); if (userAccount.IsCurrentAccount) { return; } CredentialsStore.Default.CurrentAccount = userAccount.UserAccount; _owner.Close(); }
private void OnOnlyWindowsClicked() { if (_windowsOnlyButton.IsChecked) { ExtensionAnalytics.ReportCommand(CommandName.ShowAllGceInstancesCommand, CommandInvocationSource.Button); } else { ExtensionAnalytics.ReportCommand(CommandName.ShowOnlyWindowsGceInstancesCommand, CommandInvocationSource.Button); } _windowsOnlyButton.IsChecked = !_windowsOnlyButton.IsChecked; ActualRoot.ShowOnlyWindowsInstances = _windowsOnlyButton.IsChecked; }
private void OpenDataConnectionDialog() { ExtensionAnalytics.ReportCommand(CommandName.OpenMySQLDataConnectionDialog, CommandInvocationSource.Button); // Create a data connection dialog and add all possible data sources to it. DataConnectionDialogFactory factory = (DataConnectionDialogFactory)Package.GetGlobalService(typeof(DataConnectionDialogFactory)); DataConnectionDialog dialog = factory.CreateConnectionDialog(); dialog.AddAllSources(); // Check if the MySQL data source exists. // TODO(talarico): This is added when the user has MySQL for Visual Studio installed. We should also // probably check for the needed pieces in the MySQL Connector/Net. if (dialog.AvailableSources.Contains(MySQLUtils.MySQLDataSource)) { // Pre select the MySQL data source. dialog.SelectedSource = MySQLUtils.MySQLDataSource; // Create the connection string to pre populate the server address in the dialog. MySqlConnectionStringBuilder builderPrePopulate = new MySqlConnectionStringBuilder(); InstanceItem instance = _item.Value; builderPrePopulate.Server = String.IsNullOrEmpty(instance.IpAddress) ? instance.Ipv6Address : instance.IpAddress; dialog.DisplayConnectionString = builderPrePopulate.GetConnectionString(false); bool addDataConnection = dialog.ShowDialog(); if (addDataConnection) { ExtensionAnalytics.ReportCommand(CommandName.AddMySQLDataConnection, CommandInvocationSource.Button); // Create a name for the data connection MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder(dialog.DisplayConnectionString); string database = $"{_instance.Project}[{builder.Server}][{builder.Database}]"; // Add the MySQL data connection to the data explorer DataExplorerConnectionManager manager = (DataExplorerConnectionManager)Package.GetGlobalService(typeof(DataExplorerConnectionManager)); manager.AddConnection(database, MySQLUtils.MySQLDataProvider, dialog.EncryptedConnectionString, true); } } else { // MySQL for Visual Studio isn't installed, prompt the user to install it. ExtensionAnalytics.ReportEvent("MySQLForVisualStudio", "Missing"); MySQLInstallerWindow.PromptUser(); } }
private void OnDeleteAccountCommand() { ExtensionAnalytics.ReportCommand(CommandName.DeleteAccountCommand, CommandInvocationSource.Button); Debug.WriteLine($"Attempting to delete account: {CurrentAccountName}"); if (!UserPromptUtils.YesNoPrompt( String.Format(Resources.ManageAccountsDeleteAccountPromptMessage, CurrentAccountName), Resources.ManageAccountsDeleteAccountPromptTitle)) { ExtensionAnalytics.ReportEvent("DeleteAccountCommandCancelled", "Cancelled"); Debug.WriteLine($"The user cancelled the deletion of the account."); return; } AccountsManager.DeleteAccount(CurrentUserAccount.UserAccount); // Refreshing everything. UserAccountsList = LoadUserCredentialsViewModel(); }
private void OnGetPublishSettings() { ExtensionAnalytics.ReportCommand(CommandName.GetPublishSettingsForGceInstance, CommandInvocationSource.Button); Debug.WriteLine($"Generating Publishing settings for {Instance.Name}"); var storePath = PromptForPublishSettingsPath(Instance.Name); if (storePath == null) { Debug.WriteLine("User canceled saving the pubish settings."); return; } var profile = Instance.GeneratePublishSettings(); File.WriteAllText(storePath, profile); GcpOutputWindow.OutputLine(String.Format(Resources.CloudExplorerGcePublishingSettingsSavedMessage, storePath)); }
/// <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> private void ShowToolWindow(object sender, EventArgs e) { ExtensionAnalytics.EnsureAnalyticsOptIn(); ExtensionAnalytics.ReportCommand(CommandName.OpenCloudExplorerToolWindow, CommandInvocationSource.ToolsMenu); // Get the instance number 0 of this tool window. This window is single instance so this instance // is actually the only one. // The last flag is set to true so that if the tool window does not exists it will be created. ToolWindowPane window = _package.FindToolWindow(typeof(CloudExplorerToolWindow), 0, true); if (window?.Frame == null) { throw new NotSupportedException("Cannot create tool window"); } IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); }
private void OnCloseCommand() { ExtensionAnalytics.ReportCommand(CommandName.OAuthFlowCancel, CommandInvocationSource.Button); _owner.CancelOperation(); }
private void OnOpenTerminalServerSessionCommand() { ExtensionAnalytics.ReportCommand(CommandName.OpenTerminalServerSessionForGceInstanceCommand, CommandInvocationSource.Button); Process.Start("mstsc", $"/v:{Instance.GetPublicIpAddress()}"); }
private void OnRefresh() { ExtensionAnalytics.ReportCommand(CommandName.RefreshDataSource, CommandInvocationSource.Button); RefreshSources(); }
private void OnManageAccountsCommand() { ExtensionAnalytics.ReportCommand(CommandName.OpenManageAccountsDialog, CommandInvocationSource.Button); ManageAccountsWindow.PromptUser(); }