public SplitDetailViewModel(IActivityService activityService, ITwilioService twilioService, IDialogService dialogService, IMvxPhoneCallTask phoneCallTask, IMvxMessenger messenger, IProspectService prospectService, IMvxNavigationService navigationService)
        {
            Messenger          = messenger;
            _prospectService   = prospectService;
            _navigationService = navigationService;
            _phoneCallTask     = phoneCallTask;
            _dialogService     = dialogService;
            _twilioService     = twilioService;
            _activityService   = activityService;
            Phones             = new ObservableCollection <KeyValuePair <string, string> >();

            Messenger.Subscribe <RefreshMessage>(message => _clearDetailsInteraction.Raise(), MvxReference.Strong);
            Messenger.Subscribe <ProspectChangedMessage>(message => Prepare(new KeyValuePair <Prospect, User>(message.UpdatedProspect, User)), MvxReference.Strong);
            Messenger.Subscribe <UserLogoutMessage>(message => UserLogout(), MvxReference.Strong);
            Messenger.Subscribe <ActivityAddedMessage>(message => ActivityAdded(message.AddedActivity), MvxReference.Strong);
            Messenger.Subscribe <ProspectChangedMessage>(message =>
            {
                RaisePropertyChanged(() => EmailEntered);
                RaisePropertyChanged(() => StreetAddressEntered);
                RaisePropertyChanged(() => MobilePhoneEntered);
                RaisePropertyChanged(() => HomePhoneEntered);
                RaisePropertyChanged(() => WorkPhoneEntered);
                RaisePropertyChanged(() => AllowCalling);
                RaisePropertyChanged(() => AllowEmailing);
                RaisePropertyChanged(() => AllowTexting);
            },
                                                         MvxReference.Strong);
        }
Example #2
0
        public DialogViewModel(ILocationService locationService, ITravelPanelService travelPanelService,
                               IStartButtonService startButtonService, ITrailService trailService)
        {
            _visible.Raise(true);
            _locationService    = locationService;
            _travelPanelService = travelPanelService;
            _startButtonService = startButtonService;
            _trailService       = trailService;

            var currentLocation = _locationService.CurrentLocation;


            var nearestPoint = _locationService.GetNearestPoint(currentLocation, _trailService.Points);

            if (_locationService.CheckPointIsNear(currentLocation, nearestPoint)) // user and point location
            {
                CanStart          = true;
                TrailStartCommand = new MvxCommand(StartTrail);
                TrailTitle        = "MOŻNA"; // here name of point
                TrailInfo         = "Możesz rozpocząć swoją wędrówkę!";
            }
            else
            {
                var distance = _locationService.GetDistanceBetweenTwoPointsOnMapInMeters(currentLocation, nearestPoint);
                CanStart   = false;
                TrailTitle = "NIE MOŻNA";                                                                                       //some function should be here, but idk how i want to do here
                TrailInfo  = "Najbliższy punkt to " + nearestPoint.Name + " oddalony o " + _locationService.Distance(distance); // name of nearest point
            }
            NearestPointCommand = new MvxCommand(ShowNearestPoint);
        }
Example #3
0
        private async void StartGame()
        {
            var scannerOptions = new MobileBarcodeScanningOptions
            {
                PossibleFormats = new List <BarcodeFormat>
                {
                    BarcodeFormat.QR_CODE
                }
            };
            var scanner = new MobileBarcodeScanner
            {
                TopText          = "Zeskanuj kod startowy",
                CancelButtonText = "Anuluj"
            };

            var scanResult = await scanner.Scan(scannerOptions);

            if (scanResult != null &&
                VerifyStartingCode(scanResult.Text))
            {
                _gameStateService.StartGame();
                ShowViewModelAndClearBackStack <GameViewModel>();
            }
            else
            {
                _dialogInteraction.Raise(new DialogInteraction
                {
                    Title = "Niepoprawny kod",
                    Text  = "Kod, który próbujesz zeskanować jest niepoprawny, lub nie nadaje się do zeskanowania w tym momencie gry. Skontaktuj się z organizatorem."
                });
            }
        }
 /// <summary>
 /// Resets the mnemonic confirmation process, generating a new key.
 /// </summary>
 private void ResetValidation()
 {
     // Passing an empty list of buttons simply deletes all existing buttons
     _createButtons.Raise(new MnemonicValidationInteraction()
     {
         buttons = { }, onButtonClick = { }
     });
     GenerateAccount();
 }
Example #5
0
 protected void RaiseNotification(string message, string caption, Action callback = null)
 {
     notificationInteraction.Raise(
         new NotificationBox
     {
         Message  = message,
         Caption  = caption,
         Callback = callback,
     });
 }
