Пример #1
0
            private void OnDone(object sender, EventArgs e)
            {
                Form si = _invoker;

                if (si != null && si.InvokeRequired)
                {
                    EventHandler eh = new EventHandler(OnDone);
                    try
                    {
                        si.BeginInvoke(eh, new object[] { sender, e });
                    }
                    catch (Exception ex)
                    {
                        /* Not Catching this exception kills VS */
                        GC.KeepAlive(ex);
                    }
                    return;
                }

                if (si.Visible)
                {
                    si.Close();

                    if (ConfigService != null && ConfigService.Instance.FlashWindowWhenOperationCompletes)
                    {
                        if (DialogOwner != null)
                        {
                            IWin32Window             window = DialogOwner.DialogOwner;
                            NativeMethods.FLASHWINFO fw     = new NativeMethods.FLASHWINFO();
                            fw.cbSize    = Convert.ToUInt32(Marshal.SizeOf(typeof(NativeMethods.FLASHWINFO)));
                            fw.hwnd      = window.Handle;
                            fw.dwFlags   = (Int32)(NativeMethods.FLASHWINFOFLAGS.FLASHW_ALL | NativeMethods.FLASHWINFOFLAGS.FLASHW_TIMERNOFG);
                            fw.dwTimeout = 0;

                            NativeMethods.FlashWindowEx(ref fw);
                        }
                    }
                }
            }
Пример #2
0
            private void OnDone(object sender, EventArgs e)
            {
                Form si = _invoker;

                if (si != null && si.InvokeRequired)
                {
                    EventHandler eh = new EventHandler(OnDone);
                    try
                    {
                        si.BeginInvoke(eh, new object[] { sender, e });
                    }
                    catch(Exception ex)
                    {
                        /* Not Catching this exception kills VS */
                        GC.KeepAlive(ex);
                    }
                    return;
                }

                if (si.Visible)
                {
                    si.Close();

                    if (ConfigService != null && ConfigService.Instance.FlashWindowWhenOperationCompletes)
                    {
                        if (DialogOwner != null)
                        {
                            IWin32Window window = DialogOwner.DialogOwner;
                            NativeMethods.FLASHWINFO fw = new NativeMethods.FLASHWINFO();
                            fw.cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(NativeMethods.FLASHWINFO)));
                            fw.hwnd = window.Handle;
                            fw.dwFlags = (Int32)(NativeMethods.FLASHWINFOFLAGS.FLASHW_ALL | NativeMethods.FLASHWINFOFLAGS.FLASHW_TIMERNOFG);
                            fw.dwTimeout = 0;

                            NativeMethods.FlashWindowEx(ref fw);
                        }
                    }
                }
            }