Пример #1
0
        // TODO: this probably needs configuration file
        // or another dynamic source of supported versions.

        public static bool VerifyRIsInstalled(string path, bool showErrors)
        {
            RInstallData data = RInstallation.GetInstallationData(path,
                                                                  SupportedRVersionList.MinMajorVersion, SupportedRVersionList.MinMinorVersion,
                                                                  SupportedRVersionList.MaxMajorVersion, SupportedRVersionList.MaxMinorVersion);

            if (data.Status != RInstallStatus.OK)
            {
                if (showErrors)
                {
                    string message = FormatMessage(data);
                    VsAppShell.Current.ShowErrorMessage(message);
                    if (data.Status == RInstallStatus.PathNotSpecified || data.Status == RInstallStatus.UnsupportedVersion)
                    {
                        if (!string.IsNullOrEmpty(path))
                        {
                            // If path is in Tools | Options and yet we can't find proper R
                            // we need to clear this setting.
                            RToolsSettings.Current.RBasePath = null;
                        }
                        RInstallation.GoToRInstallPage();
                    }
                }
                return(false);
            }
            return(true);
        }
Пример #2
0
        public static ActionResult MROInstallPromptAction(Session session)
        {
            ActionResult actionResult = ActionResult.Success;
            DialogResult ds           = DialogResult.No;

            session.Log("Begin R detection action");
            session["InstallMRO"] = "No";

            RInstallData data = RInstallation.GetInstallationData(null,
                                                                  SupportedRVersionList.MinMajorVersion, SupportedRVersionList.MinMinorVersion,
                                                                  SupportedRVersionList.MaxMajorVersion, SupportedRVersionList.MaxMinorVersion);

            if (data.Status != RInstallStatus.OK)
            {
                using (var form = new InstallMROForm()) {
                    ds = form.ShowDialog(new SetupWindowHandle());
                }
            }

            if (ds == DialogResult.Yes)
            {
                session["InstallMRO"] = "Yes";
                RInstallation.GoToRInstallPage();
            }

            session.Log("End R detection action");
            return(actionResult);
        }