Example #6
0
        public TrafficCardViewModel(IMvxMessenger messenger, ITrafficCardResponseService trafficCardResponseService, IMvxNavigationService navigationService, IUserService userService)
        {
            Messenger = messenger;
            _trafficCardResponseService = trafficCardResponseService;
            _navigationService          = navigationService;
            _userService = userService;

            Messenger.Subscribe <RefreshMessage>(message => _clearDetailsInteraction.Raise(), MvxReference.Strong);
            Messenger.Subscribe <UserLogoutMessage>(message => _clearDetailsInteraction.Raise(), MvxReference.Strong);
            Messenger.Subscribe <TrafficCardResponseChangedMessage>(message => ResponseUpdated(message.ChangedResponse), MvxReference.Strong);
        }
        public CobuyerViewModel(IMvxMessenger messenger, ICobuyerService cobuyerService, IMvxNavigationService navigationService, IUserService userService)
        {
            Messenger          = messenger;
            _cobuyerService    = cobuyerService;
            _navigationService = navigationService;
            _userService       = userService;

            Messenger.Subscribe <RefreshMessage>(message => _clearDetailsInteraction.Raise(), MvxReference.Strong);
            Messenger.Subscribe <UserLogoutMessage>(message => _clearDetailsInteraction.Raise(), MvxReference.Strong);
            Messenger.Subscribe <CobuyerChangedMessage>(message => CobuyerUpdated(message.UpdatedCobuyer), MvxReference.Strong);
            Messenger.Subscribe <CobuyerAddedMessage>(message => CobuyerAdded(message.AddedCobuyer), MvxReference.Strong);
        }
Example #8
0
 private void ChangePassword(VaultParams vaultParams)
 {
     try
     {
         Vault.ChangePassword(vaultParams.Password);
         _messageInteraction.Raise(new MessageInteraction("Password changed."));
     }
     catch (System.Exception e)
     {
         _messageInteraction.Raise(new MessageInteraction(e.Message));
     }
 }
Example #9
0
        public ActivitiesViewModel(IMvxMessenger messenger, IActivityService activitiesService, IMvxNavigationService navigationService, IUserService userService)
        {
            Messenger          = messenger;
            _activitiesService = activitiesService;
            _navigationService = navigationService;
            _userService       = userService;

            Messenger.Subscribe <RefreshMessage>(message => _clearDetailsInteraction.Raise(), MvxReference.Strong);
            Messenger.Subscribe <UserLogoutMessage>(message => _clearDetailsInteraction.Raise(), MvxReference.Strong);
            Messenger.Subscribe <ActivityAddedMessage>(message => ActivityAdded(message.AddedActivity), MvxReference.Strong);
            Messenger.Subscribe <ProspectChangedMessage>(message => ProspectChanged(message.UpdatedProspect), MvxReference.Strong);
        }
Example #10
0
        public AfterStartDialogViewModel(ILocationService locationService, ITravelPanelService travelPanelService,
                                         IStartButtonService startButtonService)
        {
            _visible.Raise(true);
            _locationService    = locationService;
            _travelPanelService = travelPanelService;
            _startButtonService = startButtonService;

            _travelPanelService.SetTravelTime();
            TimeInfo       = "Twoj czas: " + _travelPanelService.TravelTime;
            StopTravel     = new MvxCommand(ExecuteStopTravel);
            DontStopTravel = new MvxCommand(ExecuteDontStopTravel);
        }
Example #11
0
 private void SetEntryIcon(string fileName)
 {
     if (Entry != null)
     {
         try
         {
             Entry.Icon = new BitmapImage(new Uri(fileName));
             RaisePropertyChanged(() => Entry);
         }
         catch (Exception e)
         {
             _messageInteraction.Raise(new MessageInteraction(e.Message));
         }
     }
 }
Example #12
0
        private void AddSentMessage(SMSSentMessage message)
        {
            //receiving a message from prospect update the appropriate row with the new data
            var tableRow = SMSActivities.FirstOrDefault(s => s.ProspectAddressBook == message.SMSActivitySent.ProspectAddressBook);

            if (tableRow != null)
            {
                tableRow.MessageBody = message.SMSActivitySent.MessageBody;
                tableRow.UpdatedDate = message.SMSActivitySent.UpdatedDate;

                var request = new TableRow {
                    TableRowToUpdate = SMSActivities.IndexOf(tableRow)
                };
                _updateRowInteraction.Raise(request);
            }
        }
