/// <summary> /// Removes the current feed (which is an error state) from the feeds list. /// </summary> public void RemoveBadFeed() { var index = Feeds.IndexOf(CurrentFeed); Feeds.Remove(CurrentFeed); CurrentFeed = Feeds[Feeds.Count > index ? index : index - 1]; var withoutAwait = SaveFeedsAsync(); BadFeedRemoved?.Invoke(this, EventArgs.Empty); }
public void ExecuteRemoveFeed(object parameter) { int index = Feeds.IndexOf(SelectedFeed); Feeds.Remove(SelectedFeed); //SelectedFeed = index > 0? Feeds[index - 1] : Feeds[0]; SelectedFeed = null; onPropertyChanged("CountFeeds"); }
public void ExecuteDeleteFeedCommand(object parameter) { Feed feed = parameter as Feed; int index = Feeds.IndexOf(feed); SelectedFilterIndex = -1; foreach (var filter in Filters.Where(x => x.Feed == feed)) { filter.Feed = null; filter.FeedIndex = -1; } Feeds.RemoveAt(index); }
public void ExecuteSaveBackup(object parameter) { if (!Directory.Exists(Path.GetDirectoryName(FeedsPath))) { Directory.CreateDirectory(Path.GetDirectoryName(FeedsPath)); } XmlWriterSettings xws = new XmlWriterSettings() { Indent = true }; DataContractSerializer dcs; // Feeds dcs = new DataContractSerializer(Feeds.GetType()); using (XmlWriter xw = XmlWriter.Create(FeedsPath, xws)) { dcs.WriteObject(xw, Feeds); } // Saves the index of SearchInFeed so that the feed can be loaded on Restore foreach (Filter f in Filters) { if (f.HasFeed) { f.SearchInFeedIndex = Feeds.IndexOf(f.SearchInFeed); } else { f.SearchInFeedIndex = -1; } } // Filters dcs = new DataContractSerializer(Filters.GetType()); using (XmlWriter xw = XmlWriter.Create(FiltersPath, xws)) { dcs.WriteObject(xw, Filters); } // Downloads dcs = new DataContractSerializer(ManuallyDownloadedTorrents.GetType()); using (XmlWriter xw = XmlWriter.Create(ManuallyDownloadedTorrentsPath, xws)) { dcs.WriteObject(xw, ManuallyDownloadedTorrents); } }