예제 #1
0
        /// <summary>
        ///     Wird aufgerufen sobald die View initialisiert wurde
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public override Task OnActivated(object args = null)
        {
            if (UserAccountData == null)
            {
                Logging.Log.LogError("UserAccount null?");
                Nav.ToView("ViewMain");
            }

            if (args is bool fromRegistration)
            {
                FromRegistration = fromRegistration;
            }

            Data = new EditUserData
            {
                LastName  = UserAccountData.LastName,
                FirstName = UserAccountData.FirstName,
            };

            CheckSaveBehavior.SetCompareData(Data.ToJson());
            Data.PropertyChanged         += (sender, eventArgs) => { CmdSave.CanExecute(); };
            _saveCheck.CheckSaveComparer += (sender, a) => { a.JsonToCompare = Data.ToJson(); };

            return(Task.CompletedTask);
        }
예제 #2
0
        /// <summary>
        ///     Wird aufgerufen sobald die View initialisiert wurde
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public override async Task OnActivated(object args = null)
        {
            if (UserAccountData == null)
            {
                ViewAfterLogin     = "******";
                ViewArgsAfterLogin = args;

                await Task.Run(async() =>
                {
                    var elem = new AsyncAutoResetEvent();
                    RunOnMainThread(async() =>
                    {
                        await Nav.ToViewWithResult("ViewLogin");

                        elem.Set();
                    });

                    await elem.WaitOne();
                });
            }

            if (UserAccountData == null)
            {
                Logging.Log.LogError("UserAccount noch immer null?");
                Nav.ToView("ViewMain");
            }
            else
            {
                _dataLoaded = true;
                CmdChangeUserData.CanExecute();
                CmdChangePassword.CanExecute();
                UpdateData();

                CheckSaveBehavior.SetCompareData(Data.ToJson());
                Data.PropertyChanged         += (sender, eventArgs) => { CmdChangeUserData.CanExecute(); };
                _saveCheck.CheckSaveComparer += (sender, a) => { a.JsonToCompare = Data.ToJson(); };
            }
        }