コード例 #1
0
        private async void GetAllSkyJSONData()
        {
            Debug.WriteLine("GetAllSkyJSONData enter");
            if (IsBusy)
            {
                Debug.WriteLine("GetAllSkyJSONData: GetJSON already busy, return");
                return;
            }
            IsBusy = true;

            // Check network status
            if (NetworkServices.IsConnectedToInternet())
            {
                Tuple <AllSkyDataClass, DownloadResult> allskyret;
                allskyret = await Task.Run(() => NetworkServices.GetJSON <AllSkyDataClass>(Settings.AllskyStatusURL));

                //4. Data setting
                DateTime ASDT = DateTimeUtils.UnixTimeStampToDateTime(allskyret.Item1.timestamp);
                AllSkyDate = DateTimeUtils.ConvertToLocal(ASDT).ToString("HH:mm:ss");
            }
            else
            {
                await ParentPage.DisplayAlert("Get allsky data", "No network is available.", "Ok");
            }
            IsBusy = false;
        }