Beispiel #1
0
        private void btnAddPod_Click(object sender, EventArgs e)
        {
            var podUrl        = txtAddPod.Text;
            var podName       = txtEnterName.Text;
            var getCategory   = (string)cbNewCategories.SelectedItem;
            int intervalValue = (int)numericUpdateFrequency.Value;

            try
            {
                Validation.checkIfEmpty(podUrl);
                Validation.checkIfNull(podUrl);
                Validation.checkIfEmpty(podName);
                Validation.checkIfEmpty(intervalValue);
                Validation.checkIfNull(getCategory);
                {
                    podcastList.AddPod(podUrl, podName, intervalMS, getCategory); //Adderar podcasten till ett objekt sedan till en lista

                    foreach (var item in cbNewCategories.Items)
                    {
                        categoryList.addCategoryToList(item.ToString());
                    }

                    XmlCommunication.SaveListData(podcastList.GetPodcastList(), "pods.xml");
                    fillCbCategories(); //Ändra staten av comboboxen kategori
                    MessageBox.Show("Podden har nu lagts till! :)");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        private void btnAddPod_Click(object sender, EventArgs e)
        {
            podcast.Name     = txtNewName.Text;
            podcast.Url      = txtNewUrl.Text;
            podcast.Category = (string)cbCategories.SelectedItem;
            podcast.Interval = intervalMS;
            try
            {
                Validation.checkIfEmpty(podcast.Interval);
                Validation.checkIfEmpty(podcast.Name);
                Validation.checkIfNull(podcast.Category);
                Validation.checkIfEmpty(podcast.Url);

                XmlCommunication.SaveListData(podcastList.GetPodcastList(), "Podcasts.xml");
                MessageBox.Show("Ändringen är nu klar! :)");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }