private void OnActiveDocumentChanged() { var currentPane = _mainForm._windowPaneSelection.ActiveDocument; _currentUser = currentPane as INiStatusBarUser; Status status; if (_currentUser == null) { status = _defaultStatus; } else { if (!_statuses.TryGetValue(_currentUser, out status)) { status = new Status(); _statuses.Add(_currentUser, status); INiWindowFrame windowFrame; ErrorUtil.ThrowOnFailure(((INiShell)GetService(typeof(INiShell))).GetWindowFrameForWindowPane( currentPane, out windowFrame )); Debug.Assert(windowFrame != null); new WindowPaneListener(this, _currentUser, windowFrame); } ErrorUtil.ThrowOnFailure(_currentUser.SetInfo()); } ApplyStatus(status); }
public HResult IsCurrentUser(INiStatusBarUser user, out bool isCurrent) { isCurrent = false; try { isCurrent = user == _currentUser; return(HResult.OK); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
public WindowPaneListener(NiStatusBar statusBar, INiStatusBarUser statusBarUser, INiConnectionPoint connectionPoint) : base(connectionPoint) { _statusBar = statusBar; _statusBarUser = statusBarUser; }
public HResult IsCurrentUser(INiStatusBarUser user, out bool isCurrent) { isCurrent = false; try { isCurrent = user == _currentUser; return HResult.OK; } catch (Exception ex) { return ErrorUtil.GetHResult(ex); } }