Exemple #1
0
        public override async Task InitializeAsync(object parameter)
        {
            try
            {
                Token      = parameter as Token;
                Title      = $"Token: {Token.tokenInfo.name}";
                HasAlert   = !string.IsNullOrEmpty(Token.tokenInfo.alert);
                TokenPrice = new TokenInfoPrice();

                var infoWithPrice = await _networkService.GetAsync <TokenInfoWithPrice>(ApiHelpers.GetEthplorerUri(App.Settings.Endpoint, $"getTokenInfo/{Token.tokenInfo.address}"));

                TokenPriceDataEnabled = infoWithPrice != null;
                TokenPrice            = infoWithPrice.price;
            }
            catch (NullReferenceException e) when(Token is null)
            {
                Log.Warning(e, "Parameter is null or not the type of Token. (Token variable is null)");
            }
            catch (NullReferenceException e) when(App.Settings is null)
            {
                Log.Warning(e, "App.Settings was null.");
            }
            catch (NullReferenceException e) when(Token.tokenInfo is null)
            {
                Log.Warning(e, "Token.tokenInfo was null.");
            }
        }