コード例 #1
0
        private async void OnRemoveUserExecute(int?id)
        {
            try
            {
                if (!id.HasValue)
                {
                    return;
                }
                var result = await _dialogService.AskQuestionAsync("¿Estas seguro de querer eliminar este usuario?", "Elimiar Usuario");

                if (result == MessageDialogResult.Negative)
                {
                    return;
                }

                var httpResponse = await ShowProgressAsync(async() => await _userRepository.DeleteUserAsync(id.Value));

                if (httpResponse.IsSuccess)
                {
                    var user = Users.Single(x => x.Id == httpResponse.Value);
                    Users.Remove(user);
                }
                else
                {
                    await _dialogService.ShowMessageAsync(httpResponse.Message, httpResponse.Title);
                }
            }
            catch (Exception ex)
            {
                _logService.Write(ex);
                await _dialogService.ShowMessageAsync(ex.Message);
            }
        }
コード例 #2
0
        private async void OnRemoveCategoryExecute(int?id)
        {
            try
            {
                if (!id.HasValue)
                {
                    return;
                }
                var result = await _dialogService.AskQuestionAsync("¿Estas seguro de querer eliminar esta categoria?", "Elimiar Categoria");

                if (result == MessageDialogResult.Negative)
                {
                    return;
                }

                var httpResponse = await ShowProgressAsync(async() => await _categoryRepository.DeleteCategoryAsync(id.Value));

                if (httpResponse.IsSuccess)
                {
                    var category = ProductCategories.Single(x => x.Id == httpResponse.Value);
                    ProductCategories.Remove(category);
                }
                else
                {
                    await _dialogService.ShowMessageAsync(httpResponse.Message, httpResponse.Title);
                }
            }
            catch (Exception ex)
            {
                _logService.Write(ex);
                await _dialogService.ShowMessageAsync(ex.Message);
            }
        }
コード例 #3
0
        private async void Close()
        {
            var result = await _dialogService.AskQuestionAsync(_languageService.GetValue("ExitApplication"),
                                                               _languageService.GetValue("AreYouSureYouWantToExitTheApplication"));

            if (result == MessageDialogResult.Affirmative)
            {
                ClosingRequest?.Invoke(this, EventArgs.Empty);
            }
        }
コード例 #4
0
        private async void DeleteSelectedMatch(object obj)
        {
            var result = await dialogService.AskQuestionAsync("Delete Match",
                                                              "Are you sure you want to delete this Match record?");

            if (result == MessageDialogResult.Affirmative)
            {
                Matches.Remove(selectedMatch);
                SelectedMatch = null;
            }
        }