Ejemplo n.º 1
0
        public static void PostCommand(this IApplicationShell appShell, Guid guid, int id)
        {
            var uiShell = appShell.GlobalServices.GetService <IVsUIShell>(typeof(SVsUIShell));
            var o       = new object();

            uiShell.PostExecCommand(ref guid, (uint)id, 0, ref o);
        }
Ejemplo n.º 2
0
 public SendToRemoteCommand(ConfiguredProject configuredProject, IRInteractiveWorkflowProvider interactiveWorkflowProvider, IApplicationShell appShell) :
     base(interactiveWorkflowProvider, appShell, new FileSystem())
 {
     _configuredProject           = configuredProject;
     _interactiveWorkflowProvider = interactiveWorkflowProvider;
     _appShell = appShell;
 }
Ejemplo n.º 3
0
 private async Task RMarkdownRenderAsync(IRSession session, IFileSystem fs, string inputFilePath, string outputFilePath, string format, int codePage, IApplicationShell appShell) {
     using (var fts = new DataTransferSession(session, fs)) {
         string currentStatusText = string.Empty;
         uint cookie = 0;
         IVsStatusbar statusBar = null;
         appShell.DispatchOnUIThread(() => {
             statusBar = appShell.GetGlobalService<IVsStatusbar>(typeof(SVsStatusbar));
             statusBar.GetText(out currentStatusText);
             statusBar.Progress(ref cookie, 1, "", 0, 0);
         });
         
         try {
             // TODO: progress and cancellation handling
             appShell.DispatchOnUIThread(() => { statusBar?.Progress(ref cookie, 1, Resources.Info_MarkdownSendingInputFile.FormatInvariant(Path.GetFileName(inputFilePath)), 0, 3); });
             var rmd = await fts.SendFileAsync(inputFilePath, true, null, CancellationToken.None);
             appShell.DispatchOnUIThread(() => { statusBar?.Progress(ref cookie, 1, Resources.Info_MarkdownPublishingFile.FormatInvariant(Path.GetFileName(inputFilePath)), 1, 3); });
             var publishResult = await session.EvaluateAsync<ulong>($"rtvs:::rmarkdown_publish(blob_id = {rmd.Id}, output_format = {format.ToRStringLiteral()}, encoding = 'cp{codePage}')", REvaluationKind.Normal);
             appShell.DispatchOnUIThread(() => { statusBar?.Progress(ref cookie, 1, Resources.Info_MarkdownGetOutputFile.FormatInvariant(Path.GetFileName(outputFilePath)), 2, 3); });
             await fts.FetchFileAsync(new RBlobInfo(publishResult), outputFilePath, true, null, CancellationToken.None);
             appShell.DispatchOnUIThread(() => { statusBar?.Progress(ref cookie, 1, Resources.Info_MarkdownPublishComplete.FormatInvariant(Path.GetFileName(outputFilePath)), 3, 3); });
         } finally {
             appShell.DispatchOnUIThread(() => {
                 statusBar?.Progress(ref cookie, 0, "", 0, 0);
                 statusBar?.SetText(currentStatusText);
             });
         }
     }
 }
Ejemplo n.º 4
0
 public static IntPtr GetDialogOwnerWindow(this IApplicationShell appShell)
 {
     IntPtr vsWindow;
     var uiShell = appShell.GetGlobalService<IVsUIShell>(typeof(SVsUIShell));
     uiShell.GetDialogOwnerHwnd(out vsWindow);
     return vsWindow;
 }
        public void When_application_context_is_started_it_will_initialized_all_the_module_loader()
        {
            MockRepository            mocks       = new MockRepository();
            IModuleLoader             mockLoader1 = mocks.DynamicMock <IModuleLoader>();
            IModuleLoader             mockLoader2 = mocks.DynamicMock <IModuleLoader>();
            IModuleLoader             mockLoader3 = mocks.DynamicMock <IModuleLoader>();
            IApplicationShell         stubShell   = mocks.Stub <IApplicationShell>();
            DefaultApplicationContext context     = mocks.PartialMock <DefaultApplicationContext>(
                stubShell,
                mocks.DynamicMock <ILayoutRegistry>(),
                new IModuleLoader[] { mockLoader1, mockLoader2, mockLoader3 });

            //we may have order dependnecies, let us verify
            //that it does this in order
            using (mocks.Record())
                using (mocks.Ordered())
                {
                    mockLoader1.Initialize(context, stubShell);
                    mockLoader2.Initialize(context, stubShell);
                    mockLoader3.Initialize(context, stubShell);
                }

            using (mocks.Playback())
            {
                context.Start();
            }
        }
