public void ChangeNotification() { collection.Clear(); item.Index = 0; collection.Add(new System.Uri("file:///blah.jpg")); Assert.IsTrue(item.IsValid); Assert.IsTrue(changed); changed = false; collection.Add(new System.Uri("file:///test.png")); Assert.IsFalse(changed); collection.MarkChanged(0); Assert.IsTrue(changed); changed = false; item.MoveNext(); Assert.IsTrue(changed); Assert.AreEqual(item.Index, 1); changed = false; collection.Add(new System.Uri("file:///bill.png")); Assert.IsFalse(changed); }
private void InfoLoaded(Gnome.Vfs.Result result, Gnome.Vfs.FileInfo [] info, uint entries_read) { if (result != Gnome.Vfs.Result.Ok && result != Gnome.Vfs.Result.ErrorEof) { return; } ArrayList items = new ArrayList(); for (int i = 0; i < entries_read; i++) { Gnome.Vfs.Uri vfs = new Gnome.Vfs.Uri(uri.ToString()); vfs = vfs.AppendFileName(info [i].Name); Uri file = new Uri(vfs.ToString()); System.Console.WriteLine("tesing uri = {0}", file.ToString()); if (FSpot.ImageFile.HasLoader(file)) { items.Add(new FileBrowsableItem(file)); } } Gtk.Application.Invoke(items, System.EventArgs.Empty, delegate(object sender, EventArgs args) { collection.Add(items.ToArray(typeof(FileBrowsableItem)) as FileBrowsableItem []); }); }
void InfoLoaded(GLib.Object o, AsyncResult res) { var items = new List <FilePhoto> (); foreach (FileInfo info in file.EnumerateChildrenFinish(res)) { var i = new Uri(file.GetChild(info.Name).Uri); Log.Debug($"testing uri = {i}"); if (App.Instance.Container.Resolve <IImageFileFactory> ().HasLoader(i)) { items.Add(new FilePhoto(i)); } } ThreadAssist.ProxyToMain(() => collection.Add(items.ToArray())); }
void InfoLoaded(GLib.Object o, GLib.AsyncResult res) { List <FilePhoto> items = new List <FilePhoto> (); foreach (GLib.FileInfo info in file.EnumerateChildrenFinish(res)) { SafeUri i = new SafeUri(file.GetChild(info.Name).Uri); Hyena.Log.DebugFormat("testing uri = {0}", i); if (ImageFile.HasLoader(i)) { items.Add(new FilePhoto(i)); } } ThreadAssist.ProxyToMain(() => collection.Add(items.ToArray())); }
public RssLoader(UriCollection collection, Uri uri) { var doc = new XmlDocument(); doc.Load(uri.ToString()); var ns = new XmlNamespaceManager(doc.NameTable); ns.AddNamespace("media", "http://search.yahoo.com/mrss/"); ns.AddNamespace("pheed", "http://www.pheed.com/pheed/"); ns.AddNamespace("apple", "http://www.apple.com/ilife/wallpapers"); var items = new List <FilePhoto> (); var list = doc.SelectNodes("/rss/channel/item/media:content", ns); foreach (XmlNode item in list) { var image_uri = new Uri(item.Attributes["url"].Value); Log.Debug($"flickr uri = {image_uri}"); items.Add(new FilePhoto(image_uri)); } if (list.Count < 1) { list = doc.SelectNodes("/rss/channel/item/pheed:imgsrc", ns); foreach (XmlNode item in list) { var image_uri = new Uri(item.InnerText.Trim()); Log.Debug($"pheed uri = {uri}"); items.Add(new FilePhoto(image_uri)); } } if (list.Count < 1) { list = doc.SelectNodes("/rss/channel/item/apple:image", ns); foreach (XmlNode item in list) { var image_uri = new Uri(item.InnerText.Trim()); Log.Debug($"apple uri = {uri}"); items.Add(new FilePhoto(image_uri)); } } collection.Add(items.ToArray()); }
public RssLoader(UriCollection collection, System.Uri uri) { XmlDocument doc = new XmlDocument(); doc.Load(uri.ToString()); XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable); ns.AddNamespace("media", "http://search.yahoo.com/mrss/"); ns.AddNamespace("pheed", "http://www.pheed.com/pheed/"); ns.AddNamespace("apple", "http://www.apple.com/ilife/wallpapers"); ArrayList items = new ArrayList(); XmlNodeList list = doc.SelectNodes("/rss/channel/item/media:content", ns); foreach (XmlNode item in list) { Uri image_uri = new Uri(item.Attributes ["url"].Value); System.Console.WriteLine("flickr uri = {0}", image_uri.ToString()); items.Add(new FileBrowsableItem(image_uri)); } if (list.Count < 1) { list = doc.SelectNodes("/rss/channel/item/pheed:imgsrc", ns); foreach (XmlNode item in list) { Uri image_uri = new Uri(item.InnerText.Trim()); System.Console.WriteLine("pheed uri = {0}", uri); items.Add(new FileBrowsableItem(image_uri)); } } if (list.Count < 1) { list = doc.SelectNodes("/rss/channel/item/apple:image", ns); foreach (XmlNode item in list) { Uri image_uri = new Uri(item.InnerText.Trim()); System.Console.WriteLine("apple uri = {0}", uri); items.Add(new FileBrowsableItem(image_uri)); } } collection.Add(items.ToArray(typeof(FileBrowsableItem)) as FileBrowsableItem []); }
public RssLoader (UriCollection collection, System.Uri uri) { XmlDocument doc = new XmlDocument (); doc.Load (uri.ToString ()); XmlNamespaceManager ns = new XmlNamespaceManager (doc.NameTable); ns.AddNamespace ("media", "http://search.yahoo.com/mrss/"); ns.AddNamespace ("pheed", "http://www.pheed.com/pheed/"); ns.AddNamespace ("apple", "http://www.apple.com/ilife/wallpapers"); ArrayList items = new ArrayList (); XmlNodeList list = doc.SelectNodes ("/rss/channel/item/media:content", ns); foreach (XmlNode item in list) { Uri image_uri = new Uri (item.Attributes ["url"].Value); System.Console.WriteLine ("flickr uri = {0}", image_uri.ToString ()); items.Add (new FileBrowsableItem (image_uri)); } if (list.Count < 1) { list = doc.SelectNodes ("/rss/channel/item/pheed:imgsrc", ns); foreach (XmlNode item in list) { Uri image_uri = new Uri (item.InnerText.Trim ()); System.Console.WriteLine ("pheed uri = {0}", uri); items.Add (new FileBrowsableItem (image_uri)); } } if (list.Count < 1) { list = doc.SelectNodes ("/rss/channel/item/apple:image", ns); foreach (XmlNode item in list) { Uri image_uri = new Uri (item.InnerText.Trim ()); System.Console.WriteLine ("apple uri = {0}", uri); items.Add (new FileBrowsableItem (image_uri)); } } collection.Add (items.ToArray (typeof (FileBrowsableItem)) as FileBrowsableItem []); }
public RssLoader(UriCollection collection, SafeUri uri) { XmlDocument doc = new XmlDocument (); doc.Load (uri.ToString ()); XmlNamespaceManager ns = new XmlNamespaceManager (doc.NameTable); ns.AddNamespace ("media", "http://search.yahoo.com/mrss/"); ns.AddNamespace ("pheed", "http://www.pheed.com/pheed/"); ns.AddNamespace ("apple", "http://www.apple.com/ilife/wallpapers"); List<FilePhoto> items = new List<FilePhoto> (); XmlNodeList list = doc.SelectNodes ("/rss/channel/item/media:content", ns); foreach (XmlNode item in list) { SafeUri image_uri = new SafeUri (item.Attributes ["url"].Value); Hyena.Log.DebugFormat ("flickr uri = {0}", image_uri.ToString ()); items.Add (new FilePhoto (image_uri)); } if (list.Count < 1) { list = doc.SelectNodes ("/rss/channel/item/pheed:imgsrc", ns); foreach (XmlNode item in list) { SafeUri image_uri = new SafeUri (item.InnerText.Trim ()); Hyena.Log.DebugFormat ("pheed uri = {0}", uri); items.Add (new FilePhoto (image_uri)); } } if (list.Count < 1) { list = doc.SelectNodes ("/rss/channel/item/apple:image", ns); foreach (XmlNode item in list) { SafeUri image_uri = new SafeUri (item.InnerText.Trim ()); Hyena.Log.DebugFormat ("apple uri = {0}", uri); items.Add (new FilePhoto (image_uri)); } } collection.Add (items.ToArray ()); }