Example #1
0
        private static Dictionary <SecurityDialog, DateTime> GetSecurityDialogs(Process[] outlookProcess)
        {
            Dictionary <SecurityDialog, DateTime> local = new Dictionary <SecurityDialog, DateTime>();

            User32.EnumDelegate filter = delegate(IntPtr hWnd, int lParam)
            {
                User32.GetClassName(hWnd, _strbClassName, _strbClassName.Capacity + 1);
                string className = _strbClassName.ToString();

                User32.GetWindowText(hWnd, _strbCaption, _strbCaption.Capacity + 1);
                string caption = _strbCaption.ToString();

                if ((_dialogClassName == className.ToString()) && (User32.IsWindowVisible(hWnd)))
                {
                    uint processID = 0;
                    User32.GetWindowThreadProcessId(hWnd, out processID);
                    foreach (Process process in outlookProcess)
                    {
                        if (processID == process.Id)
                        {
                            User32.RECT rect = new User32.RECT();
                            User32.GetWindowRect(hWnd, out rect);
                            local.Add(new SecurityDialog(hWnd, caption, className, new Rect(rect)), DateTime.Now);
                            break;
                        }
                    }
                }
                return(true);
            };
            User32.EnumDesktopWindows(IntPtr.Zero, filter, IntPtr.Zero);

            foreach (KeyValuePair <SecurityDialog, DateTime> item in local)
            {
                SecurityDialog existing = GetDialogFromHandle(_listDialogs, item.Key.Handle);
                if (null == existing)
                {
                    _listDialogs.Add(item.Key, item.Value);
                }
            }

            List <SecurityDialog> toDelete = new List <SecurityDialog>();

            foreach (KeyValuePair <SecurityDialog, DateTime> item in _listDialogs)
            {
                SecurityDialog existing = GetDialogFromHandle(_listDialogs, item.Key.Handle);
                if (null == existing)
                {
                    toDelete.Add(item.Key);
                }
            }
            foreach (SecurityDialog item in toDelete)
            {
                _listDialogs.Remove(item);
            }

            return(_listDialogs);
        }
Example #2
0
 private static void Suppress_OnAction(SecurityDialog dialog, SecurityDialogCheckBox targetBox, SecurityDialogLeftButton targetButton)
 {
     Console.WriteLine("Suppress_OnAction:{0}{1}{2}", Environment.NewLine, dialog, Environment.NewLine, targetButton);
 }