Example #1
0
 public HotkeyManager(ISettingsManager <HotkeySettings> hotkeySettingsManager, IMetaPubSub metaMessenger)
 {
     this.hotkeySettingsManager             = hotkeySettingsManager;
     hotkeySettingsManager.SettingsFilePath = Path.Combine(Constants.DefaultSettingsFolderPath, "hotkeys.xml");;
     _metaMessenger = metaMessenger;
     _metaMessenger.Subscribe <SettingsChangedMessage <HotkeySettings> >(OnHotkeysSettingsChanged);
 }
        /// <summary>
        /// Initializes a new instance of <see cref="HSSettingsManager"/> class
        /// </summary>
        /// <param name="settingsFilePath">Path to the settings file</param>
        public HSSettingsManager(string settingsFilePath, IFileSerializer fileSerializer, IMetaPubSub metaMessenger)
            : base(settingsFilePath, fileSerializer)
        {
            _metaMessenger = metaMessenger;

            this.SettingsChanged += HSSettingsManager_SettingsChanged;
        }
Example #3
0
 public UniversalWorkstationLocker(int lockTimeout, IMetaPubSub messenger, ILog log)
     : base(nameof(UniversalWorkstationLocker), log)
 {
     _lockTimeout  = lockTimeout;
     _wcfLocker    = new WcfWorkstationLocker(messenger, log);
     _wtsapiLocker = new WtsapiWorkstationLocker(log);
 }
Example #4
0
        public ServiceViewModel(IServiceProxy serviceProxy, IMetaPubSub metaMessenger)
        {
            _serviceProxy  = serviceProxy;
            _metaMessenger = metaMessenger;

            _metaMessenger.Subscribe <ConnectionServiceChangedMessage>(OnServiceConnectionStateChanged);
        }
Example #5
0
        public PasswordManagerViewModel(IWindowsManager windowsManager, IQrScannerHelper qrScannerHelper,
                                        IMetaPubSub metaMessenger, IActiveDevice activeDevice, ISettingsManager <ApplicationSettings> settingsManager)
        {
            this.windowsManager  = windowsManager;
            this.qrScannerHelper = qrScannerHelper;
            _metaMessenger       = metaMessenger;
            _settingsManager     = settingsManager;

            _metaMessenger.Subscribe <ActiveDeviceChangedMessage>(OnActiveDeviceChanged);
            _metaMessenger.Subscribe <AddAccountForAppMessage>(OnAddAccountForApp);

            this.WhenAnyValue(x => x.SearchQuery)
            .Throttle(TimeSpan.FromMilliseconds(100))
            .Where(term => null != term)
            .DistinctUntilChanged()
            .InvokeCommand(FilterAccountCommand);

            this.WhenAnyValue(x => x.Device)
            .Where(x => null != x)
            .Subscribe(d => OnDeviceChanged());

            this.WhenAnyValue(x => x.SelectedAccount)
            .InvokeCommand(CancelCommand);

            // Todo: On update, preserve selection or if unable, clear it
            //Observable.FromEventPattern<NotifyCollectionChangedEventArgs>(Accounts, nameof(ObservableCollection<string>.CollectionChanged))
            //          .Subscribe(change => SelectedAccount = Accounts.FirstOrDefault());

            Device = activeDevice.Device != null ? new DeviceViewModel(activeDevice.Device) : null;
        }