Ejemplo n.º 6
0
 public LoadWorkspaceCommand(IApplicationShell appShell, IRInteractiveWorkflow interactiveWorkflow, IProjectServiceAccessor projectServiceAccessor) :
     base(RGuidList.RCmdSetGuid, RPackageCommandId.icmdLoadWorkspace) {
     _appShell = appShell;
     _interactiveWorkflow = interactiveWorkflow;
     _rSession = interactiveWorkflow.RSession;
     _projectServiceAccessor = projectServiceAccessor;
 }
Ejemplo n.º 7
0
 public SaveHistoryCommand(IApplicationShell appShell, ITextView textView, IRHistoryProvider historyProvider, IRInteractiveWorkflow interactiveWorkflow)
     : base(textView, RGuidList.RCmdSetGuid, RPackageCommandId.icmdSaveHistory, false)
 {
     _appShell            = appShell;
     _interactiveWorkflow = interactiveWorkflow;
     _history             = historyProvider.GetAssociatedRHistory(textView);
 }
Ejemplo n.º 8
0
 public SProcPublisherTest(PackageTestFilesFixture files)
 {
     _files       = files;
     _appShell    = Substitute.For <IApplicationShell>();
     _pss         = Substitute.For <IProjectSystemServices>();
     _dacServices = Substitute.For <IDacPackageServices>();
 }
Ejemplo n.º 9
0
 public PublishSProcCommand(IApplicationShell appShell, IProjectSystemServices pss, IFileSystem fs, IDacPackageServicesProvider dacServicesProvider, ISettingsStorage settings) {
     _appShell = appShell;
     _pss = pss;
     _fs = fs;
     _dacServicesProvider = dacServicesProvider;
     _settings = settings;
 }
Ejemplo n.º 10
0
 public static void Apply(IApplicationShell current)
 {
     OverrideBrushes();
     OverrideFontKeys();
     OverrideImageSources(current);
     OverrideStyleKeys();
 }
Ejemplo n.º 11
0
 public PreviewWordCommand(
     ITextView textView,
     IRInteractiveWorkflowProvider workflowProvider,
     IApplicationShell appShell,
     IProcessServices pss,
     IFileSystem fs) :
     base(textView, (int)MdPackageCommandId.icmdPreviewWord, workflowProvider, appShell, pss, fs) { }
Ejemplo n.º 12
0
        public GameConsole(Game game)
            : base(game)
        {
            appShell = (IApplicationShell)game;

            messages = new List <Message>();
        }
Ejemplo n.º 13
0
 public PublishSProcOptionsCommand(IApplicationShell appShell, IProjectSystemServices pss, IProjectConfigurationSettingsProvider pcsp, IDacPackageServicesProvider dacServicesProvider)
 {
     _appShell            = appShell;
     _pss                 = pss;
     _pcsp                = pcsp;
     _dacServicesProvider = dacServicesProvider;
 }
Ejemplo n.º 14
0
 public ApplicationView(IApplicationShell applicationShell)
 {
     this.InitializeComponent();
     this.DataContext = applicationShell;
     RadWindowInteropHelper.SetShowInTaskbar(this, true);
     RadWindowInteropHelper.SetTitle(this, this.Header.ToString());
 }
Ejemplo n.º 15
0
 public SProcPublisher(IApplicationShell appShell, IProjectSystemServices pss, IFileSystem fs, IDacPackageServices dacServices) {
     _appShell = appShell;
     _pss = pss;
     _fs = fs;
     _dacServices = dacServices;
     _outputWindow = new OutputWindowLogWriter(VSConstants.OutputWindowPaneGuid.BuildOutputPane_guid, string.Empty);
 }
Ejemplo n.º 16
0
 public PublishSProcCommand(IApplicationShell appShell, IProjectSystemServices pss, IFileSystem fs, IDacPackageServicesProvider dacServicesProvider)
 {
     _appShell            = appShell;
     _pss                 = pss;
     _fs                  = fs;
     _dacServicesProvider = dacServicesProvider;
 }
