public Taskbar() { InitializeComponent(); Width = SystemParameters.PrimaryScreenWidth; Top = SystemParameters.PrimaryScreenHeight - Height; Left = 0; IsVisibleChanged += Taskbar_IsVisibleChanged; //Visibility = Visibility.Hidden; InitialPopulateTaskbar(); ClockTimer.Elapsed += delegate { Dispatcher.Invoke(new Action(() => { ClockTime.Content = DateTime.Now.ToShortTimeString(); ClockDate.Content = DateTime.Now.ToShortDateString(); })); }; ClockTimer.Start(); ProgramWindow.WindowOpened += InsertCreatedWindow; ProgramWindow.WindowClosed += RemoveClosedWindow; _activeWindowTimer.Elapsed += delegate { Dispatcher.Invoke(new Action(() => { var active = MiscTools.GetForegroundWindow(); foreach (TaskbarGroupStackPanel t in Taskband.Children) { try { if (t.ForceCombine | (Config.GroupingMode == TaskbarGroupingMode.Combine)) { var isAnythingActive = false; foreach (var b in t.ProgramWindowsList) { if (b.Hwnd == active) { isAnythingActive = true; } } if (isAnythingActive) { t.RunningBackgroundButton.IsActiveWindow = true; } else { t.RunningBackgroundButton.IsActiveWindow = false; } } else { foreach (TaskItemButton b in t.Buttons.Children) { if ((b.Tag as ProgramWindow).Hwnd == active) { b.IsActiveWindow = true; } else { b.IsActiveWindow = false; } } } } catch (Exception ex) { Debug.WriteLine(ex); } } })); }; _activeWindowTimer.Start(); Debug.WriteLine(MainTools.GetFixedModule("Test Module").ModuleName + " FOUND!"); }