示例#1
0
 private void MinimizeChobby()
 {
     try
     {
         if (chobbyla.process.MainWindowHandle != IntPtr.Zero)
         {
             WindowsApi.ShowWindow(chobbyla.process.MainWindowHandle, WindowsApi.SwCommand.SW_MINIMIZE);
         }
     }
     catch (Exception ex)
     {
         Trace.TraceWarning("Error minimizing chobby zero-k window: {0}", ex);
     }
 }
示例#2
0
        public async Task Process(Alert args)
        {
            try
            {
                if (Environment.OSVersion.Platform != PlatformID.Unix)
                {
                    // todo implement for linux with #define NET_WM_STATE_DEMANDS_ATTENTION=42
                    var info = new WindowsApi.FLASHWINFO();
                    info.hwnd    = chobbyla.process.MainWindowHandle;
                    info.dwFlags = 0x0000000C | 0x00000003; // flash all until foreground
                    info.cbSize  = Convert.ToUInt32(Marshal.SizeOf(info));
                    WindowsApi.FlashWindowEx(ref info);

                    SystemSounds.Exclamation.Play();
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("Error alerting {0} : {1}", args.Message, ex);
            }
        }