コード例 #1
0
        public void GetNewEpisode()
        {
            timerCounter++;
            string updatedPodcasts = "";

            updatedPodcasts = PodcastHandler.updateEpisodes(1);
            if (timerCounter == 5)
            {
                updatedPodcasts += updatedPodcasts + PodcastHandler.updateEpisodes(5);
            }
            else if (timerCounter == 10)
            {
                updatedPodcasts += updatedPodcasts + PodcastHandler.updateEpisodes(5);
                updatedPodcasts += PodcastHandler.updateEpisodes(10);
                timerCounter     = 0;
            }
            if (updatedPodcasts.Length > 0)
            {
                MessageBox.Show(updatedPodcasts);
                podcastListview = PodcastHandler.updatePodcastListview(podcastListview);
                if (podcastListview.Items.Count > 0)
                {
                    podcastListview.Items[0].Selected = true;
                }
            }
        }
コード例 #2
0
 private void ListaKategorier_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (categoryListview.SelectedItems.Count > 0)
     {
         if (categoryListview.SelectedItems[0].Text == "Visa alla podcasts" && podcastListview.Items.Count > 0)
         {
             podcastListview.BeginUpdate();
             podcastListview = PodcastHandler.updatePodcastListview(podcastListview);
             podcastListview.EndUpdate();
             podcastListview.Items[0].Selected = true;
         }
         else if (podcastListview.Items.Count > 0 && PodcastHandler.lookupTrue(categoryListview.SelectedItems[0].Text, "podcast"))
         {
             podcastListview.BeginUpdate();
             podcastListview = PodcastHandler.updatePodcastListview(podcastListview, categoryListview.SelectedItems[0].Text);
             podcastListview.EndUpdate();
             podcastListview.Items[0].Selected = true;
         }
         else if (podcastListview.Items.Count == 0)
         {
             MessageBox.Show("Du har inte lagt till några podcasts än");
         }
         else
         {
             MessageBox.Show("Inga podcasts tillhör kategorin");
         }
     }
 }
コード例 #3
0
 private void ButtonURL_Click(object sender, EventArgs e)
 {
     try
     {
         if (Validering.CheckIfURLIsValid(textBoxURL.Text).Length > 0)
         {
             if (Validering.CheckIfComboboxIsEmpty(categoryCombobox))
             {
                 PodcastHandler.addPodcast(textBoxURL.Text, categoryCombobox.Text, Int32.Parse(comboBoxUpdateInterval.Text.Substring(0, 2).Trim()));
                 podcastListview = PodcastHandler.updatePodcastListview(podcastListview);
             }
         }
     }
     catch (WebException) { }
 }
コード例 #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (podcastListview.SelectedItems.Count > 0)
     {
         if (Validering.CheckIfComboboxIsEmpty(comboBoxUpdateInterval) || Validering.CheckIfComboboxIsEmpty(categoryCombobox))
         {
             PodcastHandler.updatePodcast(categoryCombobox.Text, Int32.Parse(comboBoxUpdateInterval.Text.Substring(0, 2).Trim()), podcastListview.SelectedItems[0].Text);
             podcastListview = PodcastHandler.updatePodcastListview(podcastListview);
         }
     }
     else
     {
         MessageBox.Show("Vänligen välj en podcast att ändra");
     }
 }
コード例 #5
0
        public Form()
        {
            InitializeComponent();
            timerCounter = 0;
            StartTimer();
            MessageBox.Show(greeting.Greet());

            ctrl             = new MessageController(this);
            podcastListview  = PodcastHandler.updatePodcastListview(podcastListview);
            categoryListview = PodcastHandler.updateCategoryListview(categoryListview);
            categoryCombobox = PodcastHandler.updateComboBox(categoryCombobox);
            if (categoryCombobox.Items.Count > 0)
            {
                categoryCombobox.SelectedIndex = 0;
            }
            Application.ApplicationExit += new EventHandler(this.OnApplicationExit);
        }
コード例 #6
0
        private void ButtonTaBortPodcast_Click(object sender, EventArgs e)
        {
            if (podcastListview.SelectedItems.Count > 0)
            {
                PodcastHandler.removePodcast(podcastListview.SelectedIndices[0]);

                if (PodcastHandler.podcastListCount() > 0)
                {
                    podcastListview = PodcastHandler.updatePodcastListview(podcastListview);
                    podcastListview.Items[0].Selected = true;
                }
                else
                {
                    podcastListview.Items.Clear();
                    episodeListview.Items.Clear();
                    episodeDetailsTextBox.Clear();
                }
            }
        }