コード例 #1
0
        public FullWrapper GetFullWrapper()
        {
            if (FullWrapper != null)
            {
                return(FullWrapper);
            }

            if (Values.ContainsKey(typeof(Full)) && Values[typeof(Full)] != null)
            {
                FullWrapper = new FullWrapper((Full)Values[typeof(Full)]);
                FullWrapper.AddPartnerWrapper();
                return(FullWrapper);
            }
            else
            {
            }

            return(null);
        }
コード例 #2
0
        public async Task <T> Update <T>(string apiKey) where T : BaseQueslar, new()
        {
            Valid = false;
            var         client = new HttpClient();
            BaseQueslar info   = new T();

            apiKey = apiKey.Trim();
            try {
                info = await client.GetFromJsonAsync <T>("https://queslar.com/api/" + info.ApiPath + apiKey);

                Values[typeof(T)] = info;
                if (info.GetType() == typeof(Full))
                {
                    FullWrapper = new FullWrapper((Full)info);
                    FullWrapper.AddPartnerWrapper(Tax);
                }
            } catch (Exception) {
                return(null);
            }

            Valid  = true;
            ApiKey = apiKey;
            return((T)info);
        }