/* ----------------------------------------------------------------- */ /// /// Expand /// /// <summary> /// RSS カテゴリの子要素が表示された状態に設定します。 /// </summary> /// /// <param name="src">カテゴリ</param> /// /* ----------------------------------------------------------------- */ public static void Expand(this IRssEntry src) { var current = src; while (current is RssCategory category) { category.Expanded = true; current = category.Parent; } }
/* ----------------------------------------------------------------- */ /// /// Read /// /// <summary> /// 指定されたオブジェクトの全ての記事を既読設定にします。 /// </summary> /// /// <param name="src">RSS エントリまたはカテゴリ</param> /// /* ----------------------------------------------------------------- */ public static void Read(this IRssEntry src) { if (src is RssCategory rc) { ReadCore(rc); } else if (src is RssEntry re) { ReadCore(re); } }
/* ----------------------------------------------------------------- */ /// /// Select /// /// <summary> /// RSS フィードを選択します。 /// </summary> /// /// <param name="src">選択項目</param> /// /* ----------------------------------------------------------------- */ public void Select(IRssEntry src) { Data.Current.Value = src; if (src is RssEntry current && current != Data.LastEntry.Value) { _core.Select(Data.LastEntry.Value, current); current.Selected = true; Data.LastEntry.Value = current; Select(current.Items.FirstOrDefault()); Settings.Shared.StartUri = current.Uri; } }
/* ----------------------------------------------------------------- */ /// /// Convert /// /// <summary> /// XElement オブジェクトを解析し、IRssEntry オブジェクトに /// 変換します。 /// </summary> /// /* ----------------------------------------------------------------- */ private IEnumerable <IRssEntry> Convert(XElement src, IRssEntry parent, IDictionary <Uri, RssFeed> filter) => src.GetElements("outline") .Select(e => IsEntry(e) ? ToEntry(e, parent) : ToCategory(e, parent, filter)) .OfType <IRssEntry>() .Where(e => e is RssCategory rc && rc.Children.Count > 0 ||
/* ----------------------------------------------------------------- */ /// /// Move /// /// <summary> /// 項目を移動します。 /// </summary> /// /// <param name="src">移動元の項目</param> /// <param name="dest">移動先のカテゴリ</param> /// <param name="index">カテゴリ中の挿入場所</param> /// /* ----------------------------------------------------------------- */ public void Move(IRssEntry src, IRssEntry dest, int index) => _core.Move(src, dest, index);