Exemple #1
0
        private async Task <bool> GetData(DateTime date)
        {
            if (EpgData1.Source == "web")
            {
                return(false);
            }
            string url = GetURL(date);

            string page = await ADownloader.GetString(url, LTC.Properties.Settings.Default.HTTPClientTimeOut);

            if (page == null)
            {
                TaskFormMsg(
                    string.Format("Failed to download programs for {0}",
                                  task_date.ToString("yyyy.MM.dd"))
                    );
                return(false);
            }

            //File.WriteAllText(GetBasePath()+"\\e1.html", page);

            bool ret1 = await Task <bool> .Run(() =>
            {
                return(EpgData1.ReadProgramms(page, task_date));
            });

            if (!ret1)
            {
                TaskFormMsg(
                    string.Format("Failed to read programs for {0}",
                                  task_date.ToString("yyyy.MM.dd"))
                    );
                return(false);
            }

            return(true);
        }
Exemple #2
0
        public async void GetChannelListFromURL(string url, bool useapi)
        {
            if (string.IsNullOrEmpty(url))
            {
                MessageBox.Show("Wrong URL");
                return;
            }

            string s = await ADownloader.GetString(url, LTC.Properties.Settings.Default.HTTPClientTimeOut);

            if (string.IsNullOrEmpty(s))
            {
                MessageBox.Show("Download failed");
                return;
            }

            bool rt = false;

            if (useapi)
            {
                rt = EpgData1.ReadChannels(s);
            }
            else
            {
                rt = EpgData1.ReadChannelsA(s);
            }

            if (!rt)
            {
                MessageBox.Show("Failed to read channel list");
                return;
            }

            bsChannels.DataSource = EpgData1.Channels;
            MessageBox.Show("Done!");
        }