Пример #1
0
        private static FLASHWINDOWINFO CreateFlashWindowInfo(WindowArgument window, Commands command)
        {
            FLASHWINDOWINFO info = new FLASHWINDOWINFO();

            info.cbSize = Convert.ToUInt32(Marshal.SizeOf(info));
            info.hwnd = window.Handle;
            info.dwFlags = (UInt32)command;
            info.uCount = command == Commands.FlashUntilExplicitlyStopped ? UInt32.MaxValue : 5;
            info.dwTimeout = 0;

            return info;
        }
Пример #2
0
        public static void Invoke(WindowArgument window, bool audio, bool visual, string message)
        {
            if(audio)
                Beep();

            bool flashUntilUserAcknowledgement = message != null && message.Length > 0;

            if(visual)
                FlashWindow(window, !flashUntilUserAcknowledgement);

            if(flashUntilUserAcknowledgement)
            {
                NotifyUser(message, window);

                if(visual)
                    StopFlashingWindow(window);
            }
        }
Пример #3
0
 private static void StopFlashingWindow(WindowArgument window)
 {
     FLASHWINDOWINFO info = CreateFlashWindowInfo(window, Commands.StopFlashing);
     FlashWindowEx(ref info);
 }
Пример #4
0
 private static void NotifyUser(string message, WindowArgument alarmWindow)
 {
     MessageBox.Show(alarmWindow, message, Connect.addinName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
 }
Пример #5
0
 private static void FlashWindow(WindowArgument window, bool flashIndefinitely)
 {
     FLASHWINDOWINFO info = CreateFlashWindowInfo(window, flashIndefinitely ? Commands.FlashBriefly : Commands.FlashUntilExplicitlyStopped);
     FlashWindowEx(ref info);
 }