private static void AutomateTabTipOpen(IObservable <Tuple <UIElement, bool> > focusObservable) { focusObservable .ObserveOn(Scheduler.Default) .Where(_ => IgnoreHardwareKeyboard == HardwareKeyboardIgnoreOptions.IgnoreAll || !HardwareKeyboard.IsConnectedAsync().Result) .Where(tuple => tuple.Item2 == true) .Do(_ => TabTip.OpenUndockedAndStartPoolingForClosedEvent()) .ObserveOnDispatcher() .Subscribe(tuple => AnimationHelper.GetUIElementInToWorkAreaWithTabTipOpened(tuple.Item1)); }
private static void AutomateTabTipClose(IObservable <Tuple <UIElement, bool> > focusObservable, Subject <bool> tabTipClosedSubject) { focusObservable .ObserveOn(Scheduler.Default) .Where(_ => IgnoreHardwareKeyboard == HardwareKeyboardIgnoreOptions.IgnoreAll || !HardwareKeyboard.IsConnectedAsync().Result) .Throttle(TimeSpan.FromMilliseconds(100)) // Close only if no other UIElement got focus in 100 ms .Where(tuple => tuple.Item2 == false) .Do(_ => TabTip.Close()) .Subscribe(_ => tabTipClosedSubject.OnNext(true)); tabTipClosedSubject .ObserveOnDispatcher() .Subscribe(_ => AnimationHelper.GetEverythingInToWorkAreaWithTabTipClosed()); }
private static Rectangle GetWorkAreaWithTabTipOpened(DependencyObject element) { Rectangle workAreaWithTabTipClosed = GetWorkAreaWithTabTipClosed(element); int tabTipRectangleTop = TabTip.GetWouldBeTabTipRectangle().ToRectangleInLogicalUnits(element).Top; int bottom = (tabTipRectangleTop == 0) ? workAreaWithTabTipClosed.Bottom / 2 : tabTipRectangleTop; // in case TabTip is not yet opened return(Rectangle.FromLTRB( left: workAreaWithTabTipClosed.Left, top: workAreaWithTabTipClosed.Top, right: workAreaWithTabTipClosed.Right, bottom: bottom)); }