Ejemplo n.º 1
0
        protected override void Handle()
        {
            var rClientPath = SqlRClientInstallation.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, isUserCreated: false);
            _connectionManager.ConnectAsync(connection).DoNotWait();
        }
Ejemplo n.º 2
0
        protected override void Handle()
        {
            var path = SqlRClientInstallation.GetRClientPath();

            if (!string.IsNullOrEmpty(path))
            {
                _services.UI().ShowMessage(Resources.Message_RClientIsAlreadyInstalled, MessageButtons.OK);
            }
            else
            {
                var installer = _services.GetService <IMicrosoftRClientInstaller>();
                installer.LaunchRClientSetup(_services);
            }
        }
Ejemplo n.º 3
0
        private void ReportLocalRConfiguration()
        {
            // Report local R installations
            var engines = new RInstallation().GetCompatibleEngines();

            foreach (var e in engines)
            {
                TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RInstallPath, e.InstallPath);
            }

            string rClientPath = SqlRClientInstallation.GetRClientPath();

            if (rClientPath != null)
            {
                TelemetryService.ReportEvent(TelemetryArea.Configuration, ConfigurationEvents.RClientFound);
            }

            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, new TelemetryPiiProperty(p.Name));
                }
            }
        }
Ejemplo n.º 4
0
        internal static string CheckMicrosoftRClientInstall(ICoreShell coreShell, IRegistry registry = null)
        {
            coreShell.AssertIsOnMainThread();
            registry = registry ?? new RegistryImpl();

            var rClientPath = SqlRClientInstallation.GetRClientPath(registry);

            if (!string.IsNullOrEmpty(rClientPath) && AskUserSwitchToRClient(registry))
            {
                // Get R Client path
                if (MessageButtons.Yes == coreShell.ShowMessage(Resources.Prompt_MsRClientJustInstalled, MessageButtons.YesNo))
                {
                    return(rClientPath);
                }
            }
            return(null);
        }
Ejemplo n.º 5
0
        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));

            SqlRClientInstallation.GetRClientPath(tr).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, tr);
            shell.Received(1).ShowMessage(Arg.Any <string>(), Arg.Any <MessageButtons>());

            MicrosoftRClient.CheckMicrosoftRClientInstall(shell);
            shell.Received(1).ShowMessage(Arg.Any <string>(), Arg.Any <MessageButtons>());
        }