Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        /// <param name="platformFacade">Platform implementation.</param>
        /// <param name="keyMapService">
        /// The key map service.
        /// </param>
        /// <param name="windowManagerService">
        /// The window manager service.
        /// </param>
        public MainWindow(IPlatformFacade platformFacade, IKeyMapService keyMapService, IWindowManagerService windowManagerService)
        {
            platformFacade.MainWindow = this;
            this.keyMapService = keyMapService;
            this.windowManagerService = windowManagerService;

            WM_SHELLHOOK = Interop.RegisterWindowMessage("SHELLHOOK");

            this.AllowTransparency = true;
            this.BackColor = Color.DarkGray;
            this.Cursor = Cursors.NoMove2D;
            this.FormBorderStyle = FormBorderStyle.None;
            this.KeyPreview = true;
            this.Opacity = 0.3;
            this.ShowInTaskbar = false;
            this.WindowState = FormWindowState.Minimized;

            this.Activated += this.MainWindowActivated;
        }
Ejemplo n.º 2
0
        public void SetupTest()
        {
            var mainWindow = Substitute.For<IMainWindow>();
            mainWindow.GetHandle().Returns(IntPtr.Zero);

            this.platformFacade = Substitute.For<IPlatformFacade>();
            this.platformFacade.MainWindow.Returns(mainWindow);
            this.platformFacade.RegisterHotKey(Keys.A, 0).ReturnsForAnyArgs(true);
            this.platformFacade.UnregisterHotKey(0).ReturnsForAnyArgs(true);

            this.keyMapService = new KeyMapService(this.platformFacade);
            (this.keyMapService as ServiceBase).Start();
            this.keyMapService.AddKeyMap(TestKeyMapName);
        }
Ejemplo n.º 3
0
 public UndefinekeyCommandTests()
 {
     var platformFacade = Substitute.For<IPlatformFacade>();
     this.keyMapService = new KeyMapService(platformFacade);
     this.keyMapService.AddKeyMap(TestKeyMap);
 }