Ejemplo n.º 17
0
        public static async Task <SqlPublshOptionsDialog> CreateAsync(
            IApplicationShell appShell, IProjectSystemServices pss, IFileSystem fs, IProjectConfigurationSettingsProvider pcsp, ISettingsStorage settings)
        {
            var dialog = new SqlPublshOptionsDialog(appShell, pss, fs, pcsp, settings);
            await dialog.InitializeModelAsync();

            return(dialog);
        }
Ejemplo n.º 18
0
 public LoadWorkspaceCommand(IApplicationShell appShell, IRInteractiveWorkflow interactiveWorkflow, IProjectServiceAccessor projectServiceAccessor) :
     base(RGuidList.RCmdSetGuid, RPackageCommandId.icmdLoadWorkspace)
 {
     _appShell               = appShell;
     _interactiveWorkflow    = interactiveWorkflow;
     _rSession               = interactiveWorkflow.RSession;
     _projectServiceAccessor = projectServiceAccessor;
 }
Ejemplo n.º 19
0
        private SqlPublshOptionsDialog(IApplicationShell appShell, IProjectSystemServices pss, IFileSystem fs, IProjectConfigurationSettingsProvider pcsp, ISettingsStorage settings) {
            _appShell = appShell;
            _pss = pss;
            _pcsp = pcsp;
            _settings = settings;

            Title = Package.Resources.SqlPublishDialog_Title;
        }
Ejemplo n.º 20
0
        private static void OverrideImageSources(IApplicationShell shell)
        {
            IVsImageService2 imageService = shell.GetGlobalService <IVsImageService2>(typeof(SVsImageService));

            ImageSources.Add      = GetImage(imageService, KnownMonikers.Add);
            ImageSources.Edit     = GetImage(imageService, KnownMonikers.Edit);
            ImageSources.Property = GetImage(imageService, KnownMonikers.Property);
        }
Ejemplo n.º 21
0
 public SProcPublisher(IApplicationShell appShell, IProjectSystemServices pss, IFileSystem fs, IDacPackageServices dacServices)
 {
     _appShell     = appShell;
     _pss          = pss;
     _fs           = fs;
     _dacServices  = dacServices;
     _outputWindow = new OutputWindowLogWriter(VSConstants.OutputWindowPaneGuid.BuildOutputPane_guid, string.Empty);
 }
Ejemplo n.º 22
0
        private SqlPublshOptionsDialog(IApplicationShell appShell, IProjectSystemServices pss, IFileSystem fs, IProjectConfigurationSettingsProvider pcsp)
        {
            _appShell = appShell;
            _pss      = pss;
            _pcsp     = pcsp;

            Title = Package.Resources.SqlPublishDialog_Title;
        }
Ejemplo n.º 23
0
 public PreviewWordCommand(
     ITextView textView,
     IRInteractiveWorkflowProvider workflowProvider,
     IApplicationShell appShell,
     IProcessServices pss,
     IFileSystem fs) :
     base(textView, (int)MdPackageCommandId.icmdPreviewWord, workflowProvider, appShell, pss, fs)
 {
 }
Ejemplo n.º 24
0
        public static async Task<SqlPublshOptionsDialog> CreateAsync(
            IApplicationShell appShell, IProjectSystemServices pss, IProjectConfigurationSettingsProvider pcsp, ISettingsStorage settings) {
            var dialog = await CreateAsync(appShell, pss, new FileSystem(), pcsp, settings);

            await appShell.SwitchToMainThreadAsync();
            dialog.InitializeComponent();
            dialog.InitializeUI();
            return dialog;
        }
Ejemplo n.º 25
0
 public PublishSProcOptionsCommand(IApplicationShell appShell, IProjectSystemServices pss, 
                                   IProjectConfigurationSettingsProvider pcsp, IDacPackageServicesProvider dacServicesProvider,
                                   ISettingsStorage settings) {
     _appShell = appShell;
     _pss = pss;
     _pcsp = pcsp;
     _dacServicesProvider = dacServicesProvider;
     _settings = settings;
 }
 public VsRInteractiveWindowComponentContainerFactory(
     Lazy <IVsInteractiveWindowFactory> vsInteractiveWindowFactory,
     IContentTypeRegistryService contentTypeRegistryService,
     IApplicationShell shell)
 {
     _vsInteractiveWindowFactoryLazy = vsInteractiveWindowFactory;
     _contentTypeRegistryService     = contentTypeRegistryService;
     _shell = shell;
 }
