Example #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="navService">Navigation service instance resolved by DI.</param>
        /// <param name="dispatcherService">Dispatcher service instance resolved by DI.</param>
        public VMMainPage(INavigationService navService, IDispatcherService dispatcherService,
                          ISettingsService settingsService, IApiService apiService, INFCService nfcService,
                          IBluetoothService bluetoothService, IBfService bfService, IPairingService pairingService, IUxService uxService)
        {
            this.navService        = navService;
            this.settingsService   = settingsService;
            this.dispatcherService = dispatcherService;
            this.apiService        = apiService;
            this.nfcService        = nfcService;
            this.bluetoothService  = bluetoothService;
            this.bfService         = bfService;
            this.pairingService    = pairingService;
            this.uxService         = uxService;

            this.setAsBusyCommand                    = new DelegateCommand <bool>(SetAsBusyExecte);
            this.logOutCommand                       = new DelegateCommand(LogOutExecute);
            this.navigateToSecureEmailCommand        = new DelegateCommand(NavigateToSecureEmailExecute);
            this.navigateToShareSecureMessageCommand = new DelegateCommand(NavigateToShareSecureMessageExecute);
            this.startNfcPairingCommand              = new DelegateCommand(StartNfcPairingExecute);
            this.navigateToAboutCommand              = new DelegateCommand(NavigateToAboutExecute);
            this.addressChooserCommand               = new DelegateCommand(AddressChooserExecute);
            this.sendSecureEmailCommand              = new DelegateCommand(SendSecureEmailExecute, SendSecureEmailCanExecute);
            this.shareSecureMessageCommand           = new DelegateCommand(ShareSecureMessageExecute, ShareSecureMessageCanExecute);
            this.publishMessageCommand               = new DelegateCommand(PublishMessageExecute, PublishMessageCanExecute);
            this.writeToTagCommand                   = new DelegateCommand(WriteToTagExecute, WriteToTagCanExecute);
            this.encryptSecureNoteCommand            = new DelegateCommand(EncryptSecureNoteExecute, EncryptSecureNoteCanExecute);
            this.clearLogCommand                     = new DelegateCommand(ClearLogExecute);
            this.navigateToInstructionsCommand       = new DelegateCommand(NavigateToInstructionsExecite);
            this.pairDeviceCommand                   = new DelegateCommand(PairDeviceExecute, PairDeviceCanExecute);
            //this.pairDeviceCommand = new DelegateCommand(PairDeviceExecute);

            if (this.nfcService.ConnectDefaultProximityDevice())
            {
                this.nfcService.DeviceArrived             += nfcService_DeviceArrived;
                this.nfcService.DeviceLeft                += nfcService_DeviceLeft;
                this.nfcService.MessageReceivedCompleted  += nfcService_MessageReceivedCompleted;
                this.nfcService.MessagePublishedCompleted += nfcService_MessagePublishedCompleted;
                this.nfcService.SubscribeToMessage("WriteableTag");
                this.nfcService.SubscribeToMessage("NDEF");
                this.nfcService.SubscribeToMessage("NDEF:Unknown");
                this.nfcService.SubscribeToMessage("WindowsMime");
            }
            else
            {
                uxService.ShowToastNotification("Error", AppResources.NoNfcError);
                LogMessage(AppResources.NoNfcError, NfcLogItem.ERROR_ICON);
            }

            contacts   = new Contacts();
            myIdentity = (string)settingsService.Get("email");
        }
Example #2
0
 /// <summary>
 /// Handler for the nfcService DeviceLeft event
 /// </summary>
 private void nfcService_DeviceLeft()
 {
     DevicePresent = false;
     LogMessage(AppResources.NotifyDeviceDeparted, NfcLogItem.NFC_ICON);
     dispatcherService.CallDispatcher(() => uxService.ShowToastNotification("NFC", AppResources.NotifyDeviceDeparted));
 }