Ejemplo n.º 1
0
        private async void buttonExitOrStart_Click(object sender, EventArgs e)
        {
            if (conf.RunInForeground)
            {
                if (taskInstalled)
                {
                    deleteTask(new ScheduleInstaller(conf));
                }
                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
            {
                if (taskInstalled)
                {
                    MessageBox.Show("Files will be fetched in the background", "BBC Ingest");
                    Application.Exit();
                }
                else
                {
                    MessageBox.Show("Install task to fetch files in the background", "BBC Ingest");
                }
            }
        }
Ejemplo n.º 2
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";
            }
        }