예제 #1
0
파일: Form1.cs 프로젝트: pandrum/Podify
        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;
                }
            }
        }