/// <summary>
        ///     Commands Initialisieren (aufruf im Kostruktor von VmBase)
        /// </summary>
        protected override void InitializeCommands()
        {
            CmdSave = new VmCommand(ResViewEditUser.CmdSaveName, async() =>
            {
                IsBusy = true;

                var d        = BissClone.Clone(UserAccountData);
                d.FirstName  = Data.FirstName;
                d.LastName   = Data.LastName;
                d.City       = Data.City;
                d.PostalCode = Data.PostalCode;
                d.Street     = Data.Street;

                var r = await Sa.UserUpdate(d);
                if (await this.CheckRestStatusResult(r.Status) &&
                    await this.CheckSaveResult(r.Result))
                {
                    CheckSaveBehavior = null;
                    UserAccountData   = d;
                    FileExtensions.BcFiles(null).UserAppData.Save(d);
                    ViewResult = Data;

                    ContinueNavigation();
                }

                IsBusy = false;
            }, () => CheckSaveBehavior != null && CheckSaveBehavior.Check(), ResViewEditUser.CmdSaveTooltip);

            CmdSkip = new VmCommand(ResViewEditUser.CmdSkipName, async() =>
            {
                CheckSaveBehavior = null;
                ContinueNavigation();
            });
        }
Exemple #2
0
        /// <summary>
        ///     Commands Initialisieren (aufruf im Kostruktor von VmBase)
        /// </summary>
        protected override void InitializeCommands()
        {
            CmdChangeUserData = new VmCommand(ResViewUser.CmdChangeUserData, async() =>
            {
                IsBusy = true;

                var d        = BissClone.Clone(UserAccountData);
                d.FirstName  = Data.FirstName;
                d.LastName   = Data.LastName;
                d.City       = Data.City;
                d.PostalCode = Data.PostalCode;
                d.Street     = Data.Street;

                var r = await Sa.UserUpdate(d);
                if (await this.CheckRestStatusResult(r.Status) &&
                    await this.CheckSaveResult(r.Result))
                {
                    CheckSaveBehavior = null;
                    UserAccountData   = d;
                    FileExtensions.BcFiles(null).UserAppData.Save(d);
                    ViewResult = Data;
                }

                IsBusy = false;
                UpdateData();
            }, () => CheckSaveBehavior != null && CheckSaveBehavior.Check());

            CmdChangePassword = new VmCommand(ResViewUser.CmdChangePassword, async() => { await Nav.ToViewWithResult("ViewEditPassword"); }, () => _dataLoaded);

            CmdLogout = new VmCommand(ResViewUser.CmdLogout, async() =>
            {
                FileExtensions.BcFiles(null).UserAppData.Delete();
                UserAccountData = null;
                await DeviceInfoDelete();
                if (Constants.SupportLogin)
                {
                    AppCenter.UpdateCurrentUser("", "");
                }
                UpdateMenu();
                Nav.ToView("ViewMain");
            });

            CmdDeleteAccount = new VmCommand(ResViewUser.CmdDeleteAccount, async() =>
            {
                var res = await MsgBox.Show(ResViewUser.MsgBoxDeleteAccount, ResViewUser.MsgBoxDeleteAccountCaption, VmMessageBoxButton.YesNo);

                if (res == VmMessageBoxResult.Yes)
                {
                    IsBusy = true;

                    var saRes = await Sa.DeleteUser(UserAccountData.UserId);

                    if (await this.CheckRestStatusResult(saRes.Status))
                    {
                        CheckSaveBehavior = null;
                        CmdLogout.Execute(null);
                    }

                    IsBusy = false;
                }
            });
        }