示例#1
0
        static async Task MainTask()
        {
            AppSettings conf = new AppSettings();

            conf.LoadAppSettings();
            conf.SaveAppSettings();
            Directory.CreateDirectory(conf.PublishFolder);
            Directory.CreateDirectory(conf.Archive);
            HttpClientHandler httpClientHandler = new HttpClientHandler()
            {
                Proxy = WebRequest.GetSystemWebProxy()
            };
            HttpClient      hc      = new HttpClient(httpClientHandler);
            FetchAndPublish fetcher = new FetchAndPublish(conf, hc);

            fetcher.listenForTerseMessages(new TerseMessageDelegate(Console.WriteLine));
            fetcher.listenForChattyMessages(new ChattyMessageDelegate(Console.WriteLine));
            fetcher.listenForEditionStatus(new ShowEditionStatusDelegate(Console.WriteLine));
            fetcher.addLogListener(new LogDelegate(Console.WriteLine));
            await fetcher.republish();

            try
            {
                DateTime bc = await fetcher.fetchAndPublish(DateTime.UtcNow);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
示例#2
0
        static async Task MainTask()
        {
            AppSettings conf = new AppSettings();

            conf.LoadAppSettings();
            conf.SaveAppSettings();
            Directory.CreateDirectory(conf.PublishFolder);
            Directory.CreateDirectory(conf.Archive);
            Directory.CreateDirectory(conf.Logfolder);
            FetchAndPublish fetcher = new FetchAndPublish(conf);

            fetcher.listenForTerseMessages(new TerseMessageDelegate(Console.WriteLine));
            fetcher.listenForChattyMessages(new ChattyMessageDelegate(Console.WriteLine));
            fetcher.listenForEditionStatus(new ShowEditionStatusDelegate(Console.WriteLine));
            await fetcher.republish();

            try
            {
                DateTime bc = await fetcher.fetchAndPublish(DateTime.UtcNow);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
示例#3
0
 public MainForm(AppSettings conf)
 {
     this.conf = conf;
     line1     = new ConcurrentQueue <string>();
     InitializeComponent();
     fetcher = new FetchAndPublish(conf);
     fetcher.listenForTerseMessages(new TerseMessageDelegate(setLine1));
     fetcher.listenForChattyMessages(new ChattyMessageDelegate(setLine1));
     fetcher.listenForEditionStatus(new ShowEditionStatusDelegate(setLine2));
 }
示例#4
0
        public TrayNotify(FetchAndPublish fetcher)
        {
            MyContainer components = new MyContainer();

            notifyIcon = new NotifyIcon(components)
            {
                Icon           = Properties.Resources.main,
                Text           = "BBC Ingest",
                BalloonTipText = "BBC Ingest",
                Visible        = showicon
            };
            fetcher.listenForTerseMessages(new TerseMessageDelegate(terse));
            fetcher.listenForChattyMessages(new ChattyMessageDelegate(chatty));
            fetcher.listenForEditionStatus(new ShowEditionStatusDelegate(chatty));
        }
示例#5
0
        private async void OnLoad(object sender, EventArgs e)
        {
            Version version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version;

            Text = Text + " " + version.ToString();
            Schedule schedule = new Schedule(conf);

            fetcher.listenForTerseMessages(new TerseMessageDelegate(setLine1));
            fetcher.listenForChattyMessages(new ChattyMessageDelegate(setLine1));
            fetcher.listenForEditionStatus(new ShowEditionStatusDelegate(setLine2));
            if (conf.RunInForeground)
            {
                buttonRfTS.Visible        = false;
                buttonRemoveTasks.Visible = false;
                buttonExitOrStart.Text    = "Start";
                buttonExitOrStart.Visible = false;

                await getLatest(schedule);

                await fetcher.republish();

                while (true)
                {
                    DateTime bc = await fetcher.fetchAndPublish(DateTime.UtcNow);

                    // wait until after broadcast date before trying for next edition
                    await fetcher.waitUntil(bc);
                }
            }
            else
            {
                IScheduleInstaller si = getScheduleInstaller(schedule);
                taskInstalled = si.IsInstalled;
                if (taskInstalled)
                {
                    buttonRfTS.Text = "Update Task Scheduler";
                }
                else
                {
                    buttonRfTS.Text = "Install Task";
                }
                buttonExitOrStart.Text = "Exit";
            }
        }