Example #1
0
        private async void NewPodcastBtn_Click(object sender, EventArgs e)
        {
            try
            {
                InsertCommandConsole("Adding item...");
                validator.ComboBoxHasSelected(comboBoxCategory);
                validator.ComboBoxHasSelected(comboBoxInterval);
                validator.TextBoxisNullorEmpty(textBoxNamn);
                validator.TextBoxisNullorEmpty(textBoxURL);
                validator.URLIsValid(textBoxURL.Text);

                int    interval = Int32.Parse(comboBoxInterval.SelectedItem.ToString());
                string category = comboBoxCategory.SelectedItem.ToString();
                string name     = textBoxNamn.Text;
                string URL      = textBoxURL.Text;

                await podcastController.CreatePodcastObject(URL, name, interval, category);

                podcastController.SavePodcastData();
                ClearTimer();
                CreateTimerData();
                InsertPodcasts();

                InsertCommandConsole("Item added.");
            }
            catch (InvalidTextException textError)
            {
                CreateInformationMessage(textError.ErrorMessage());
            }
            catch (InvalidURLException URLError)
            {
                CreateInformationMessage(URLError.ErrorMessage());
            }
            catch (InvalidComboBoxException comboBoxError)
            {
                CreateInformationMessage(comboBoxError.ErrorMessage());
            }
        }