public void SparaPodcast(string pTitel) { foreach (var pod in PodcastLista.hamtaLista().Where(p => p.PodcastTitel.Equals(pTitel))) { tbUrl.Text = pod.Url; cbUpdFreq.SelectedIndex = cbUpdFreq.Items.IndexOf(pod.UppdateringsFrekvens + " minuter"); cbKategori.SelectedIndex = cbKategori.Items.IndexOf(pod.Kategori); } }
public static void SparaListaPodcast() { if (File.Exists("podcasts.txt")) { File.Delete("podcasts.txt"); } using (Stream stream = File.OpenWrite(Environment.CurrentDirectory + "\\podcasts.txt")) { XmlSerializer xmlSer = new XmlSerializer(typeof(List <Podcast>)); xmlSer.Serialize(stream, PodcastLista.hamtaLista()); stream.Close(); } }
public void UpdatePodcastListviewKategori(string kategori) { List <Podcast> lista = PodcastLista.hamtaLista(); lvPodcasts.Items.Clear(); foreach (var pod in lista.Where(p => p.Kategori == kategori)) { var list = new ListViewItem(new[] { pod.PodcastTitel, pod.Kategori, pod.AntalAvsnitt.ToString(), pod.UppdateringsFrekvens.ToString() + " minuter" }); lvPodcasts.Items.Add(list); } }