private void feededitbtn_Click(object sender, RoutedEventArgs e) { if (feedlistbox.SelectedItems.Count != 1) { return; } var oldguid = ((FeedConfigItem)feedlistbox.SelectedItem).Guid; var fci = ((FeedConfigItem)feedlistbox.SelectedItem).Copy(); var nf = new NewFeed(fci); var dr = nf.ShowDialog(); if (dr != true || nf.FeedConfig.Url.Trim().Length <= 0) { return; } FeedConfigItems.Remove(((FeedConfigItem)feedlistbox.SelectedItem)); FeedConfigItems.Add(nf.FeedConfig); SaveFeedSettings(); if (windowlist.ContainsKey(oldguid) && windowlist[oldguid] != null) { ((FeedWin)windowlist[oldguid]).Close(); } windowlist.Remove(nf.FeedConfig.Guid); var nfw = new FeedWin(nf.FeedConfig); windowlist.Add(nf.FeedConfig.Guid, nfw); nfw.Show(); feedlistbox.Items.Clear(); foreach (var fcil in FeedConfigItems.Items) { feedlistbox.Items.Add(fcil); } }
private void feededitbtn_Click(object sender, RoutedEventArgs e) { if (feedlistbox.SelectedItems.Count != 1) return; var oldguid = ((FeedConfigItem)feedlistbox.SelectedItem).Guid; var fci = ((FeedConfigItem)feedlistbox.SelectedItem).Copy(); var nf = new NewFeed(fci); var dr = nf.ShowDialog(); if (dr != true || nf.FeedConfig.Url.Trim().Length <= 0) return; FeedConfigItems.Remove(((FeedConfigItem)feedlistbox.SelectedItem)); FeedConfigItems.Add(nf.FeedConfig); SaveFeedSettings(); if (windowlist.ContainsKey(oldguid) && windowlist[oldguid] != null) ((FeedWin)windowlist[oldguid]).Close(); windowlist.Remove(nf.FeedConfig.Guid); var nfw = new FeedWin(nf.FeedConfig); windowlist.Add(nf.FeedConfig.Guid, nfw); nfw.Show(); feedlistbox.Items.Clear(); foreach (var fcil in FeedConfigItems.Items) { feedlistbox.Items.Add(fcil); } }