Пример #1
0
        public void SetForums(List<ForumItem> forums)
        {
            grid.RemoveAll ();
            foreach (var forum in forums) {
                var image = new ImageLoader ();
                image.Url = forum.thumb;
                image.Label = forum.title;
                image.Link = forum.url;
                image.ButtonPressEvent += (o, args) => {
                    if (OnForumClick != null) {
                        OnForumClick (forum);
                    }
                };
                image.OnLoadFailed += (ImageLoader obj) => {
                    Gtk.Application.Invoke (delegate {
                        grid.RemoveWidget (obj, true);
                    });
                };

                grid.AddWidget (image);
                image.Show ();
            }
            grid.Rebuild ();
        }
Пример #2
0
 public void SetGallery(List<GalleryItem> gallery)
 {
     grid.RemoveAll ();
     foreach (var item in gallery) {
         var image = new ImageLoader (true);
         image.Url = item.thumb;
         image.Link = item.url;
         image.ButtonPressEvent += (o, args) => {
             if (OnGalleryItemClick != null) {
                 OnGalleryItemClick (item);
             }
         };
         image.OnLoadFailed += (ImageLoader obj) => {
             Gtk.Application.Invoke (delegate {
                 grid.RemoveWidget (obj, true);
             });
         };
         image.OnSaveClick = (string link) => {
             if (OnSaveClick != null) {
                 OnSaveClick (link, image);
             }
         };
         grid.AddWidget (image);
         image.Show ();
     }
     grid.Rebuild ();
 }