// Runs on our automation thread void _windowWatcher_ExcelToolTipWindowChanged(object sender, WindowWatcher.WindowChangedEventArgs e) { switch (e.Type) { case WindowWatcher.WindowChangedEventArgs.ChangeType.Show: if (!_toolTips.Contains(e.WindowHandle)) { _toolTips.Add(e.WindowHandle); ToolTipChanged?.Invoke(this, new ToolTipChangeEventArgs(ToolTipChangeType.Show, e.WindowHandle)); } break; case WindowWatcher.WindowChangedEventArgs.ChangeType.Hide: case WindowWatcher.WindowChangedEventArgs.ChangeType.Destroy: if (_toolTips.Remove(e.WindowHandle)) { ToolTipChanged?.Invoke(this, new ToolTipChangeEventArgs(ToolTipChangeType.Hide, e.WindowHandle)); } break; case WindowWatcher.WindowChangedEventArgs.ChangeType.Create: case WindowWatcher.WindowChangedEventArgs.ChangeType.Focus: case WindowWatcher.WindowChangedEventArgs.ChangeType.Unfocus: default: // Ignoring these.... break; } }
// Runs on our automation thread void _windowWatcher_ExcelToolTipWindowChanged(object sender, WindowWatcher.WindowChangedEventArgs e) { switch (e.Type) { case WindowWatcher.WindowChangedEventArgs.ChangeType.Show: if (!_toolTips.Contains(e.WindowHandle)) { _toolTips.Add(e.WindowHandle); ToolTipChanged?.Invoke(this, new ToolTipChangeEventArgs(ToolTipChangeType.Show, e.WindowHandle)); } break; case WindowWatcher.WindowChangedEventArgs.ChangeType.Hide: if (_toolTips.Remove(e.WindowHandle)) { ToolTipChanged?.Invoke(this, new ToolTipChangeEventArgs(ToolTipChangeType.Hide, e.WindowHandle)); } break; case WindowWatcher.WindowChangedEventArgs.ChangeType.Destroy: // Not expecting this anymore - Destroy is no longer routed from the WinEvents. Debug.Fail("Unexpected ChangeType"); break; case WindowWatcher.WindowChangedEventArgs.ChangeType.Create: case WindowWatcher.WindowChangedEventArgs.ChangeType.Focus: case WindowWatcher.WindowChangedEventArgs.ChangeType.Unfocus: default: // Ignoring these.... break; } }
private void tabItem_InternalToolTipChanged(object sender, DependencyPropertyChangedEventArgs e) { ToolTipChanged?.Invoke(this, e); }