Esempio n. 1
0
        /// <summary>
        /// Commits the content and exits out of edit mode
        /// </summary>
        private void Save()
        {
            // Store the result of a commit call
            var result = default(bool);

            if (CurrentPassword.UnSecure() != UserPassword.UnSecure())
            {
                ErrorMessage = "Hasło nie poprawne";
                return;
            }

            if (NewPassword.UnSecure() != ConfirmPassword.UnSecure())
            {
                ErrorMessage = "Hasła do siebie nie pasują";
                return;
            }

            RunCommandAsync(() => Updating, async() =>
            {
                // While updating, come out of edit mode
                Editing = false;

                // Get new value to update
                CommitAction = IoC.Settings.UpdateEmployeeDetailAsync;

                // Try and do the work
                result = CommitAction == null || await CommitAction();
            }).ContinueWith(t =>
            {
                // If we succeeded
                // Nothing to do
                // If we fail
                if (!result)
                {
                    // Go back into edit mode
                    Editing = true;
                }
            });
        }