Ejemplo n.º 1
0
        protected override void Initialize()
        {
            Current = this;

            VsAppShell.EnsureInitialized();
            if (IsCommandLineMode())
            {
                return;
            }

            VsWpfOverrides.Apply();
            CranMirrorList.Download();

            RtvsTelemetry.Initialize(_packageIndex);

            using (var p = Current.GetDialogPage(typeof(RToolsOptionsPage)) as RToolsOptionsPage) {
                p?.LoadSettings();
            }

            MicrosoftRClient.CheckInstall(VsAppShell.Current);
            base.Initialize();

            ProjectIconProvider.LoadProjectImages();
            LogCleanup.DeleteLogsAsync(DiagnosticLogs.DaysToRetain);

            BuildFunctionIndex();
            AdviseExportedWindowFrameEvents <ActiveWpfTextViewTracker>();
            AdviseExportedWindowFrameEvents <VsActiveRInteractiveWindowTracker>();
            AdviseExportedDebuggerEvents <VsDebuggerModeTracker>();

            IdleTimeAction.Create(ExpansionsCache.Load, 200, typeof(ExpansionsCache), VsAppShell.Current);
            IdleTimeAction.Create(() => RtvsTelemetry.Current.ReportConfiguration(), 5000, typeof(RtvsTelemetry), VsAppShell.Current);
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
                }
            }
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        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());
                }
            }
        }
Ejemplo n.º 7
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>());
        }
Ejemplo n.º 8
0
        protected override void Initialize()
        {
            Current = this;

            // Force app shell creation before everything else
            var shell = VsAppShell.Current;

            if (IsCommandLineMode())
            {
                return;
            }

            VsWpfOverrides.Apply();
            CranMirrorList.Download();

            RtvsTelemetry.Initialize();

            using (var p = Current.GetDialogPage(typeof(RToolsOptionsPage)) as RToolsOptionsPage) {
                p.LoadSettings();
            }

            MicrosoftRClient.CheckInstall(VsAppShell.Current);
            base.Initialize();

            ProjectIconProvider.LoadProjectImages();
            LogCleanup.DeleteLogsAsync(DiagnosticLogs.DaysToRetain);

            _indexBuildingTask = FunctionIndex.BuildIndexAsync();

            AdviseExportedWindowFrameEvents <ActiveWpfTextViewTracker>();
            AdviseExportedWindowFrameEvents <VsActiveRInteractiveWindowTracker>();
            AdviseExportedDebuggerEvents <VsDebuggerModeTracker>();

            System.Threading.Tasks.Task.Run(() => RtvsTelemetry.Current.ReportConfiguration());

            IdleTimeAction.Create(ExpansionsCache.Load, 200, typeof(ExpansionsCache));
        }