Example #6
0
 public WorkstationManager(IMetaPubSub metaMessenger)
 {
     // Start listening command messages
     metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.LockWorkstationMessage>(LockPC);
     //metaMessenger.Subscribe<ForceShutdownMessage>(ForceShutdown);
     metaMessenger.TrySubscribeOnServer <ActivateScreenRequestMessage>(ActivateScreen);
 }
        public ActivationViewModel(IMetaPubSub metaMessenger, IDeviceManager deviceManager)
        {
            _deviceManager = deviceManager;
            _metaMessenger = metaMessenger;

            RegisterDependencies();
        }
        public async Task EnumerateDevices_ClearDevices_DevicesCollectionCleared()
        {
            var         devices   = new List <DeviceDTO>();
            IMetaPubSub messenger = GetMessenger();
            IMetaPubSub hub       = new MetaPubSub();

            hub.StartServer("Test2");

            await messenger.TryConnectToServer("Test2");

            IDeviceManager deviceManager = GetDeviceManager(messenger);

            int devicesCount = 1000;

            for (int i = 0; i < devicesCount; i++)
            {
                devices.Add(GetRandomDeviceDTO());
            }

            await messenger.PublishOnServer(new DevicesCollectionChangedMessage(devices.ToArray()));

            await messenger.DisconnectFromServer();

            await Task.Delay(200);

            Assert.AreEqual(0, deviceManager.Devices.Count());
        }
        public async Task EnumerateDevices_QuickReconnect_DevicesCollectionEnumerated()
        {
            var            devices       = new List <DeviceDTO>();
            IMetaPubSub    messenger     = GetMessenger();
            IDeviceManager deviceManager = GetDeviceManager(messenger);
            IMetaPubSub    hub           = new MetaPubSub();

            hub.StartServer("Test3");

            int devicesCount = 1000;

            for (int i = 0; i < devicesCount; i++)
            {
                devices.Add(GetRandomDeviceDTO());
            }

            var connectionTask = Task.Factory.StartNew(() =>
            {
                messenger.TryConnectToServer("Test3");
                deviceManager = GetDeviceManager(messenger, devices);
            });
            var disconnectionTask = Task.Factory.StartNew(messenger.DisconnectFromServer);
            var reconnectionTask  = Task.Factory.StartNew(() => messenger.TryConnectToServer("Test3"));

            await Task.WhenAll(connectionTask, disconnectionTask, reconnectionTask);

            await Task.Delay(2000);

            Assert.AreEqual(devicesCount, deviceManager.Devices.Count());
        }
Example #10
0
        public Device(
            IRemoteDeviceFactory remoteDeviceFactory,
            IMetaPubSub metaMessenger,
            DeviceDTO dto)
        {
            _remoteDeviceFactory = remoteDeviceFactory;
            _metaMessenger       = metaMessenger;

            PropertyChanged += Device_PropertyChanged;

            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceConnectionStateChangedMessage>(OnDeviceConnectionStateChanged);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceInitializedMessage>(OnDeviceInitialized);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceFinishedMainFlowMessage>(OnDeviceFinishedMainFlow);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceOperationCancelledMessage>(OnOperationCancelled);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceProximityChangedMessage>(OnDeviceProximityChanged);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceBatteryChangedMessage>(OnDeviceBatteryChanged);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceProximityLockEnabledMessage>(OnDeviceProximityLockEnabled);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.LockDeviceStorageMessage>(OnLockDeviceStorage);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.LiftDeviceStorageLockMessage>(OnLiftDeviceStorageLock);
            _metaMessenger.Subscribe <SendPinMessage>(OnPinReceived);
            _metaMessenger.Subscribe <SessionSwitchMessage>(OnSessionSwitch);

            RegisterDependencies();

            LoadFrom(dto);
        }
