private void RemoveStatusBarItems() { _statusInfoUpdateSubscription.Dispose(); _statusInfoUpdateSubscription = null; Editor.StatusBarItemsRight.Remove(_statusInfo); _statusInfo = null; }
private void AddStatusBarItems() { _statusInfo = new TextEditorStatusViewModel { IsVisible = false }; Editor.StatusBarItemsRight.Insert(0, _statusInfo); // Observe the IDocumentService.ActiveDocumentChanged event and show/hide our status info. var documentService = _documentService; _statusInfoUpdateSubscription = Observable.FromEventPattern <EventArgs>( h => documentService.ActiveDocumentChanged += h, h => documentService.ActiveDocumentChanged -= h) .Select(eventPattern => (IDocumentService)eventPattern.Sender) .Select(ds => ds.ActiveDocument as TextDocument) .Subscribe(textDocument => _statusInfo.IsVisible = (textDocument != null)); }