Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
    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;
        });
    }
Ejemplo n.º 4
0
 public jQueryObject Gallery(GalleryPluginOptions options) {
     return null;
 }