Ejemplo n.º 27
0
        public SettingsPageControl(IProjectConfigurationSettingsProvider settingsProvider, IApplicationShell appShell, IFileSystem fs) {
            Check.ArgumentNull(nameof(settingsProvider), settingsProvider);
            Check.ArgumentNull(nameof(appShell), appShell);
            Check.ArgumentNull(nameof(fs), fs);

            _settingsProvider = settingsProvider;
            _appShell = appShell;
            _fs = fs;
            InitializeComponent();
        }
Ejemplo n.º 28
0
 public async Task PublishAsync(IRSession session, IApplicationShell appShell,  IFileSystem fs, string inputFilePath, string outputFilePath, PublishFormat publishFormat, Encoding encoding) {
     try {
         await RMarkdownRenderAsync(session, fs, inputFilePath, outputFilePath, GetDocumentTypeString(publishFormat), encoding.CodePage, appShell);
     } catch (IOException ex) {
         await appShell.ShowErrorMessageAsync(ex.Message);
     } catch (RException ex) {
         await appShell.ShowErrorMessageAsync(ex.Message);
     } catch (OperationCanceledException) {
     } 
 }
Ejemplo n.º 29
0
 public DefaultApplicationContext(
     IApplicationShell shell,
     ILayoutRegistry layouts,
     IModuleLoader[] loaders
     )
 {
     this.shell   = shell;
     this.layouts = layouts;
     this.loaders = loaders;
 }
		public DefaultApplicationContext(
			IApplicationShell shell,
            ILayoutRegistry layouts,
			IModuleLoader[] loaders
			)
		{
			this.shell = shell;
            this.layouts = layouts;
			this.loaders = loaders;
		}
Ejemplo n.º 31
0
            public void Constructor_WhenCalled_ShouldInitializeTheMandatoryBadWordList()
            {
                // Arrange
                IApplicationShell subject = fixture.Create <BadWordConsoleApplication>();

                // Act
                subject.Run(ignoreFiltering);

                // Assert
                badWordResolverMock.Verify(x => x.AddBadWords(It.Is <BadWord[]>(badwords => CheckMandatoryBadWordsContained(badwords))), Times.Once);
            }
Ejemplo n.º 32
0
            public void Run_WhenCalledWithFiltering_ShouldCallBadWordFilter()
            {
                // Arrange
                IApplicationShell subject = fixture.Create <BadWordConsoleApplication>();

                // Act
                subject.Run(ignoreFiltering: false);

                // Assert
                badWordResolverMock.Verify(x => x.Filter(It.IsAny <string>()), Times.Once);
            }
Ejemplo n.º 33
0
        public SettingsPageControl(IProjectConfigurationSettingsProvider settingsProvider, IApplicationShell appShell, IFileSystem fs)
        {
            Check.ArgumentNull(nameof(settingsProvider), settingsProvider);
            Check.ArgumentNull(nameof(appShell), appShell);
            Check.ArgumentNull(nameof(fs), fs);

            _settingsProvider = settingsProvider;
            _appShell         = appShell;
            _fs = fs;
            InitializeComponent();
        }
Ejemplo n.º 34
0
            public void Run_WhenCalledWithFilteringTurnedOff_ShouldNotUtiliseBadWordFilter()
            {
                // Arrange
                IApplicationShell subject = fixture.Create <BadWordConsoleApplication>();

                // Act
                subject.Run(ignoreFiltering: true);

                // Assert
                badWordResolverMock.Verify(x => x.Filter(It.IsAny <string>()), Times.Never);
            }
Ejemplo n.º 35
0
        public static async Task <SqlPublshOptionsDialog> CreateAsync(
            IApplicationShell appShell, IProjectSystemServices pss, IProjectConfigurationSettingsProvider pcsp, ISettingsStorage settings)
        {
            var dialog = await CreateAsync(appShell, pss, new FileSystem(), pcsp, settings);

            await appShell.SwitchToMainThreadAsync();

            dialog.InitializeComponent();
            dialog.InitializeUI();
            return(dialog);
        }
Ejemplo n.º 36
0
 public PreviewHtmlCommand(
     ITextView textView,
     IRInteractiveWorkflowProvider workflowProvider,
     IApplicationShell appShell,
     IProcessServices pss,
     IFileSystem fs,
     IWebBrowserServices wbs)
     : base(textView, (int)MdPackageCommandId.icmdPreviewHtml,
           workflowProvider, appShell, pss, fs) {
     _wbs = wbs;
 }
