public GestureViewModel(IGestureService gestureService, IShellEvents shellEvents) { Switch = ReactiveCommand.Create(() => { Block = !Block; }); this.WhenActivated((CompositeDisposable disposable) => { shellEvents.SetTitle("Gesture Example"); Observable.FromEventPattern <GestureEventArgs>( h => gestureService.GoBackRequested += h, h => gestureService.GoBackRequested -= h) .Subscribe(e => { if (!e.EventArgs.Handled && Block) { e.EventArgs.Handled = true; } }) .DisposeWith(disposable); Disposable .Create(() => { // This is called when the view model is out of view. }) .DisposeWith(disposable); }); Summary = "This sample shows the GesstureService.\nWhen the switch is ON navigation will not work.\n" + "This is because we handle it inside the viewmodel and we use the service in our main activity for back navigation."; }
/// <summary> /// Initializes a new instance of the <see cref="TraceOutputWindowPane"/> class. /// </summary> /// <param name="serviceProvider">The service provider.</param> /// <param name="shellEvents">The shell events.</param> /// <param name="outputPaneId">The output pane GUID, which must be unique and remain constant for a given pane.</param> /// <param name="outputPaneTitle">The output pane title.</param> /// <param name="traceSourceNames">The names of the trace sources to write to the output window pane.</param> public TraceOutputWindowPane(IServiceProvider serviceProvider, IShellEvents shellEvents, Guid outputPaneId, string outputPaneTitle, params string[] traceSourceNames) { Guard.NotNull(() => serviceProvider, serviceProvider); Guard.NotNull(() => shellEvents, shellEvents); Guard.NotNullOrEmpty(() => outputPaneTitle, outputPaneTitle); Guard.NotNull(() => traceSourceNames, traceSourceNames); this.serviceProvider = serviceProvider; this.outputPaneGuid = outputPaneId; this.outputPaneTitle = outputPaneTitle; this.traceSourceNames = traceSourceNames; this.shellEvents = shellEvents; this.shellEvents.ShellInitialized += this.OnShellInitialized; // Create a temporary writer that buffers events that happen // before shell initialization is completed, so that we don't // miss anything. this.temporaryWriter = new StringWriter(CultureInfo.CurrentCulture); this.listener = new TextWriterTraceListener(this.temporaryWriter, this.outputPaneTitle); this.listener.IndentLevel = 4; this.listener.Filter = defaultFilter; this.AddListenerToSources(); }
public PatternManager( [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, ISolution solution, IShellEvents shellEvents, ISolutionEvents solutionEvents, IItemEvents itemEvents, IEnumerable <IInstalledToolkitInfo> installedToolkits, IUserMessageService messageService) { Guard.NotNull(() => serviceProvider, serviceProvider); Guard.NotNull(() => solution, solution); Guard.NotNull(() => shellEvents, shellEvents); Guard.NotNull(() => solutionEvents, solutionEvents); Guard.NotNull(() => itemEvents, itemEvents); Guard.NotNull(() => installedToolkits, installedToolkits); Guard.NotNull(() => messageService, messageService); this.serviceProvider = serviceProvider; this.solution = solution; this.solutionEvents = solutionEvents; this.shellEvents = shellEvents; this.itemEvents = itemEvents; this.installedToolkits = installedToolkits.ToArray(); this.messageService = messageService; this.solutionEvents.SolutionOpened += this.OnSolutionOpened; this.solutionEvents.SolutionClosing += this.OnSolutionClosing; this.itemEvents.ItemRemoved += OnItemRemoved; }
public TraceOutputWindowManager( [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, [Import(typeof(IShellEvents))] IShellEvents shellEvents) { this.tracePanes = new List <TraceOutputWindowPane>(); this.serviceProvider = serviceProvider; this.shellEvents = shellEvents; }
public TraceOutputWindowManager( [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, [Import(typeof(IShellEvents))] IShellEvents shellEvents) { this.tracePanes = new List<TraceOutputWindowPane>(); this.serviceProvider = serviceProvider; this.shellEvents = shellEvents; }
/// <summary> /// Initializes a new instance of the <see cref="OutputWindowManager" /> class. /// </summary> /// <param name="serviceProvider">The service provider.</param> /// <param name="shellEvents">The shell events.</param> /// <param name="uiThread">The UI thread.</param> public OutputWindowManager(IServiceProvider serviceProvider, IShellEvents shellEvents, Lazy <IUIThread> uiThread) { Guard.NotNull(() => serviceProvider, serviceProvider); Guard.NotNull(() => shellEvents, shellEvents); Guard.NotNull(() => uiThread, uiThread); this.serviceProvider = serviceProvider; this.shellEvents = shellEvents; this.uiThread = uiThread; }
/// <summary> /// Initializes a new instance of the <see cref="OutputWindowManager" /> class. /// </summary> /// <param name="serviceProvider">The service provider.</param> /// <param name="shellEvents">The shell events.</param> /// <param name="uiThread">The UI thread.</param> public OutputWindowManager(IServiceProvider serviceProvider, IShellEvents shellEvents, Lazy<IUIThread> uiThread) { Guard.NotNull(() => serviceProvider, serviceProvider); Guard.NotNull(() => shellEvents, shellEvents); Guard.NotNull(() => uiThread, uiThread); this.serviceProvider = serviceProvider; this.shellEvents = shellEvents; this.uiThread = uiThread; }
public DevEnvImpl( ClideSettings settings, IServiceLocator serviceLocator, IEnumerable <Lazy <IToolWindow> > toolWindows, Lazy <IDialogWindowFactory> dialogFactory, Lazy <IUIThread> uiThread, Lazy <IMessageBoxService> messageBox, IShellEvents shellEvents, Lazy <IReferenceService> references, IErrorsManager errorsManager, Lazy <IOutputWindowManager> outputWindow) { this.serviceLocator = serviceLocator; this.dialogFactory = dialogFactory; this.toolWindows = toolWindows; this.shellEvents = shellEvents; this.uiThread = uiThread; this.messageBox = messageBox; this.status = new Lazy <IStatusBar>(() => new StatusBar(this.ServiceLocator)); this.references = references; this.errorsManager = errorsManager; this.outputWindow = outputWindow; TracingExtensions.ErrorsManager = this.errorsManager; if (settings.Debug) { Tracer.Manager.AddListener(Strings.Trace.RootSource, new TextTraceListener(outputWindow.Value.GetPane(new Guid(Strings.Trace.OutputPaneId), Strings.Trace.OutputPaneTitle))); } Tracer.Manager.SetTracingLevel(Strings.Trace.RootSource, settings.TracingLevel); this.isElevated = new Lazy <bool>(() => { var shell = this.ServiceLocator.TryGetService <SVsShell, IVsShell3>(); if (shell == null) { return(false); } bool elevated; shell.IsRunningElevated(out elevated); return(elevated); }); }
public TabsViewModel(IShellEvents shellEvents) { this.WhenActivated((CompositeDisposable disposable) => { shellEvents.SetTitle("Tabs Example"); Disposable .Create(() => { // This is called when the view model is out of view. }) .DisposeWith(disposable); }); Summary = "This is an example of PagerTabsManager for android.\n" + "We use a viewpager (PagerAdapter) and a tablayout."; }
public DevEnvImpl( ClideSettings settings, IServiceLocator serviceLocator, IEnumerable<Lazy<IToolWindow>> toolWindows, Lazy<IDialogWindowFactory> dialogFactory, Lazy<IUIThread> uiThread, Lazy<IMessageBoxService> messageBox, IShellEvents shellEvents, Lazy<IReferenceService> references, IErrorsManager errorsManager, Lazy<IOutputWindowManager> outputWindow) { this.serviceLocator = serviceLocator; this.dialogFactory = dialogFactory; this.toolWindows = toolWindows; this.shellEvents = shellEvents; this.uiThread = uiThread; this.messageBox = messageBox; this.status = new Lazy<IStatusBar>(() => new StatusBar(this.ServiceLocator)); this.references = references; this.errorsManager = errorsManager; this.outputWindow = outputWindow; TracingExtensions.ErrorsManager = this.errorsManager; if (settings.Debug) { Tracer.Manager.AddListener(Strings.Trace.RootSource, new TextTraceListener(outputWindow.Value.GetPane(new Guid(Strings.Trace.OutputPaneId), Strings.Trace.OutputPaneTitle))); } Tracer.Manager.SetTracingLevel(Strings.Trace.RootSource, settings.TracingLevel); this.isElevated = new Lazy<bool>(() => { var shell = this.ServiceLocator.TryGetService<SVsShell, IVsShell3>(); if (shell == null) return false; bool elevated; shell.IsRunningElevated(out elevated); return elevated; }); }
public ThemeViewModel(IThemeService themeService, IShellEvents shellEvents) { ThemeChange = ReactiveCommand.Create <int>( code => themeService.SetTheme((AppTheme)code)); this.WhenActivated((CompositeDisposable disposable) => { shellEvents.SetTitle("Theme Example"); Disposable .Create(() => { // This is called when the view model is out of view. }) .DisposeWith(disposable); }); Summary = "This sample shows the ThemeService.\n" + "When the switch is ON navigation will not work.\nThis is because we handle it inside the viewmodel."; }
public FilesViewModel(IShellEvents shellEvents, IFileService fileService, IPermissionsService permissionsService) { this.permissionsService = permissionsService; this.fileService = fileService; Save = ReactiveCommand.CreateFromTask(ExecuteSave, CanExecuteSave, RxApp.MainThreadScheduler); Read = ReactiveCommand.CreateFromTask(ExecuteRead, outputScheduler: RxApp.MainThreadScheduler); this.WhenActivated((CompositeDisposable disposable) => { shellEvents.SetTitle("Files Example"); Disposable .Create(() => { // This is called when the view model is out of view. }) .DisposeWith(disposable); }); Summary = "This sample saves or reads a string from a file using the FileService.\n" + "It also uses the PermissionsService to ask for read and write permissions."; }
public HomeViewModel(IShellEvents shellEvents, INavigationService navigationService) { Destinations = new ObservableCollection <string>(); foreach (string str in PageKeys.GetValues()) { Destinations.Add(str); } Navigate = ReactiveCommand.Create <string>( page => navigationService.NavigateTo(page)); this.WhenActivated((CompositeDisposable disposable) => { shellEvents.SetTitle("Home"); Disposable .Create(() => { // This is called when the view model is out of view. }) .DisposeWith(disposable); }); }
/// <summary> /// Initializes a new instance of the <see cref="TraceOutputWindowPane"/> class. /// </summary> /// <param name="serviceProvider">The service provider.</param> /// <param name="shellEvents">The shell events.</param> /// <param name="outputPaneId">The output pane GUID, which must be unique and remain constant for a given pane.</param> /// <param name="outputPaneTitle">The output pane title.</param> /// <param name="traceSourceName">The name of the trace source to write to the output window pane.</param> public TraceOutputWindowPane(IServiceProvider serviceProvider, IShellEvents shellEvents, Guid outputPaneId, string outputPaneTitle, string traceSourceName) : this(serviceProvider, shellEvents, outputPaneId, outputPaneTitle, new[] { traceSourceName }) { }
public TestPatternManager(IServiceProvider serviceProvider, ISolution solution, IShellEvents shellEvents, ISolutionEvents solutionEvents, IItemEvents itemEvents, IEnumerable <IInstalledToolkitInfo> installedFactories, IUserMessageService messageService) : base(serviceProvider, solution, shellEvents, solutionEvents, itemEvents, installedFactories, messageService) { }
public TestPatternManager(IServiceProvider serviceProvider, ISolution solution, IShellEvents shellEvents, ISolutionEvents solutionEvents, IItemEvents itemEvents, IEnumerable<IInstalledToolkitInfo> installedFactories, IUserMessageService messageService) : base(serviceProvider, solution, shellEvents, solutionEvents, itemEvents, installedFactories, messageService) { }