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); }
public SendToRemoteCommand(ConfiguredProject configuredProject, IRInteractiveWorkflowProvider interactiveWorkflowProvider, IApplicationShell appShell) : base(interactiveWorkflowProvider, appShell, new FileSystem()) { _configuredProject = configuredProject; _interactiveWorkflowProvider = interactiveWorkflowProvider; _appShell = appShell; }
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); }); } } }
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(); } }
public LoadWorkspaceCommand(IApplicationShell appShell, IRInteractiveWorkflow interactiveWorkflow, IProjectServiceAccessor projectServiceAccessor) : base(RGuidList.RCmdSetGuid, RPackageCommandId.icmdLoadWorkspace) { _appShell = appShell; _interactiveWorkflow = interactiveWorkflow; _rSession = interactiveWorkflow.RSession; _projectServiceAccessor = projectServiceAccessor; }
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); }
public SProcPublisherTest(PackageTestFilesFixture files) { _files = files; _appShell = Substitute.For <IApplicationShell>(); _pss = Substitute.For <IProjectSystemServices>(); _dacServices = Substitute.For <IDacPackageServices>(); }
public PublishSProcCommand(IApplicationShell appShell, IProjectSystemServices pss, IFileSystem fs, IDacPackageServicesProvider dacServicesProvider, ISettingsStorage settings) { _appShell = appShell; _pss = pss; _fs = fs; _dacServicesProvider = dacServicesProvider; _settings = settings; }
public static void Apply(IApplicationShell current) { OverrideBrushes(); OverrideFontKeys(); OverrideImageSources(current); OverrideStyleKeys(); }
public PreviewWordCommand( ITextView textView, IRInteractiveWorkflowProvider workflowProvider, IApplicationShell appShell, IProcessServices pss, IFileSystem fs) : base(textView, (int)MdPackageCommandId.icmdPreviewWord, workflowProvider, appShell, pss, fs) { }
public GameConsole(Game game) : base(game) { appShell = (IApplicationShell)game; messages = new List <Message>(); }
public PublishSProcOptionsCommand(IApplicationShell appShell, IProjectSystemServices pss, IProjectConfigurationSettingsProvider pcsp, IDacPackageServicesProvider dacServicesProvider) { _appShell = appShell; _pss = pss; _pcsp = pcsp; _dacServicesProvider = dacServicesProvider; }
public ApplicationView(IApplicationShell applicationShell) { this.InitializeComponent(); this.DataContext = applicationShell; RadWindowInteropHelper.SetShowInTaskbar(this, true); RadWindowInteropHelper.SetTitle(this, this.Header.ToString()); }
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); }
public PublishSProcCommand(IApplicationShell appShell, IProjectSystemServices pss, IFileSystem fs, IDacPackageServicesProvider dacServicesProvider) { _appShell = appShell; _pss = pss; _fs = fs; _dacServicesProvider = dacServicesProvider; }
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); }
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; }
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); }
private SqlPublshOptionsDialog(IApplicationShell appShell, IProjectSystemServices pss, IFileSystem fs, IProjectConfigurationSettingsProvider pcsp) { _appShell = appShell; _pss = pss; _pcsp = pcsp; Title = Package.Resources.SqlPublishDialog_Title; }
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; }
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; }
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(); }
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) { } }
public DefaultApplicationContext( IApplicationShell shell, ILayoutRegistry layouts, IModuleLoader[] loaders ) { this.shell = shell; this.layouts = layouts; this.loaders = loaders; }
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); }
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); }
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); }
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); }
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; }
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; }
public MainWindow(IApplicationShell shell) { Content = shell; CanClose = (() => true); Closing += (s, e) => e.Cancel = !CanClose(); ; WindowStartupLocation = WindowStartupLocation.CenterOwner; WindowState = WindowState.Maximized; Height = 800; Width = 1200; }
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; }
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; } }
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); }
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 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; }
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); }
public VsFileDialog(IApplicationShell shell) { _shell = shell; }
public SourceFilesCommand(ConfiguredProject configuredProject, IRInteractiveWorkflowProvider interactiveWorkflowProvider, IApplicationShell appShell) : base(interactiveWorkflowProvider, appShell, new FileSystem()) { _configuredProject = configuredProject; _interactiveWorkflowProvider = interactiveWorkflowProvider; _appShell = appShell; }
public void Initialize(IApplicationContext context, IApplicationShell shell) { throw new NotImplementedException(); }
public void Initialize(IApplicationContext context, IApplicationShell shell) { shell.AddMenuItems(menuItemDatas); }
public CommandTest() { _appShell = Substitute.For<IApplicationShell>(); _pss = Substitute.For<IProjectSystemServices>(); }
public void Initialize(IApplicationContext context, IApplicationShell shell) { context.Layouts.AddView(mainContent); }
public HideAllPlotWindowsCommand(IApplicationShell appShell) : base(RGuidList.RCmdSetGuid, RPackageCommandId.icmdPlotWindowsHideAll) { _appShell = appShell; _shell = appShell.GetGlobalService<IVsUIShell4>(typeof(SVsUIShell)); }
public ImportDataSetTextFileCommand(IApplicationShell appShell, IRSession session) : base(session, RGuidList.RCmdSetGuid, RPackageCommandId.icmdImportDatasetTextFile) { _appShell = appShell; }
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; }
public AddDsnCommand(IApplicationShell appShell, IRInteractiveWorkflow workflow) : base(RPackageCommandId.icmdAddDsn, workflow) { _appShell = appShell; }
public PublishSProcCommand(IApplicationShell appShell, IProjectSystemServices pss, IDacPackageServicesProvider dacServicesProvider, ISettingsStorage settings) : this(appShell, pss, new FileSystem(), dacServicesProvider, settings) { }
protected SendFileCommandBase(IRInteractiveWorkflowProvider interactiveWorkflowProvider, IApplicationShell appShell, IFileSystem fs) { _interactiveWorkflowProvider = interactiveWorkflowProvider; _appShell = appShell; _fs = fs; }