Ejemplo n.º 37
0
 public async Task PublishAsync(IRSession session, IApplicationShell appShell, IFileSystem fs, string inputFilePath, string outputFilePath, PublishFormat publishFormat, Encoding encoding)
 {
     try {
         await RMarkdownRenderAsync(session, fs, inputFilePath, outputFilePath, GetDocumentTypeString(publishFormat), encoding.CodePage, appShell);
     } catch (IOException ex) {
         await appShell.ShowErrorMessageAsync(ex.Message);
     } catch (RException ex) {
         await appShell.ShowErrorMessageAsync(ex.Message);
     } catch (OperationCanceledException) {
     }
 }
Ejemplo n.º 38
0
 public static Font GetUiFont(this IApplicationShell appShell)
 {
     var fontSvc = appShell.GetGlobalService<IUIHostLocale2>(typeof(SUIHostLocale));
     if (fontSvc != null) {
         var logFont = new UIDLGLOGFONT[1];
         int hr = fontSvc.GetDialogFont(logFont);
         if (hr == VSConstants.S_OK && logFont[0].lfFaceName != null) {
             return IdeUtilities.FontFromUiDialogFont(logFont[0]);
         }
     }
     return null;
 }
Ejemplo n.º 39
0
 public PreviewHtmlCommand(
     ITextView textView,
     IRInteractiveWorkflowProvider workflowProvider,
     IApplicationShell appShell,
     IProcessServices pss,
     IFileSystem fs,
     IWebBrowserServices wbs)
     : base(textView, (int)MdPackageCommandId.icmdPreviewHtml,
            workflowProvider, appShell, pss, fs)
 {
     _wbs = wbs;
 }
Ejemplo n.º 40
0
        public MainWindow(IApplicationShell shell)
        {
            Content = shell;

            CanClose = (() => true);
            Closing += (s, e) => e.Cancel = !CanClose();
            ;

            WindowStartupLocation = WindowStartupLocation.CenterOwner;
            WindowState = WindowState.Maximized;
            Height = 800;
            Width = 1200;
        }
Ejemplo n.º 41
0
        public MainWindow(IApplicationShell shell)
        {
            Content = shell;

            CanClose = (() => true);
            Closing += (s, e) => e.Cancel = !CanClose();

            Closed += (s, e) => Application.Current.Shutdown();

            WindowStartupLocation = WindowStartupLocation.CenterOwner;
            WindowState           = WindowState.Maximized;
            Height = 800;
            Width  = 1200;
        }
Ejemplo n.º 42
0
        public PreviewCommand(ITextView textView, int id,
            IRInteractiveWorkflowProvider workflowProvider,
            IApplicationShell appShell,
            IProcessServices pss,
            IFileSystem fs)
            : base(textView, new CommandId[] { new CommandId(MdPackageCommandId.MdCmdSetGuid, id) }, false) {
            _workflowProvider = workflowProvider;
            AppShell = appShell;
            _pss = pss;
            _fs = fs;

            IEnumerable<Lazy<IMarkdownFlavorPublishHandler>> handlers = AppShell.ExportProvider.GetExports<IMarkdownFlavorPublishHandler>();
            foreach (var h in handlers) {
                _flavorHandlers[h.Value.Flavor] = h.Value;
            }
        }
Ejemplo n.º 43
0
        public static async Task OpenDataCsvApp(IREvaluationResultInfo result, IApplicationShell appShell, IFileSystem fileSystem, IProcessServices processServices)
        {
            await appShell.SwitchToMainThreadAsync();

            if (Interlocked.Exchange(ref _busy, 1) > 0)
            {
                return;
            }

            var workflow = appShell.ExportProvider.GetExportedValue <IRInteractiveWorkflowProvider>().GetOrCreate();
            var session  = workflow.RSession;

            var folder = GetTempCsvFilesFolder();

            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }

            var pss          = appShell.ExportProvider.GetExportedValue <IProjectSystemServices>();
            var variableName = result.Name ?? _variableNameReplacement;
            var csvFileName  = MakeCsvFileName(appShell, pss, variableName);

            var file = pss.GetUniqueFileName(folder, csvFileName, "csv", appendUnderscore: true);

            string currentStatusText;
            var    statusBar = appShell.GetGlobalService <IVsStatusbar>(typeof(SVsStatusbar));

            statusBar.GetText(out currentStatusText);

            try {
                statusBar.SetText(Resources.Status_WritingCSV);
                appShell.ProgressDialog.Show(async(p, ct) => await CreateCsvAndStartProcess(result, session, file, fileSystem, p), Resources.Status_WritingCSV, 100, 500);
                if (fileSystem.FileExists(file))
                {
                    processServices.Start(file);
                }
            } catch (Win32Exception ex) {
                appShell.ShowErrorMessage(string.Format(CultureInfo.InvariantCulture, Resources.Error_CannotOpenCsv, ex.Message));
            } catch (IOException ex) {
                appShell.ShowErrorMessage(string.Format(CultureInfo.InvariantCulture, Resources.Error_CannotOpenCsv, ex.Message));
            } finally {
                statusBar.SetText(currentStatusText);
            }

            Interlocked.Exchange(ref _busy, 0);
        }