Example #13
0
        private void OpenVault(VaultParams vaultParams)
        {
            System.Diagnostics.Debug.WriteLine($"-- OpenVault -> vaultParams.FilePath = {vaultParams.FilePath}");

            if (Vault.Exists())
            {
                // TODO: Figure out what to do with this
                var _vault = Vault.GetInstance();
                _vault.EncryptToFile(_vault.Location, _vault.EncryptionInfo.ProtectedKey);
                Vault.Delete();
            }

            if (string.IsNullOrWhiteSpace(vaultParams.FilePath))
            {
                throw new ArgumentNullException("filePath", "Path to file is either null or empty.");
            }

            var vault = Vault.GetInstance();

            try
            {
                vault.DecryptFromFile(vaultParams.FilePath, vaultParams.Password);
                vault.SetupProtectedKey(vaultParams.Password);
                _navigationService.Navigate <VaultViewModel>();
            }
            catch (Exception e)
            {
                Vault.Delete();
                _messageInteraction.Raise(new MessageInteraction(e.Message));
            }
        }
Example #14
0
        private void UploadCommand()
        {
            byte status = 0;
            // 1. do cool stuff with profile data
            // ...

            // 2. request interaction from view
            // 3. execution continues in callbacks
            var request = new FileDialogInteraction
            {
                SelectedFile = async(ok) =>
                {
                    if (ok)
                    {
                        await Task.Run(() => status = 1);
                    }
                    else
                    {
                        status = 0;
                    }
                },
            };

            _interaction.Raise(request);
            if (status == 1)
            {//TODO Error handling for the passport upload
                Passport = GetImage(ConvertToByte(request.File), Passport);
            }
        }
Example #15
0
        private /*async Task*/ void RemoveSelectedSubjectCommand()
        {
            byte status  = 0;
            var  request = new RemoveSelectedSubjectInteraction
            {
                SubjectSelected = async(ok) =>
                {
                    if (ok)
                    {
                        status = 1;
                    }
                    else
                    {
                        status = 0;
                    }
                },
            };

            _subjectInteraction.Raise(request);
            if (status == 1)
            {
                /*await Task.Run(() => */
                SubjectsAndNotes.Add(SelectedSubjectOfInterest);     //);
                /*await Task.Run(() => */
                SubjectOfInterest.Remove(SelectedSubjectOfInterest); //);
                SelectedSubjectsAndNote = null;
            }
        }
Example #16
0
        private void ReadMore()
        {
            var message = new TrailMessage(this, _trailService.Trails[_trailId]);

            _navigationService.Navigate <TrailDetailsViewModel>();
            _visible.Raise(false);
            _messenger.Publish(message);
        }
Example #17
0
 private async Task ChangeAdminStatus(UserModel user)
 {
     if (user.IsAdmin)
     {
         string message = $"Сигурни ли сте, че желаете да премахнете административните права на {user.FirstName} {user.LastName}?";
         await ShowMessage(
             message,
             "Премахване на права",
             async() => await DoChangeAdminStatus(user),
             () => {
             refreshInteraction.Raise();
             return(Task.CompletedTask);
         });
     }
     else
     {
         await DoChangeAdminStatus(user);
     }
 }
Example #18
0
        private void ConfirmSomething()
        {
            var confirmActionModel = new ConfirmActionModel()
            {
                ConfirmActionCallback = async(confirmed) => { await HandleConfirmationResult(confirmed); }
            };

            _log.Debug("Ask the user to confirm.");
            _confirmInteraction.Raise(confirmActionModel);
        }
Example #19
0
        protected EntryViewModel(IAuthService authService, IApiService apiService, IMvxNavigationService navigationService, ICurrentUserService currentUserService)
            : base(apiService, navigationService, currentUserService)
        {
            this.authService = authService;

            GoToServerSettingCommand = new MvxAsyncCommand(() => navigationService.Navigate <ServerSettingViewModel>());
            GoToLoginCommand         = new MvxAsyncCommand(() => navigationService.Navigate <LoginViewModel>());
            GoToRegisterCommand      = new MvxAsyncCommand(() => navigationService.Navigate <RegisterViewModel>());
            CloseAppCommand          = new MvxCommand(() => closeAppInteraction.Raise());
        }
 private async void AddMessage(SMSReceivedMessage message)
 {
     //receiving a message from prospect whose messages are currently being viewed
     if (message.SMSActivityReceived.ProspectAddressBook == Prospect.ProspectAddressNumber)
     {
         //_showAlertInteraction.Raise();
         SmsMessages.Add(message.SMSActivityReceived);
         _hideAlertInteraction.Raise();
         var success = await _prospectService.UpdateProspectSMSActivityAsync(Prospect.ProspectAddressNumber);
     }
 }
Example #21
0
        public void ResponseUpdated(TrafficCardResponse response)
        {
            var r = Responses.FirstOrDefault(res => res.ResponseNumber == response.ResponseNumber);

            if (r != null)
            {
                var request = new TableRow {
                    TableRowToUpdate = Responses.IndexOf(r)
                };
                _updateRowInteraction.Raise(request);
            }
        }