Example #11
0
        public ServiceCallbackMessanger(IMessenger messenger, IMetaPubSub metaMessenger)
        {
            _messenger     = messenger;
            _metaMessenger = metaMessenger;

            _metaMessenger.TrySubscribeOnServer <ActivateScreenRequestMessage>(ActivateScreenRequest);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.LockWorkstationMessage>(LockWorkstationRequest);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DevicesCollectionChangedMessage>(DevicesCollectionChanged);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceConnectionStateChangedMessage>(DeviceConnectionStateChanged);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceInitializedMessage>(DeviceInitialized);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceFinishedMainFlowMessage>(DeviceFinishedMainFlow);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceOperationCancelledMessage>(DeviceOperationCancelled);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceProximityChangedMessage>(DeviceProximityChanged);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceBatteryChangedMessage>(DeviceBatteryChanged);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.RemoteConnection_DeviceStateChangedMessage>(RemoteConnection_DeviceStateChanged);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.ServiceComponentsStateChangedMessage>(ServiceComponentsStateChanged);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.UserNotificationMessage>(ServiceNotificationReceived);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.UserErrorMessage>(ServiceErrorReceived);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.ShowActivationCodeUiMessage>(ShowActivationCodeUi);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.HideActivationCodeUi>(HideActivationCodeUi);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DeviceProximityLockEnabledMessage>(DeviceProximityLockEnabled);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.WorkstationUnlockedMessage>(WorkstationUnlocked);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.ProximitySettingsChangedMessage>(ProximitySettingsChanged);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.LockDeviceStorageMessage>(LockDeviceStorage);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.LiftDeviceStorageLockMessage>(LiftDeviceStorageLock);

            _metaMessenger.Subscribe <ConnectedToServerEvent>(OnConnectedToServer);
        }
        public async Task EnumerateDevices_FluctuatingServiceConnection_DevicesEnumerated()
        {
            var         devices   = new List <DeviceDTO>();
            IMetaPubSub messenger = GetMessenger();
            IMetaPubSub hub       = new MetaPubSub();

            hub.StartServer("Test1");

            int devicesCount = 100;

            for (int i = 0; i < devicesCount; i++)
            {
                devices.Add(GetRandomDeviceDTO());
            }

            int serviceReconnectsCount = 10;

            for (int i = 0; i < serviceReconnectsCount; i++)
            {
                await messenger.TryConnectToServer("Test1");

                IDeviceManager deviceManager = GetDeviceManager(messenger, devices);
                await Task.Delay(200);

                Assert.AreEqual(devicesCount, deviceManager.Devices.Count());

                await messenger.DisconnectFromServer();

                await Task.Delay(200);

                Assert.AreEqual(0, deviceManager.Devices.Count());
            }
        }
 public DeviceManager(IMetaPubSub metaMessenger, IWindowsManager windowsManager, IRemoteDeviceFactory remoteDeviceFactory, IEnumerable <DeviceDTO> devices)
     : this(metaMessenger, windowsManager, remoteDeviceFactory)
 {
     foreach (var device in devices)
     {
         AddDevice(device);
     }
 }
Example #14
0
        public ProximityLockManager(ITaskbarIconManager taskbarIconManager, IMetaPubSub metaMessenger)
        {
            _taskbarIconManager = taskbarIconManager;
            _metaMessenger      = metaMessenger;

            _metaMessenger.TrySubscribeOnServer <WorkstationUnlockedMessage>(OnWorkstationUnlocked);
            _metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.DevicesCollectionChangedMessage>(OnDevicesCollectionChanged);
        }
Example #15
0
        const string NOTIFICATION_ID_SUFFIX = "_specialBatteryNotification"; // Doesn't matter what it is, as long as its a unique constant string

        public VaultLowBatteryMonitor(IMetaPubSub messenger, IDeviceManager deviceManager)
        {
            _messenger     = messenger;
            _deviceManager = deviceManager;

            _messenger.TrySubscribeOnServer <DeviceBatteryChangedMessage>(OnDeviceBatteryChanged);
            _messenger.TrySubscribeOnServer <DeviceConnectionStateChangedMessage>(OnDeviceConnectionStateChanged);
        }
Example #16
0
        public RemoteDevicePubSubManager(IMetaPubSub messenger, ILog log)
            : base(nameof(RemoteDevicePubSubManager), log)
        {
            RemoteConnectionPubSub = new MetaPubSub(new MetaPubSubLogger(new NLogWrapper()));
            PipeName   = "HideezRemoteDevicePipe_" + Guid.NewGuid().ToString();
            _messenger = messenger;

            InitializePubSub();
        }
Example #17
0
        public IndicatorsViewModel(IServiceProxy serviceProxy, IMetaPubSub metaMessenger)
        {
            _serviceProxy = serviceProxy;

            InitIndicators();

            metaMessenger.Subscribe <ConnectionServiceChangedMessage>(c => ResetIndicators(c.IsConnected));
            metaMessenger.TrySubscribeOnServer <HideezMiddleware.IPC.Messages.ServiceComponentsStateChangedMessage>(OnComponentsStateChangedMessage);
        }
 /// <summary>
 /// The method that unsubscribes the pipe device from all events, stops direct MetaPubSub server
 /// and remove its pairing with the relative pipe device.
 /// </summary>
 /// <param name="pipeDevice">The pipe device that must unsubscribe from all events.</param>
 /// <param name="pubSub">The key through which you want to remove the pipe device from the dictionary.</param>
 void DisposePipeDevicePair(IPipeDevice pipeDevice, IMetaPubSub pubSub)
 {
     if (pubSub != null)
     {
         pipeDevice.DeviceStateChanged -= RemoteConnection_DeviceStateChanged;
         pubSub.StopServer();
         RemotePipeDevicesDictionary.Remove(pubSub);
     }
 }