Ejemplo n.º 44
0
        public ProjectSettingsControlTest(PackageTestFilesFixture files) {
            _files = files;
            _appShell = Substitute.For<IApplicationShell>();
            _fs = Substitute.For<IFileSystem>();

            _access = Substitute.For<IProjectConfigurationSettingsAccess>();
            _access.Settings.Returns(_coll);

            _csp = Substitute.For<IProjectConfigurationSettingsProvider>();
            _csp.OpenProjectSettingsAccessAsync(null, null).ReturnsForAnyArgs(Task.FromResult(_access));

            _unconfiguredProject = Substitute.For<UnconfiguredProject>();
            _unconfiguredProject.FullPath.Returns(@"C:\file.rproj");

            _properties = Substitute.For<IRProjectProperties>();
            _properties.GetSettingsFileAsync().Returns(Task.FromResult<string>(null));
        }
Ejemplo n.º 45
0
        public ProjectSettingsControlTest(PackageTestFilesFixture files)
        {
            _files    = files;
            _appShell = Substitute.For <IApplicationShell>();
            _fs       = Substitute.For <IFileSystem>();

            _access = Substitute.For <IProjectConfigurationSettingsAccess>();
            _access.Settings.Returns(_coll);

            _csp = Substitute.For <IProjectConfigurationSettingsProvider>();
            _csp.OpenProjectSettingsAccessAsync(null, null).ReturnsForAnyArgs(Task.FromResult(_access));

            _unconfiguredProject = Substitute.For <UnconfiguredProject>();
            _unconfiguredProject.FullPath.Returns(@"C:\file.rproj");

            _properties = Substitute.For <IRProjectProperties>();
            _properties.GetSettingsFileAsync().Returns(Task.FromResult <string>(null));
        }
        public VsRInteractiveWorkflowProvider(IConnectionManagerProvider connectionsProvider
            , IRHistoryProvider historyProvider
            , IRPackageManagerProvider packagesProvider
            , IRPlotManagerProvider plotsProvider
            , IActiveWpfTextViewTracker activeTextViewTracker
            , IDebuggerModeTracker debuggerModeTracker
            , IApplicationShell shell
            , IRSettings settings) {

            _connectionsProvider = connectionsProvider;
            _historyProvider = historyProvider;
            _packagesProvider = packagesProvider;
            _plotsProvider = plotsProvider;
            _activeTextViewTracker = activeTextViewTracker;
            _debuggerModeTracker = debuggerModeTracker;
            _shell = shell;
            _settings = settings;

            _shell.Terminating += OnApplicationTerminating;
        }
Ejemplo n.º 47
0
        public static async Task OpenDataCsvApp(IREvaluationResultInfo result, IApplicationShell appShell, IFileSystem fileSystem, IProcessServices processServices) {
            await appShell.SwitchToMainThreadAsync();

            if (Interlocked.Exchange(ref _busy, 1) > 0) {
                return;
            }

            var workflow = appShell.ExportProvider.GetExportedValue<IRInteractiveWorkflowProvider>().GetOrCreate();
            var session = workflow.RSession;

            var folder = GetTempCsvFilesFolder();
            if (!Directory.Exists(folder)) {
                Directory.CreateDirectory(folder);
            }

            var pss = appShell.ExportProvider.GetExportedValue<IProjectSystemServices>();
            var variableName = result.Name ?? _variableNameReplacement;
            var csvFileName = MakeCsvFileName(appShell, pss, variableName);

            var file = pss.GetUniqueFileName(folder, csvFileName, "csv", appendUnderscore: true);

            string currentStatusText;
            var statusBar = appShell.GetGlobalService<IVsStatusbar>(typeof(SVsStatusbar));
            statusBar.GetText(out currentStatusText);

            try {
                statusBar.SetText(Resources.Status_WritingCSV);
                appShell.ProgressDialog.Show(async (p, ct) => await CreateCsvAndStartProcess(result, session, file, fileSystem, p, ct), Resources.Status_WritingCSV, 100, 500);
                if (fileSystem.FileExists(file)) {
                    processServices.Start(file);
                }
            } catch (Exception ex) when (ex is Win32Exception || ex is IOException || ex is UnauthorizedAccessException) {
                appShell.ShowErrorMessage(string.Format(CultureInfo.InvariantCulture, Resources.Error_CannotOpenCsv, ex.Message));
            } finally {
                statusBar.SetText(currentStatusText);
            }

            Interlocked.Exchange(ref _busy, 0);
        }
