protected override void Handle()
        {
            var rClientPath = RInstallation.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);
        }
        protected override void Handle()
        {
            var path = RInstallation.GetRClientPath();

            if (!string.IsNullOrEmpty(path))
            {
                _shell.ShowMessage(Resources.Message_RClientIsAlreadyInstalled, MessageButtons.OK);
            }
            else
            {
                var installer = _shell.ExportProvider.GetExportedValue <IMicrosoftRClientInstaller>();
                installer.LaunchRClientSetup(_shell);
            }
        }
Exemple #3
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));

            RInstallation.Registry = tr;

            RInstallation.GetRClientPath().Should().Be(rClientRPath);

            var shell = Substitute.For <ICoreShell>();

            shell.ShowMessage(Arg.Any <string>(), Arg.Any <MessageButtons>()).Returns(MessageButtons.Yes);

            RInstallation.GetRInstallPath(null, null, shell).Should().Be(rClientRPath);
            shell.Received(1).ShowMessage(Arg.Any <string>(), Arg.Any <MessageButtons>());

            RInstallation.GetRInstallPath(null, null, shell).Should().Be(rClientRPath);
            shell.Received(1).ShowMessage(Arg.Any <string>(), Arg.Any <MessageButtons>());
        }