示例#1
0
        public MessageBoxReplacer(IWindowMessageHook hook)
        {
            _hook = hook;

            _hook.WindowMessageReceived += (sender, args) =>
            {
                var senderForm = args.SrcForm;
                if (senderForm == null)
                {
                    return;
                }
                if (args.Message.Msg != WM_APP_CENTERMSG)
                {
                    return;
                }

                var hWnd = GetForegroundWindow();
                if (hWnd == senderForm.Handle)
                {
                    return;
                }

                var r = new RECT();
                GetWindowRect(hWnd, ref r);
                var w = r.right - r.left;
                var h = r.bottom - r.top;
                var x = senderForm.Left + (senderForm.Width - w) / 2;
                var y = senderForm.Top + (senderForm.Height - h) / 2;
                MoveWindow(hWnd, x, y, w, h, 0);
            };
        }
        public MessageBoxReplacer(IWindowMessageHook hook)
        {
            _hook = hook;

            _hook.WindowMessageReceived += (sender, args) =>
            {
                var senderForm = args.SrcForm;
                if (senderForm == null)
                {
                    return;
                }
                if (args.Message.Msg != WM_APP_CENTERMSG)
                {
                    return;
                }

                var hWnd = GetForegroundWindow();
                if (hWnd == senderForm.Handle)
                {
                    return;
                }

                var r = new RECT();
                GetWindowRect(hWnd, ref r);
                var w = r.right - r.left;
                var h = r.bottom - r.top;
                var x = senderForm.Left + (senderForm.Width - w)/2;
                var y = senderForm.Top + (senderForm.Height - h)/2;
                MoveWindow(hWnd, x, y, w, h, 0);
            };
        }
 public MainWindowPreparationOperation(
     IClipboardListWindow mainWindow,
     IClipboardUserInterfaceInteractionMediator clipboardUserInterfaceInteractionMediator,
     IMainWindowHandleContainer handleContainer,
     IKeyInterceptor keyInterceptor,
     IWindowMessageHook windowMessageHook)
 {
     this.mainWindow = mainWindow;
     this.clipboardUserInterfaceInteractionMediator = clipboardUserInterfaceInteractionMediator;
     this.handleContainer = handleContainer;
     this.keyInterceptor = keyInterceptor;
     this.windowMessageHook = windowMessageHook;
 }
示例#4
0
        public MainWindowPreparationOperation(
            IClipboardListWindow mainWindow,
            IClipboardUserInterfaceInteractionMediator clipboardUserInterfaceInteractionMediator,
            IMainWindowHandleContainer handleContainer,
            IKeyInterceptor keyInterceptor,
            IWindowMessageHook windowMessageHook)
        {
            this.mainWindow = mainWindow;
            this.clipboardUserInterfaceInteractionMediator = clipboardUserInterfaceInteractionMediator;
            this.handleContainer   = handleContainer;
            this.keyInterceptor    = keyInterceptor;
            this.windowMessageHook = windowMessageHook;

            SetupWindowMessageHook();
        }
        public MainWindowPreparationOperation(
            IMainWindow mainWindow,
            IClipboardUserInterfaceInteractionMediator clipboardUserInterfaceInteractionMediator,
            IMainWindowHandleContainer handleContainer,
            IKeyInterceptor keyInterceptor,
            IWindowMessageHook windowMessageHook,
            ISourceClipboardQuantityOverlay sourceClipboardQuantityOverlay)
        {
            this.mainWindow = mainWindow;
            this.clipboardUserInterfaceInteractionMediator = clipboardUserInterfaceInteractionMediator;
            this.handleContainer   = handleContainer;
            this.keyInterceptor    = keyInterceptor;
            this.windowMessageHook = windowMessageHook;
            this.sourceClipboardQuantityOverlay = sourceClipboardQuantityOverlay;

            SetupWindowMessageHook();
        }
示例#6
0
        public ClipboardListWindow(
            IClipboardListViewModel viewModel,
            IKeyInterceptor keyInterceptor,
            IWindowMessageHook windowMessageHook,
            IMainWindowHandleContainer handleContainer)
        {
            this.handleContainer   = handleContainer;
            this.keyInterceptor    = keyInterceptor;
            this.viewModel         = viewModel;
            this.windowMessageHook = windowMessageHook;

            SourceInitialized += ClipboardListWindow_SourceInitialized;
            Activated         += ClipboardListWindow_Activated;

            InitializeComponent();

            SetupViewModel();
        }
        public ClipboardListWindow(
            IClipboardListViewModel viewModel,
            IKeyInterceptor keyInterceptor,
            IWindowMessageHook windowMessageHook,
            IMainWindowHandleContainer handleContainer)
        {
            this.handleContainer = handleContainer;
            this.keyInterceptor = keyInterceptor;
            this.viewModel = viewModel;
            this.windowMessageHook = windowMessageHook;

            SourceInitialized += ClipboardListWindow_SourceInitialized;
            Activated += ClipboardListWindow_Activated;

            InitializeComponent();

            SetupViewModel();
        }