Ejemplo n.º 48
0
 public VsFileDialog(IApplicationShell shell) {
     _shell = shell;
 }
Ejemplo n.º 49
0
 public SourceFilesCommand(ConfiguredProject configuredProject, IRInteractiveWorkflowProvider interactiveWorkflowProvider, IApplicationShell appShell) :
     base(interactiveWorkflowProvider, appShell, new FileSystem()) {
     _configuredProject = configuredProject;
     _interactiveWorkflowProvider = interactiveWorkflowProvider;
     _appShell = appShell;
 }
Ejemplo n.º 50
0
		public void Initialize(IApplicationContext context, IApplicationShell shell)
		{
			throw new NotImplementedException();
		}
Ejemplo n.º 51
0
 public SaveHistoryCommand(IApplicationShell appShell, ITextView textView, IRHistoryProvider historyProvider, IRInteractiveWorkflow interactiveWorkflow)
     : base(textView, RGuidList.RCmdSetGuid, RPackageCommandId.icmdSaveHistory, false) {
     _appShell = appShell;
     _interactiveWorkflow = interactiveWorkflow;
     _history = historyProvider.GetAssociatedRHistory(textView);
 }
Ejemplo n.º 52
0
		public void Initialize(IApplicationContext context, IApplicationShell shell)
		{
			shell.AddMenuItems(menuItemDatas);
		}
Ejemplo n.º 53
0
 public CommandTest() {
     _appShell = Substitute.For<IApplicationShell>();
     _pss = Substitute.For<IProjectSystemServices>();
 }
		public void Initialize(IApplicationContext context, IApplicationShell shell)
		{
			context.Layouts.AddView(mainContent);
		}
Ejemplo n.º 55
0
 public HideAllPlotWindowsCommand(IApplicationShell appShell) :
     base(RGuidList.RCmdSetGuid, RPackageCommandId.icmdPlotWindowsHideAll) {
     _appShell = appShell;
     _shell = appShell.GetGlobalService<IVsUIShell4>(typeof(SVsUIShell));
 }
Ejemplo n.º 56
0
 public ImportDataSetTextFileCommand(IApplicationShell appShell, IRSession session) :
     base(session, RGuidList.RCmdSetGuid, RPackageCommandId.icmdImportDatasetTextFile) {
     _appShell = appShell;
 }
Ejemplo n.º 57
0
 public static async Task<SqlPublshOptionsDialog> CreateAsync(
     IApplicationShell appShell, IProjectSystemServices pss, IFileSystem fs, IProjectConfigurationSettingsProvider pcsp, ISettingsStorage settings) {
     var dialog = new SqlPublshOptionsDialog(appShell, pss, fs, pcsp, settings);
     await dialog.InitializeModelAsync();
     return dialog;
 }
Ejemplo n.º 58
0
 public AddDsnCommand(IApplicationShell appShell, IRInteractiveWorkflow workflow) :
     base(RPackageCommandId.icmdAddDsn, workflow) {
     _appShell = appShell;
 }
Ejemplo n.º 59
0
 public PublishSProcCommand(IApplicationShell appShell, IProjectSystemServices pss, IDacPackageServicesProvider dacServicesProvider, ISettingsStorage settings) :
     this(appShell, pss, new FileSystem(), dacServicesProvider, settings) {
 }
Ejemplo n.º 60
0
 protected SendFileCommandBase(IRInteractiveWorkflowProvider interactiveWorkflowProvider, IApplicationShell appShell, IFileSystem fs) {
     _interactiveWorkflowProvider = interactiveWorkflowProvider;
     _appShell = appShell;
     _fs = fs;
 }