Esempio n. 1
0
        private void ChangeBtn_Click(object sender, EventArgs e)
        {
            string newCat = changeCatCombo.GetItemText(this.changeCatCombo.SelectedItem);
            string feed   = PickFeedCombo.GetItemText(this.PickFeedCombo.SelectedItem);
            string newInt = intervalCombo.GetItemText(this.intervalCombo.SelectedItem);

            if (Validation.textEmpty(feed))
            {
                MessageBox.Show("Du måste välja en feed att ändra!");
            }
            else
            {
                if (Validation.textEmpty(newCat))
                {
                    MessageBox.Show("Du måste välja en kategori!");
                }
                else
                {
                    if (Validation.textEmpty(newInt))
                    {
                        MessageBox.Show("Du måste välja en intervall");
                    }
                    else
                    {
                        Feeds.UpdateXml(feed, newCat, newInt);
                        MessageBox.Show("Feeden: " + feed + " har ändrats!");
                        Close();
                    }
                }
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string     category    = changeCombo.GetItemText(this.changeCombo.SelectedItem);
            string     newCategory = ChangeToField.Text;
            Validation v           = new Validation();

            if (Validation.textEmpty(category))
            {
                MessageBox.Show("Välj en kategori att ändra!");
            }
            else
            {
                if (v.IsNewCat(newCategory))
                {
                    Categories.RemoveCategory(category);
                    Categories.AddCategory(newCategory);
                    MessageBox.Show("Kategorin: " + category + " har ändrats till: " + newCategory);
                    Close();
                }
                else
                {
                    MessageBox.Show("Ändringen du angett är inte giltig!");
                }
            }
        }
Esempio n. 3
0
        private void RemoveBtn_Click(object sender, EventArgs e)
        {
            String feed = removeCombo.GetItemText(this.removeCombo.SelectedItem);

            if (Validation.textEmpty(feed))
            {
                MessageBox.Show("Du måst välja en feed att ta bort!");
            }
            else
            {
                Feeds.RemoveFromXml(feed);
                RemoveMp3 remove = new RemoveMp3();
                remove.removeMp3(feed);
                MessageBox.Show(feed + " har tagits bort!");
                Close();
            }
        }
Esempio n. 4
0
        private void OKbtn_Click(object sender, EventArgs e)
        {
            Validation v        = new Validation();
            string     category = textBox1.Text;

            if (Validation.textEmpty(category))
            {
                MessageBox.Show("Ange en kategori att lägga till!");
            }
            else
            {
                if (v.IsNewCat(category))
                {
                    v.IsNewCat(category);
                    Categories.AddCategory(category);
                    MessageBox.Show("Kategorin: " + category + " har lagts till!");
                    Close();
                }
                else
                {
                    MessageBox.Show("Denna kategori finns redan!");
                }
            }
        }
Esempio n. 5
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)
            {
            }
        }