Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WindowManagerService"/> class.
 /// </summary>
 /// <param name="platformFacade">Instance of the Platform implementation facade</param>
 /// <param name="notificationService">Instance of Notification Service</param>
 public WindowManagerService(IPlatformFacade platformFacade, INotificationService notificationService)
 {
     this.platformFacade = platformFacade;
     this.notificationService = notificationService;
     this.ManagedWindows = new Dictionary<IntPtr, Window>();
     this.Frames = new List<Frame>();
 }
Пример #2
0
 public ReadkeyCommandTests()
 {
     this.platformFacade = Substitute.For<IPlatformFacade>();
     this.platformFacade.RegisterHotKey(Keys.None, 0).ReturnsForAnyArgs(true);
     this.keyMapService = new KeyMapService(this.platformFacade);
     this.mainWindow = Substitute.For<IMainWindow>();
 }
Пример #3
0
 public NavigationService(
     ILoggingService loggingService,
     IViewModelFactory viewModelFactory,
     IViewFactory viewFactory,
     INavigationFacade navigationFacade,
     IPlatformFacade platformFacade)
 {
     _loggingService   = loggingService;
     _viewModelFactory = viewModelFactory;
     _viewFactory      = viewFactory;
     _navigationFacade = navigationFacade;
     _platformFacade   = platformFacade;
 }
Пример #4
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;
        }
Пример #5
0
        public DefinekeyCommandTests()
        {
            this.platformFacade = Substitute.For<IPlatformFacade>();
            this.keyMapService = new KeyMapService(this.platformFacade);

            var commandStub = new ICommandStub
                                    {
                                        Args = "arg1",
                                        Name = "testCommand",
                                        Help = "sample help!"
                                    };
            var commandHandlerStub = new ICommandHandlerStub
                       {
                           ExpectedCommandArgs = commandStub.Args,
                           ExpectedCommandName = commandStub.Name,
                           ExpectedCommandHelp = commandStub.Help,
                           ExpectedExecuteResult = () => true
                       };
            this.commandService = new CommandService(
                new List<ICommand> { commandStub }, new List<object> { commandHandlerStub });
        }
Пример #6
0
 public NewKMapCommandTests()
 {
     this.platformFacade = NSubstitute.Substitute.For<IPlatformFacade>();
     this.keyMapService = new KeyMapService(this.platformFacade);
 }
Пример #7
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);
        }
Пример #8
0
 public DelKMapCommandTests()
 {
     this.platformFacade = Substitute.For<IPlatformFacade>();
     this.platformFacade.UnregisterHotKey(0).ReturnsForAnyArgs(true);
     this.keyMapService = new KeyMapService(this.platformFacade);
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyMapService"/> class.
 /// </summary>
 /// <param name="platformFacade">
 /// An <see cref="IPlatformFacade"/> implementation
 /// </param>
 public KeyMapService(IPlatformFacade platformFacade)
 {
     this.nameToKeyMapMapping = new Dictionary<string, KeyMap>();
     this.topKeyToKeyMapMapping = new Dictionary<Keys, KeyMap>();
     this.platformFacade = platformFacade;
 }