Example #19
0
        public ServiceProxy(IMetaPubSub metaMessenger)
        {
            _metaMessenger = metaMessenger;

            _metaMessenger.Subscribe <SendActivationCodeMessage>(OnSendActivationCodeMessage);
            _metaMessenger.Subscribe <CancelActivationCodeEntryMessage>(OnCancelActivationCodeMessage);

            _metaMessenger.Subscribe <ConnectedToServerEvent>(OnConnected, null);
            _metaMessenger.Subscribe <DisconnectedFromServerEvent>(OnDisconnected, null);
        }
        public SoftwareUnlockSettingViewModel(IMetaPubSub metaMessenger)
        {
            _metaMessenger = metaMessenger;

            _metaMessenger.TrySubscribeOnServer <ServiceSettingsChangedMessage>(OnServiceSettingsChanged);
            try
            {
                _metaMessenger.PublishOnServer(new RefreshServiceInfoMessage());
            }
            catch (Exception) { } // Handle error in case we are not connected to server
        }
        public DeviceManager(IMetaPubSub metaMessenger, IWindowsManager windowsManager, IRemoteDeviceFactory remoteDeviceFactory)
        {
            _windowsManager      = windowsManager;
            _remoteDeviceFactory = remoteDeviceFactory;
            _metaMessenger       = metaMessenger;

            _metaMessenger.TrySubscribeOnServer <DevicesCollectionChangedMessage>(OnDevicesCollectionChanged);
            _metaMessenger.TrySubscribeOnServer <DeviceConnectionStateChangedMessage>(OnDeviceConnectionStateChanged);

            _metaMessenger.Subscribe <DisconnectedFromServerEvent>(OnDisconnectedFromService, null);
        }
        public HardwareKeyPageViewModel(IMetaPubSub metaMessenger, ServiceViewModel serviceViewModel)
        {
            _metaMessenger = metaMessenger;
            Service        = serviceViewModel;

            _metaMessenger.TrySubscribeOnServer <ServiceSettingsChangedMessage>(OnServiceSettingsChanged);
            try
            {
                _metaMessenger.PublishOnServer(new RefreshServiceInfoMessage());
            }
            catch (Exception) { } // Handle error in case we are not connected to server
        }
        // TODO: Add error handling if service is offline
        public ServerAddressEditControlViewModel(IMetaPubSub metaMessenger, ILog log)
        {
            _metaMessenger = metaMessenger;
            _log           = log;

            _metaMessenger.TrySubscribeOnServer <ServiceSettingsChangedMessage>(OnServiceSettingsChanged);
            try
            {
                _metaMessenger.PublishOnServer(new RefreshServiceInfoMessage());
            }
            catch (Exception) { } // Handle error in case we are not connected to server
        }
        public PipeDeviceConnectionManager(BleDeviceManager deviceManager, IMetaPubSub pubSub, ILog log) :
            base(nameof(PipeDeviceConnectionManager), log)
        {
            _deviceManager     = deviceManager;
            _messenger         = pubSub;
            _pipeDeviceFactory = new PipeDeviceFactory(_deviceManager, log);

            _messenger.Subscribe <RemoteDeviceDisconnectedMessage>(OnRemoteDeviceDisconnected);
            _messenger.Subscribe <RemoteConnection_RemoteCommandMessage>(RemoteConnection_RemoteCommandAsync);
            _messenger.Subscribe <RemoteConnection_VerifyCommandMessage>(RemoteConnection_VerifyCommandAsync);
            _messenger.Subscribe <RemoteConnection_ResetChannelMessage>(RemoteConnection_ResetChannelAsync);
            _messenger.Subscribe <EstablishRemoteDeviceConnectionMessage>(EstablishRemoteDeviceConnection);
        }
        public DeviceSettingsPageViewModel(IServiceProxy serviceProxy, IWindowsManager windowsManager, IActiveDevice activeDevice, IMetaPubSub metaMessenger)
        {
            this.serviceProxy   = serviceProxy;
            this.windowsManager = windowsManager;
            _metaMessenger      = metaMessenger;

            _metaMessenger.Subscribe <ActiveDeviceChangedMessage>(OnActiveDeviceChanged);

            Сonnected = new StateControlViewModel
            {
                Name    = "Status.Device.Сonnected",
                Visible = true,
            };
            Initialized = new StateControlViewModel
            {
                Name    = "Status.Device.Initialized",
                Visible = true,
            };
            Authorized = new StateControlViewModel
            {
                Name    = "Status.Device.Authorized",
                Visible = true,
            };
            StorageLoaded = new StateControlViewModel
            {
                Name    = "Status.Device.StorageLoaded",
                Visible = true,
            };

            Indicators.Add(Сonnected);
            Indicators.Add(Initialized);
            Indicators.Add(Authorized);
            Indicators.Add(StorageLoaded);

            this.WhenAnyValue(x => x.Device).Where(d => d != null).Subscribe(d =>
            {
                PropertyChangedEventManager.AddListener(Device, this, nameof(Device.IsConnected));
                PropertyChangedEventManager.AddListener(Device, this, nameof(Device.IsInitialized));
                PropertyChangedEventManager.AddListener(Device, this, nameof(Device.IsAuthorized));
                PropertyChangedEventManager.AddListener(Device, this, nameof(Device.IsStorageLoaded));

                Сonnected.State     = StateControlViewModel.BoolToState(Device.IsConnected);
                Initialized.State   = StateControlViewModel.BoolToState(Device.IsInitialized);
                Authorized.State    = StateControlViewModel.BoolToState(Device.IsAuthorized);
                StorageLoaded.State = StateControlViewModel.BoolToState(Device.IsStorageLoaded);
            });

            this.WhenAnyValue(x => x.LockProximity, x => x.UnlockProximity).Where(t => t.Item1 != 0 && t.Item2 != 0).Subscribe(o => ProximityHasChanges = true);

            Device = activeDevice.Device != null ? new DeviceViewModel(activeDevice.Device) : null;
        }
