Exemple #1
0
        public SetPwViewModel()
        {
            OkCommand = new Command(async() =>
            {
                UserInteraction();
                if (!IsValid)
                {
                    return;
                }
                Settings.SetDoorLock(Pw1);
                await DialogService.ShowMessage(
                    string.Format(AppResources.SetPwViewModel_SetPwViewModel_Your_new_password___0___has_been_recorded__Don_t_forget_it__, pw1), AppResources.SetPwViewModel_SetPwViewModel_Confirmation);
                if (isChangingPW)
                {
                    await Navigation.ModalDismiss();
                    return;
                }
                LoginSwitch.LogOut();
            },
                                    () => IsValid);

            CancelCommand = new Command(async() =>
            {
                UserInteraction();
                if (isChangingPW)
                {
                    await Navigation.ModalDismiss();
                    return;
                }
                LoginSwitch.LogOut();
            });
        }
        public MainListViewModel()
        {
            proFilterList         = InfoSheet.ProfilterTuples;
            ProFilter             = InfoSheet.ProFilter.All;
            profilterItem         = proFilterList[0];
            SearchCommand         = new Command(() => { UserInteraction(); loadData(); });
            LockScreenCommand     = new Command(() => LoginSwitch.LogOut());
            ChangePasswordCommand = new Command(() => Navigation.ModalNavigateTo(PageName.SetPwPage.ToString(), true));
            ParametersCommand     = new Command(() => Navigation.NavigateTo(PageName.SettingsPage.ToString()));
            NewEntryCommand       = new Command(() => Navigation.ModalNavigateTo(PageName.EditPage.ToString()));
            MessengerInstance.Register <NotificationMessage>(this, n =>
            {
                if (n.Notification == Utils.GlobalMessages.SettingsChanged.ToString())
                {
                    // ReSharper disable once ExplicitCallerInfoArgument
                    RaisePropertyChanged(nameof(IsLineVisible));
                    // ReSharper disable once ExplicitCallerInfoArgument
                    RaisePropertyChanged(nameof(IsDateVisible));
                    return;
                }
                if (n.Notification == Utils.GlobalMessages.DataDeleted.ToString() ||
                    n.Notification == Utils.GlobalMessages.DataInserted.ToString())
                {
                    loadData();
                    return;
                }
                if (n.Notification == Utils.GlobalMessages.DataModified.ToString())
                {
                    loadData();
                    return;
                }
            });

            loadData();
            if (DataCount == 0)
            {
                createTest();
            }
        }