Пример #1
0
        private async void btnAddNewPodcast_Click(object sender, EventArgs e)
        {
            string url      = txtUrl.Text;
            string name     = txtName.Text;
            string category = cbCategory.Text;
            int    interval = Convert.ToInt32(cbInterval.SelectedItem);

            if (Validator.CheckTextField(txtUrl, txtName) && Validator.CheckCombobox(cbCategory, cbInterval) && Validator.CheckIfValidURL(url) && Validator.CheckDuplicatePodcast(url))
            {
                try
                {
                    await podcastController.AddNewPodcast(url, name, category, interval);

                    FillPodcastList();
                    ClearInputs();
                    InitTimers(url, interval);
                    MessageBox.Show("Podcast added!");
                }
                catch (EmptyTextFieldException)
                {
                    throw;
                }
            }
        }