Example #22
0
 public void ActivityAdded(Activity activity)
 {
     if (activity.ProspectAddressNumber == _prospect.ProspectAddressNumber)
     {
         RaisePropertyChanged(() => IsLead);
         RaisePropertyChanged(() => AssignedProspect);
         RaisePropertyChanged(() => IsLeadWithAppointment);
         RaisePropertyChanged(() => AssignedWithoutAppointment);
         ActivitiesList.Add(activity);
         _activityAddedInteraction.Raise();
     }
 }
        public void CobuyerUpdated(Cobuyer cobuyer)
        {
            var r = CobuyersList.FirstOrDefault(res => res.CobuyerAddressNumber == cobuyer.CobuyerAddressNumber);

            if (r != null)
            {
                var request = new TableRow {
                    TableRowToUpdate = CobuyersList.IndexOf(r)
                };
                _updateRowInteraction.Raise(request);
            }
        }
 public void ActivityAdded(Activity activity)
 {
     try
     {
         if (activity.ActivityType.Equals("VISIT") || activity.ActivityType.Equals("APPOINTMENT"))
         {
             var prospect = Prospects.FirstOrDefault(p => p.ProspectAddressNumber == activity.ProspectAddressNumber);
             if (prospect != null)
             {
                 prospect.ProspectCommunity.SystemActivityDate = (DateTime)activity.DateCompleted;
                 var request = new TableRow {
                     TableRowToUpdate = Prospects.IndexOf(prospect)
                 };
                 _updateRowInteraction.Raise(request);
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
 public void ActivityAdded(Activity activity)
 {
     if (activity.ProspectAddressNumber == Prospect.ProspectAddressNumber)
     {
         if (activity.ActivityType.Equals("VISIT") || activity.ActivityType.Equals("APPOINTMENT"))
         {
             Prospect.ProspectCommunity.AddressType = "Prospect";
             RaisePropertyChanged(() => IsLead);
             RaisePropertyChanged(() => AssignedProspect);
             RaisePropertyChanged(() => IsLeadWithAppointment);
             RaisePropertyChanged(() => AssignedWithoutAppointment);
             _assignedProspectInteraction.Raise();
         }
     }
 }
        private void ActiveRouteEventHandler(object sender, ServiceEvent <CarrierRouteEvents> e)
        {
            switch (e.Type)
            {
            case CarrierRouteEvents.FinishedRoute:
                this.ActiveRouteMode = false;
                this.ordersService.GetPendingOrders();
                break;

            case CarrierRouteEvents.AddedRoute:
                this.ActiveRouteMode = true;
                break;
            }

            _routeUpdateInteraction.Raise(e);
        }
Example #27
0
        private async Task TaskChange(TaskItem task)
        {
            //if (_adInterstitialShow == 4)
            //{
            //    _adInterstitialShow = 0;
            var result = await _navigationService.Navigate <TaskViewModel, TaskItem>(task);

            var request = new object
            {
            };

            _interaction.Raise(request);
            //return;
            //}
            //_adInterstitialShow = _adInterstitialShow + 1;
        }
Example #28
0
        public override async Task Initialize()
        {
            await base.Initialize();

            // //非同期でデータ取得して取得し終わったら画像を当てはめる。
            //progressDialogService.Show();

            string url        = "https://wired.jp/wp-content/uploads/2014/08/selfie-640x960.jpg";
            var    imageBytes = await GetImageBytes(url);

            // インタラクションしてBitmapに変換

            if (imageBytes != null && imageBytes.Length > 0)
            {
                _imageConvertInteraction.Raise(imageBytes);
            }

            //// 終わったらダイアログ消す。
        }
Example #29
0
        private void PickImage()
        {
            List <ConfigurableAlertAction> actions = new List <ConfigurableAlertAction>();

            actions.Add(new ConfigurableAlertAction()
            {
                Text           = ChallengesConstants.Camera,
                OnClickHandler = () =>
                {
                    _takePhotoFromCameraInteraction.Raise(OnImagesReceived);
                }
            });
            actions.Add(new ConfigurableAlertAction()
            {
                Text           = ChallengesConstants.Library,
                OnClickHandler = () =>
                {
                    _takePhotoFromLibraryInteraction.Raise(OnImagesReceived);
                }
            });
            _alertService.ShowAlertMessage("Take pickture", actions);
        }
Example #30
0
        public void AskToProceed()
        {
            if (App.Context.IsUserAuthenticated)
            {
                var request = new YesNoQuestion
                {
                    YesNoCallback = async(ok) =>
                    {
                        if (ok)
                        {
                            await SaveSettingAndLogOut();
                        }
                    },
                    Question = "Ứng dụng sẽ đăng xuất bạn để lưu sự thay đổi. Bạn có muốn tiếp tục?"
                };

                _confirmSave.Raise(request);
            }
            else
            {
                SaveSetting();
                _commonService.ShowToast("Lưu thành công.");
            }
        }