Example #26
0
 public MenuFactory(IStartupHelper startupHelper
                    , IWindowsManager windowsManager, IAppHelper appHelper,
                    ISettingsManager <ApplicationSettings> settingsManager, ISupportMailContentGenerator supportMailContentGenerator,
                    IServiceProxy serviceProxy, IActiveDevice activeDevice, IMetaPubSub metaMessenger)
 {
     _startupHelper               = startupHelper;
     _windowsManager              = windowsManager;
     _appHelper                   = appHelper;
     _settingsManager             = settingsManager;
     _supportMailContentGenerator = supportMailContentGenerator;
     _serviceProxy                = serviceProxy;
     _activeDevice                = activeDevice;
     _metaMessenger               = metaMessenger;
 }
        public async Task DeviceCollectionChanged_AddDevicesAsync_DevicesEnumerated()
        {
            var         devices   = new List <DeviceDTO>();
            IMetaPubSub messenger = GetMessenger();

            devices.Add(GetRandomDeviceDTO());

            IDeviceManager deviceManager = GetDeviceManager(messenger, devices);

            Assert.AreEqual(1, deviceManager.Devices.Count());

            devices.Add(GetRandomDeviceDTO());
            await messenger.Publish(new DevicesCollectionChangedMessage(devices.ToArray()));

            await Task.Run(() =>
            {
                devices.Add(GetRandomDeviceDTO());
                devices.Add(GetRandomDeviceDTO());
                messenger.Publish(new DevicesCollectionChangedMessage(devices.ToArray()));
            });

            await Task.Delay(2000);

            Assert.AreEqual(4, deviceManager.Devices.Count());

            devices.RemoveAt(0);
            await messenger.Publish(new DevicesCollectionChangedMessage(devices.ToArray()));

            await Task.Delay(1000);

            Assert.AreEqual(3, deviceManager.Devices.Count());

            await Task.Run(() =>
            {
                devices.RemoveAt(0);
            });

            await messenger.Publish(new DevicesCollectionChangedMessage(devices.ToArray()));

            await Task.Delay(1000);

            Assert.AreEqual(2, deviceManager.Devices.Count());
        }
        public EditAccountViewModel(DeviceViewModel device,
                                    AccountRecord accountRecord,
                                    IWindowsManager windowsManager,
                                    IQrScannerHelper qrScannerHelper,
                                    IMetaPubSub metaMessenger)
        {
            _windowsManager  = windowsManager;
            _qrScannerHelper = qrScannerHelper;
            _device          = device;
            _metaMessenger   = metaMessenger;

            if (accountRecord == null)
            {
                IsNewAccount  = true;
                cache         = new AccountRecord();
                AccountRecord = new AccountRecord();
            }
            else
            {
                cache         = accountRecord;
                AccountRecord = new AccountRecord
                {
                    Key       = accountRecord.Key,
                    StorageId = accountRecord.StorageId,
                    Timestamp = accountRecord.Timestamp,
                    Flags     = accountRecord.Flags,
                    Name      = accountRecord.Name,
                    Login     = accountRecord.Login,
                    Password  = accountRecord.Password,
                    OtpSecret = accountRecord.OtpSecret,
                    Apps      = accountRecord.Apps,
                    Urls      = accountRecord.Urls,
                    IsPrimary = accountRecord.IsPrimary,
                };
                InitProp(AccountRecord);
            }
            HasOpt = cache.Flags.HasOtp;
            InitDependencies();
        }
        public MainViewModel(IDeviceManager deviceManager,
                             IMenuFactory menuFactory,
                             IActiveDevice activeDevice,
                             IMetaPubSub metaMessenger,
                             ViewModelLocator viewModelLocator,
                             IAppHelper appHelper,
                             SoftwareUnlockSettingViewModel softwareUnlock)
        {
            _deviceManager    = deviceManager;
            _menuFactory      = menuFactory;
            _activeDevice     = activeDevice;
            _viewModelLocator = viewModelLocator;
            _appHelper        = appHelper;
            _softwareUnlock   = softwareUnlock;

            InitMenu();

            _deviceManager.DevicesCollectionChanged += Devices_CollectionChanged;
            _activeDevice.ActiveDeviceChanged       += ActiveDevice_ActiveDeviceChanged;

            metaMessenger.Subscribe <OpenPasswordManagerMessage>((p) => { MenuPasswordManager.IsChecked = true; return(Task.CompletedTask); });
            metaMessenger.Subscribe <OpenHideezKeyPageMessage>((p) => { MenuHardwareKeyPage.IsChecked = true; return(Task.CompletedTask); });
            metaMessenger.Subscribe <OpenMobileAuthenticatorPageMessage>((p) => { MenuSoftwareKeyPage.IsChecked = true; return(Task.CompletedTask); });
        }
        public UserActionHandler(
            IMetaPubSub metaMessenger,
            IActiveDevice activeDevice,
            InputLogin inputLogin,
            InputPassword inputPassword,
            InputOtp inputOtp,
            ISettingsManager <ApplicationSettings> appSettingsManager,
            IHotkeyManager hotkeyManager,
            IWindowsManager windowsManager,
            ILog log)
            : base(nameof(UserActionHandler), log)
        {
            _metaMessenger      = metaMessenger;
            _activeDevice       = activeDevice;
            _inputLogin         = inputLogin;
            _inputPassword      = inputPassword;
            _inputOtp           = inputOtp;
            _appSettingsManager = appSettingsManager;
            _hotkeyManager      = hotkeyManager;
            _windowsManager     = windowsManager;

            _metaMessenger.Subscribe <HotkeyPressedMessage>(HotkeyPressedMessageHandler);
            _metaMessenger.Subscribe <ButtonPressedMessage>(ButtonPressedMessageHandler);
        }