示例#1
0
        private void addFeedBtn_Click_1(object sender, EventArgs e)
        {
            try
            {
                Feeds  Fp        = new Feeds();
                string chosenCat = AddFeedCategoryCB.GetItemText(this.AddFeedCategoryCB.SelectedItem);
                string chosenUrl = urlTB.Text;
                string chosenInt = IntervallCb.GetItemText(this.IntervallCb.SelectedItem);

                string lastUpdate      = IntervalClass.now.ToString();
                string updateAday      = IntervalClass.aDay.ToString();
                string updateSevenDays = IntervalClass.sevenDays.ToString();
                string updateAmonth    = IntervalClass.aMonth.ToString();

                if (!Validation.textEmpty(chosenCat))
                {
                    if (!Validation.textEmpty(chosenUrl))
                    {
                        if (!Feeds.FeedExists(chosenUrl))
                        {
                            if (chosenInt == "Every day")
                            {
                                Fp.Podcastlink(chosenUrl, chosenCat, chosenInt, updateAday);
                                Close();
                                MessageBox.Show("Feeden har lagts till!");
                            }
                            else if (chosenInt == "Every week")
                            {
                                Fp.Podcastlink(chosenUrl, chosenCat, chosenInt, updateSevenDays);
                                Close();
                                MessageBox.Show("Feeden har lagts till!");
                            }
                            else if (chosenInt == "Every month")
                            {
                                Fp.Podcastlink(chosenUrl, chosenCat, chosenInt, updateAmonth);
                                Close();
                                MessageBox.Show("Feeden har lagts till!");
                            }
                            else if (Validation.textEmpty(chosenInt))
                            {
                                MessageBox.Show("Du måste välja ett intervall");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Denna feed finns redan!");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Du måste ange en giltig url");
                    }
                }
                else
                {
                    MessageBox.Show("Du måste ange en kategori");
                }
            }
            catch (Exception)
            {
            }
        }