void OnManagerEnabledChanged(bool newValue)
 {
     Task.Run(() =>
     {
         if (newValue)
         {
             _metaMessenger.Subscribe <DeviceButtonPressedMessage>(OnDeviceButtonPressed);
         }
         else
         {
             _metaMessenger.Unsubscribe <DeviceButtonPressedMessage>(OnDeviceButtonPressed);
         }
     });
 }
Example #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    PropertyChanged -= Device_PropertyChanged;
                    _metaMessenger.Unsubscribe <HideezMiddleware.IPC.Messages.DeviceConnectionStateChangedMessage>(OnDeviceConnectionStateChanged);
                    _metaMessenger.Unsubscribe <HideezMiddleware.IPC.Messages.DeviceInitializedMessage>(OnDeviceInitialized);
                    _metaMessenger.Unsubscribe <HideezMiddleware.IPC.Messages.DeviceFinishedMainFlowMessage>(OnDeviceFinishedMainFlow);
                    _metaMessenger.Unsubscribe <HideezMiddleware.IPC.Messages.DeviceOperationCancelledMessage>(OnOperationCancelled);
                    _metaMessenger.Unsubscribe <HideezMiddleware.IPC.Messages.DeviceProximityChangedMessage>(OnDeviceProximityChanged);
                    _metaMessenger.Unsubscribe <HideezMiddleware.IPC.Messages.DeviceBatteryChangedMessage>(OnDeviceBatteryChanged);
                    _metaMessenger.Unsubscribe <HideezMiddleware.IPC.Messages.DeviceProximityLockEnabledMessage>(OnDeviceProximityLockEnabled);
                    _metaMessenger.Unsubscribe <HideezMiddleware.IPC.Messages.LockDeviceStorageMessage>(OnLockDeviceStorage);
                    _metaMessenger.Unsubscribe <HideezMiddleware.IPC.Messages.LiftDeviceStorageLockMessage>(OnLiftDeviceStorageLock);
                    _metaMessenger.Unsubscribe <SendPinMessage>(OnPinReceived);
                    _metaMessenger.Unsubscribe <SessionSwitchMessage>(OnSessionSwitch);
                    StopDeviceMessangerAsync();
                }

                disposed = true;
            }
        }