///<summary>
        /// Main window for the application
        ///</summary>
        public WindowMain()
        {
            this.InitializeComponent();

            // Setup the context for our Flickr queries
            this.context = new FlickrContext();
            this.context.Photos.OnError += PhotosOnError;
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                FacebookGraph fbUser;
                if (!StateManager.IsAuthenticated(out fbUser))
                {
                    Response.RedirectWithQueryString("Facebook.aspx");
                }

                loggedInName.Text = "Bienvenido, " + fbUser.Name;

                if (Request.QueryString["icode"] != null)
                {
                    var site = StateManager.GetSite(Request.QueryString["icode"]);
                    if (site != null)
                    {
                        this.Title = site.title;

                        FlickrContext context = new FlickrContext();
                        context.Photos.OnError += new Query<Photo>.ErrorHandler(Photos_OnError);

                        var bigs = (from ph in context.Photos
                                    where ph.User == site.flickr_username
                                    && ph.PhotoSize == PhotoSize.Default
                                    select ph).ToList();

                        var thumbs = (from ph in context.Photos
                                      where ph.User == site.flickr_username
                                      && ph.PhotoSize == PhotoSize.Thumbnail
                                      select ph).ToList();

                        var query = from b in bigs
                                    join t in thumbs on b.Id equals t.Id
                                    select new Image() { Src = t.Url, Alt = b.Url, Id = t.Id, Title = t.Title };

                        rptAlbum.DataSource = query.ToList();
                        rptAlbum.DataBind();
                    }
                    else
                    {
                        Response.RedirectWithQueryString("Error.aspx");
                    }
                }
                else
                {
                    Response.RedirectWithQueryString("Error.aspx");
                }
            }
        }
Exemple #3
0
        public ActionResult ADGallery(string icode)
        {
            var site = sitesService.GetSiteByCode(icode);

            FlickrContext context = new FlickrContext();
            context.Photos.OnError += new Query<Photo>.ErrorHandler(Photos_OnError);

            var bigs = (from ph in context.Photos
                        where ph.User == site.flickr_username
                        && ph.PhotoSize == PhotoSize.Default
                        select ph).ToList();

            var thumbs = (from ph in context.Photos
                          where ph.User == site.flickr_username
                          && ph.PhotoSize == PhotoSize.Thumbnail
                          select ph).ToList();

            var query = from b in bigs
                        join t in thumbs on b.Id equals t.Id
                        select new Image() { Src = t.Url, Alt = b.Url, Id = t.Id, Title = t.Title };

            ViewBag.Title = site.title;
            return View(query.ToList());
        }