Beispiel #1
0
 void DispatcherTimer_Tick(object sender, EventArgs e)
 {
     if (ActiveProfile != null)
     {
         try
         {
             ActiveProfile.Tick();
             long currentTick = DateTime.Now.Ticks;
             if (currentTick - _lastTick > TOPMOST_TICK_COUNT)
             {
                 for (int i = 0; i < _windows.Count; i++)
                 {
                     if (_windows[i].Monitor.AlwaysOnTop)
                     {
                         NativeMethods.SetWindowPos(_windows[i].Handle, HWND_TOPMOST, 0, 0, 0, 0, NativeMethods.SWP_NOACTIVATE | NativeMethods.SWP_NOMOVE | NativeMethods.SWP_NOSIZE);
                     }
                 }
                 NativeMethods.SetWindowPos(_helper.Handle, HWND_TOPMOST, 0, 0, 0, 0, NativeMethods.SWP_NOACTIVATE | NativeMethods.SWP_NOMOVE | NativeMethods.SWP_NOSIZE);
                 _lastTick = currentTick;
             }
         }
         catch (Exception exception)
         {
             ConfigManager.LogManager.LogError("Error processing profile tick or refresh.", exception);
         }
     }
 }