Exemplo n.º 1
0
        private async Task Save(AssetSelectionRow changedAsset)
        {
            try
            {
                if (!userAssets.Contains(changedAsset.UserAsset))
                {
                    userAssets.Add(changedAsset.UserAsset);
                }

                appData.UserAssets = userAssets.ToArray();

                bool ignoreBalanceCheck = false;

                var request = userAssets.Select(a => new Agate.Contracts.Models.User.UpdateUserAssetRequest {
                    AssetId = a.AssetId, Favorited = a.Favorited, IgnoreBalanceCheck = ignoreBalanceCheck
                }).ToArray();
                await userAssetsService.Save(secureStorage.GetUserId().Value, request);

                await userData.SaveUserAssets(appData.UserAssets);
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex, new Dictionary <string, string>
                {
                    { "page", "choose asset page" },
                    { "operation", $"saving changes" }
                });
                await View.DisplayAlert("Error", "An error occurred while processing your request" + ex, "Ok");
            }
        }
Exemplo n.º 2
0
 public async void SelectionChanged(AssetSelectionRow changedRow)
 {
     await Save(changedRow);
 }