protected override void Handle() { var rClientPath = MicrosoftRClient.GetRClientPath(); if (string.IsNullOrEmpty(rClientPath)) { if (_shell.ShowMessage(Resources.Prompt_RClientNotInstalled, MessageButtons.YesNo) == MessageButtons.Yes) { var installer = _shell.ExportProvider.GetExportedValue <IMicrosoftRClientInstaller>(); installer.LaunchRClientSetup(_shell); return; } } var connection = _connectionManager.ActiveConnection; if (!connection.IsRemote && !string.IsNullOrEmpty(connection.Path) && connection.Path.EqualsIgnoreCase(rClientPath)) { _shell.ShowMessage(Resources.Message_RClientIsAlreadySet, MessageButtons.OK); return; } connection = _connectionManager.GetOrAddConnection("Microsoft R Client", rClientPath, string.Empty); _connectionManager.ConnectAsync(connection).DoNotWait(); }
protected override void Handle() { var rClientPath = MicrosoftRClient.GetRClientPath(); if (string.IsNullOrEmpty(rClientPath)) { if (_shell.ShowMessage(Resources.Prompt_RClientNotInstalled, MessageButtons.YesNo) == MessageButtons.Yes) { var installer = _shell.ExportProvider.GetExportedValue <IMicrosoftRClientInstaller>(); installer.LaunchRClientSetup(_shell); return; } } var currentRPath = RToolsSettings.Current.RBasePath; if (!string.IsNullOrEmpty(currentRPath) && currentRPath.EqualsIgnoreCase(rClientPath)) { _shell.ShowMessage(Resources.Message_RClientIsAlreadySet, MessageButtons.OK); return; } using (var page = RPackage.Current.GetDialogPage(typeof(RToolsOptionsPage)) as RToolsOptionsPage) { RToolsSettings.Current.RBasePath = rClientPath; page.SaveSettings(); } _shell.ShowMessage(Resources.RPathChangedRestartVS, MessageButtons.OK); }
public void ReportConfiguration() { if (TelemetryService.IsEnabled) { try { Assembly thisAssembly = Assembly.GetExecutingAssembly(); TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RtvsVersion, thisAssembly.GetName().Version.ToString()); string rInstallPath = RInstallation.GetRInstallPath(RToolsSettings.Current.RBasePath); TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RInstallPath, rInstallPath); string rClientPath = MicrosoftRClient.GetRClientPath(); if (rClientPath != null) { TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RClientFound); if (rInstallPath != null && rInstallPath.EqualsIgnoreCase(rClientPath)) { TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RClientActive); } } var rEngines = GetRSubfolders("R"); foreach (var s in rEngines) { TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.REngine, s); } var rroEngines = GetRSubfolders("RRO"); foreach (var s in rroEngines) { TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RROEngine, s); } var mroEngines = GetRSubfolders("MRO"); foreach (var s in mroEngines) { TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.MROEngine, s); } var hashes = RPackageData.GetInstalledPackageHashes(RPackageType.Base); foreach (var s in hashes) { TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RBasePackages, s); } hashes = RPackageData.GetInstalledPackageHashes(RPackageType.User); foreach (var s in hashes) { TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RUserPackages, s); } } catch (Exception ex) { Trace.Fail("Telemetry exception: " + ex.Message); } } }
protected override void Handle() { var path = MicrosoftRClient.GetRClientPath(); if (!string.IsNullOrEmpty(path)) { _shell.ShowMessage(Resources.Message_RClientIsAlreadyInstalled, MessageButtons.OK); } else { var installer = _shell.ExportProvider.GetExportedValue <IMicrosoftRClientInstaller>(); installer.LaunchRClientSetup(_shell); } }
private void ReportLocalRConfiguration() { // Report local R installation string rInstallPath = new RInstallation().GetRInstallPath(); TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RInstallPath, rInstallPath); string rClientPath = MicrosoftRClient.GetRClientPath(); if (rClientPath != null) { TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RClientFound); if (rInstallPath != null && rInstallPath.EqualsIgnoreCase(rClientPath)) { TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RClientActive); } } var rEngines = GetRSubfolders("R"); foreach (var s in rEngines) { TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.REngine, s); } var rroEngines = GetRSubfolders("RRO"); foreach (var s in rroEngines) { TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RROEngine, s); } var mroEngines = GetRSubfolders("MRO"); foreach (var s in mroEngines) { TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.MROEngine, s); } if (_packageIndex != null) { foreach (var p in _packageIndex.Packages) { TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RPackages, p.Name.GetMD5Hash()); } } }
public void MsRClient() { var rClientInstallPath = @"C:\Program Files\Microsoft\R Client\"; var rClientRPath = @"C:\Program Files\Microsoft\R Client\R_SERVER\"; var tr = new RegistryMock(SimulateRegistryMsRClient(rClientInstallPath, rClientRPath)); MicrosoftRClient.Registry = tr; MicrosoftRClient.GetRClientPath().Should().Be(rClientRPath); var shell = Substitute.For <ICoreShell>(); shell.ShowMessage(Arg.Any <string>(), Arg.Any <MessageButtons>()).Returns(MessageButtons.Yes); shell.MainThread.Returns(Thread.CurrentThread); MicrosoftRClient.CheckMicrosoftRClientInstall(shell); shell.Received(1).ShowMessage(Arg.Any <string>(), Arg.Any <MessageButtons>()); MicrosoftRClient.CheckMicrosoftRClientInstall(shell); shell.Received(1).ShowMessage(Arg.Any <string>(), Arg.Any <MessageButtons>()); }