コード例 #1
0
        /// <summary>
        /// Method for all points one year
        /// </summary>
        /// <param name="namechart">Specific name chart</param>
        /// <returns>Result is list points</returns>
        public static async Task <List <DataPointChart> > GetPointsData(string namechart)
        {
            Tuple <int, ArgChart.Date> timespan       = new Tuple <int, ArgChart.Date>(1, ArgChart.Date.year);
            Tuple <int, ArgChart.Date> rollingAverage = new Tuple <int, ArgChart.Date>(8, ArgChart.Date.hours);
            Uri newUri = UriEngine.GetUriforChart(BaseApi.Type.charts, namechart, timespan, rollingAverage, ArgChart.Formater.json);

            HttpClient client = new HttpClient();

            Debug.WriteLine(newUri.AbsoluteUri);
            string jsonData = string.Empty;

            try
            {
                jsonData = await client.GetStringAsync(newUri);
            }
            catch
            {
                //throw new Exception("Error in client.GetStringAsynch, maybe bad url address or params!");
                //Logging.Debug("Start app.", Logging.Level.DATABASE); // TODO vyresit kruhovou referenci na Logging

                Debug.WriteLine("Error in client.GetStringAsynch, maybe bad url address or params!");
                return(new List <DataPointChart>()); // empty data
            }

            List <DataPointChart> selectedList = new List <DataPointChart>();

            selectedList = DateSelector(RatersChart.GetRates(jsonData));
            return(selectedList);
            //return RatersChart.GetRates(jsonData);
        }
コード例 #2
0
        public static async Task <List <DataTricker> > GetMarketData()
        {
            Uri newUri = UriEngine.GetUriforChart(BaseApi.Type.ticker);

            HttpClient client = new HttpClient();

            Debug.WriteLine(newUri.AbsoluteUri);
            string jsonData = string.Empty;

            try
            {
                jsonData = await client.GetStringAsync(newUri);
            }
            catch
            {
                //throw new Exception("Error in client.GetStringAsynch, maybe bad url address or params!");
                //Logging.Debug("Start app.", Logging.Level.DATABASE); // TODO vyresit kruhovou referenci na Logging

                Debug.WriteLine("Error in client.GetStringAsynch, maybe bad url address or params!");
                return(new List <DataTricker>()); // empty data
            }

            return(RatesTicker.GetRates(jsonData));
        }