/// <summary> /// Calls the specified delegate recursively for each outline element /// </summary> /// <param name="collection">Collection with outline items</param> /// <param name="callback">Delegate to call for each item</param> private void RecursiveWorker(OpmlOutlineCollection collection, OutlineCallbackDelegate callback) { // for (int i = 0; i < collection.Count; i++) //foreach(OpmlOutlineFavorite o in collection) { OpmlOutlineFavorite o = (OpmlOutlineFavorite)collection[i]; // if (o.Items.Count > 0) { RecursiveWorker(o.Items, callback); } else { try { callback(o); } catch (System.Exception e) { _exceptionTable.Add(o, e); } } } }
internal RecursiveWorkerThread(OpmlOutlineCollection collection, OutlineCallbackDelegate callback) { _collection = collection; _callback = callback; // let's go //System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(Start)); System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(Run)); thread.IsBackground = true; thread.Start(); }
/// <summary> /// Recursive contains over the specified collection to find the outline item. /// </summary> /// <param name="uri">The URI of the outline item to find.</param> /// <param name="collection">RootCollection to search in.</param> /// <returns>True if the collection's hold this instance, otherwise False if not found.</returns> private bool FindOutline(OpmlOutlineFavorite item, OpmlOutlineCollection collection) { if (collection.Contains(item)) { return(true); } // foreach (OpmlOutlineFavorite o in collection) { // recursive call if (FindOutline(item, o.Items)) { return(true); } } return(false); }
/// <summary>Initializes a new instance of OpmlBody</summary> public OpmlBody() { _items = new OpmlOutlineCollection(this); }