public void TestEmptyCollection() { Assert.ExpectAsserts(1); GalleryPluginOptions options = new GalleryPluginOptions("thumbsListID", "thumbsList"); options.photoService = new MockFlickrService(null); TestEngine.WaitForAsyncCompletion(); jQuery.FromElement(Document.Body).Plugin<GalleryObject>().Gallery(options); Assert.AreEqual(_thumbsList.GetHtml().Trim().Length, 0, "Expected html to be empty for null photos array."); TestEngine.ResumeOnAsyncCompleted(); }
public static jQueryObject Gallery(GalleryPluginOptions customOptions) { GalleryPluginOptions defaultOptions = new GalleryPluginOptions("count", 10, "photoService", new FlickrService()); GalleryPluginOptions options = (GalleryPluginOptions)jQuery.Extend(new Dictionary <string, object>(), defaultOptions, customOptions); return(jQuery.Current.Each(delegate(int i, Element element) { jQueryObject thumbnailList = jQuery.Select("#" + options.thumbsListID); jQueryObject photoPanel = jQuery.Select("#" + options.photoPanelID); options.photoService.SearchPhotos(options.tags, options.count, delegate(List <PhotoResult> photos) { if ((photos == null) || (photos.Count == 0)) { return; } thumbnailList.Empty(); jQuery.Select("#" + options.thumbnailTemplateID).Plugin <jQueryTemplateObject>(). RenderTemplate(photos). CSS("opacity", "0.5"). AppendTo(thumbnailList). MouseEnter(delegate(jQueryEvent e) { jQuery.FromElement(e.CurrentTarget).FadeTo(250, 1.0f, delegate() { jQuery.This.CSS("opacity", "1"); }); }) .MouseLeave(delegate(jQueryEvent e) { jQuery.FromElement(e.CurrentTarget).FadeTo(250, 0.5f, delegate() { jQuery.This.CSS("opacity", "0.5"); }); }) .Click(delegate(jQueryEvent e) { PhotoResult photo = (PhotoResult)jQueryTemplating.GetTemplateInstance(e.CurrentTarget).Data; jQueryTemplate photoTemplate = jQueryTemplating.CreateTemplate(jQuery.Select("#" + options.photoTemplateID)); photoPanel.FadeOut(EffectDuration.Slow, delegate() { jQuery.This.Empty().CSS("display", ""). Append(jQueryTemplating.RenderTemplate(photoTemplate, photo)). FadeIn(EffectDuration.Slow); }); }). Eq(0).Click(); }); return false; })); }
public void TestEmptyCollection() { Assert.ExpectAsserts(1); GalleryPluginOptions options = new GalleryPluginOptions("thumbsListID", "thumbsList"); options.photoService = new MockPhotoService(null); TestEngine.WaitForAsyncCompletion(); jQuery.FromElement(Document.Body).Plugin <GalleryObject>().Gallery(options); Assert.AreEqual(_thumbsList.GetHtml().Trim().Length, 0, "Expected html to be empty for null photos array."); TestEngine.ResumeOnAsyncCompleted(); }
private static void ShowPhotos(string tags) { if (String.IsNullOrEmpty(tags)) { return; } _currentTags = tags; GalleryPluginOptions options = new GalleryPluginOptions("tags", tags, "thumbsListID", "thumbsList", "photoPanelID", "photoPanel", "thumbnailTemplateID", "thumbnailTemplate", "photoTemplateID", "photoTemplate"); jQuery.Select("#gallery").Plugin<GalleryObject>().Gallery(options); jQueryHistory.PushState(new Dictionary("tags", tags)); }
public static jQueryObject Gallery(GalleryPluginOptions customOptions) { GalleryPluginOptions defaultOptions = new GalleryPluginOptions("count", 10, "photoService", new FlickrService()); GalleryPluginOptions options = (GalleryPluginOptions)jQuery.Extend(new Dictionary<string, object>(), defaultOptions, customOptions); return jQuery.Current.Each(delegate(int i, Element element) { jQueryObject thumbnailList = jQuery.Select("#" + options.thumbsListID); jQueryObject photoPanel = jQuery.Select("#" + options.photoPanelID); options.photoService.SearchPhotos(options.tags, options.count, delegate(List<PhotoResult> photos) { if ((photos == null) || (photos.Count == 0)) { return; } thumbnailList.Empty(); jQuery.Select("#" + options.thumbnailTemplateID).Plugin<jQueryTemplateObject>(). RenderTemplate(photos). CSS("opacity", "0.5"). AppendTo(thumbnailList). MouseEnter(delegate(jQueryEvent e) { jQuery.FromElement(e.CurrentTarget).FadeTo(250, 1.0f, delegate() { jQuery.This.CSS("opacity", "1"); }); }) .MouseLeave(delegate(jQueryEvent e) { jQuery.FromElement(e.CurrentTarget).FadeTo(250, 0.5f, delegate() { jQuery.This.CSS("opacity", "0.5"); }); }) .Click(delegate(jQueryEvent e) { PhotoResult photo = (PhotoResult)jQueryTemplating.GetTemplateInstance(e.CurrentTarget).Data; jQueryTemplate photoTemplate = jQueryTemplating.CreateTemplate(jQuery.Select("#" + options.photoTemplateID)); photoPanel.FadeOut(EffectDuration.Slow, delegate() { jQuery.This.Empty().CSS("display", ""). Append(jQueryTemplating.RenderTemplate(photoTemplate, photo)). FadeIn(EffectDuration.Slow); }); }). Eq(0).Click(); }); return false; }); }
private static void ShowPhotos(string tags) { if (String.IsNullOrEmpty(tags)) { return; } _currentTags = tags; GalleryPluginOptions options = new GalleryPluginOptions("tags", tags, "thumbsListID", "thumbsList", "photoPanelID", "photoPanel", "thumbnailTemplateID", "thumbnailTemplate", "photoTemplateID", "photoTemplate"); jQuery.Select("#gallery").Plugin <GalleryObject>().Gallery(options); jQueryHistory.PushState(new Dictionary("tags", tags)); }
public jQueryObject Gallery(GalleryPluginOptions options) { return(null); }
public jQueryObject Gallery(GalleryPluginOptions options) { return null; }