private static void EditAllOpenWindows(SEBWindowHandler.ShowWindowCommand action)
 {
     foreach (KeyValuePair <IntPtr, string> openWindow in (IEnumerable <KeyValuePair <IntPtr, string> >)SEBWindowHandler.GetOpenWindows())
     {
         IntPtr key = openWindow.Key;
         if (!key.IsAllowed())
         {
             SEBWindowHandler.EditWindowByHandle(key, action, false);
         }
     }
 }
 private static void EditWindowByHandle(IntPtr windowHandle, SEBWindowHandler.ShowWindowCommand action, bool waitForShowingUp = false)
 {
     if (action == SEBWindowHandler.ShowWindowCommand.SW_HIDE)
     {
         SEBWindowHandler._hiddenWindowHandles.Add(windowHandle);
     }
     ThreadPool.QueueUserWorkItem((WaitCallback)(_param1 =>
     {
         try
         {
             if (action == SEBWindowHandler.ShowWindowCommand.SW_SHOWMINIMIZED & waitForShowingUp)
             {
                 Thread.Sleep(500);
             }
             if (!SEBWindowHandler.ShowWindowAsync(windowHandle, (int)action))
             {
                 if (action == SEBWindowHandler.ShowWindowCommand.SW_SHOWMINIMIZED)
                 {
                     SEBWindowHandler.SendMessage(windowHandle, 274, (IntPtr)61472, IntPtr.Zero);
                     Logger.AddInformation(string.Format("Window {0} minimized", (object)windowHandle.GetWindowTitle()), (object)null, (Exception)null, (string)null);
                 }
                 else if (action == SEBWindowHandler.ShowWindowCommand.SW_HIDE)
                 {
                     SEBWindowHandler.SendMessage(windowHandle, 274, (IntPtr)61536, IntPtr.Zero);
                     Logger.AddInformation(string.Format("Window {0} closed, because i was unable to hide it", (object)windowHandle.GetWindowTitle()), (object)null, (Exception)null, (string)null);
                 }
                 else
                 {
                     if (action != SEBWindowHandler.ShowWindowCommand.SW_SHOWMAXIMIZED)
                     {
                         return;
                     }
                     SEBWindowHandler.SendMessage(windowHandle, 274, (IntPtr)61488, IntPtr.Zero);
                     Logger.AddInformation(string.Format("Window {0} Maximized", (object)windowHandle.GetWindowTitle()), (object)null, (Exception)null, (string)null);
                 }
             }
             else
             {
                 Logger.AddInformation(string.Format("Window {0} {1}", (object)windowHandle.GetWindowTitle(), (object)action.ToString()), (object)null, (Exception)null, (string)null);
             }
         }
         catch
         {
             try
             {
                 if (action == SEBWindowHandler.ShowWindowCommand.SW_SHOWMINIMIZED)
                 {
                     SEBWindowHandler.SendMessage(windowHandle, 274, (IntPtr)61472, IntPtr.Zero);
                     Logger.AddInformation(string.Format("Window {0} minimized", (object)windowHandle.GetWindowTitle()), (object)null, (Exception)null, (string)null);
                 }
                 else if (action == SEBWindowHandler.ShowWindowCommand.SW_HIDE)
                 {
                     SEBWindowHandler.SendMessage(windowHandle, 274, (IntPtr)61536, IntPtr.Zero);
                     Logger.AddInformation(string.Format("Window {0} closed, because i was unable to hide it", (object)windowHandle.GetWindowTitle()), (object)null, (Exception)null, (string)null);
                 }
                 else
                 {
                     if (action != SEBWindowHandler.ShowWindowCommand.SW_SHOWMAXIMIZED)
                     {
                         return;
                     }
                     SEBWindowHandler.SendMessage(windowHandle, 274, (IntPtr)61488, IntPtr.Zero);
                     Logger.AddInformation(string.Format("Window {0} Maximized", (object)windowHandle.GetWindowTitle()), (object)null, (Exception)null, (string)null);
                 }
             }
             catch (Exception ex)
             {
             }
         }
     }));
 }