public static PhotoCollectionLoadContext FromString(string str)
        {
            string[] parts = str.Split('\t');
            var lc = new PhotoCollectionLoadContext(parts[0]);

            if (parts.Length == 3) {
                lc.Page = Int32.Parse(parts[1]);
                lc.PerPage = Int32.Parse(parts[2]);
            }
            return lc;
        }
        public static PhotoCollectionLoadContext FromString(string str)
        {
            string[] parts = str.Split('\t');
            var      lc    = new PhotoCollectionLoadContext(parts[0]);

            if (parts.Length == 3)
            {
                lc.Page    = Int32.Parse(parts[1]);
                lc.PerPage = Int32.Parse(parts[2]);
            }
            return(lc);
        }
Exemple #3
0
            public LoadRequest GetLoadRequest(PhotoCollectionLoadContext context, Type objectType)
            {
                List <FlickrArgument> args = new List <FlickrArgument>();

                args.Add(new FlickrArgument("per_page", context.PerPage.ToString()));
                args.Add(new FlickrArgument("page", context.Page.ToString()));

                PopulateArgs(context, args);

                return(BuildRequest(
                           context,
                           ApiName,
                           args.ToArray()));
            }
Exemple #4
0
        public static void Search(string query, string username, string tag, Action <SearchVm> complete)
        {
            Action <string> handler = (userid) =>
            {
                string s = BuildSearchIdentity(query, userid, tag);

                PhotoCollectionLoadContext id = new PhotoCollectionLoadContext(s)
                {
                    Page    = 0,
                    PerPage = 25
                };

                DataManager.Current.Load <SearchVm>(id,
                                                    (svm) =>
                {
                    complete(svm);
                },
                                                    null);
            };

            if (!String.IsNullOrEmpty(username))
            {
                DataManager.Current.Load <UserNameVm>(username,
                                                      (vm) =>
                {
                    handler(vm.UserId);
                },
                                                      (ex) =>
                {
                    MessageBox.Show("Username not found.");
                }
                                                      );
            }
            else
            {
                handler(null);
            }
        }
Exemple #5
0
            internal override void PopulateArgs(PhotoCollectionLoadContext context, IList <FlickrArgument> args)
            {
                base.PopulateArgs(context, args);

                string query;
                string userid;
                string tags;

                ParseSearchIdentity((string)context.Identity, out query, out userid, out tags);


                if (!String.IsNullOrEmpty(query))
                {
                    args.Add(new FlickrArgument("text", query));
                }
                else if (!String.IsNullOrEmpty(tags))
                {
                    args.Add(new FlickrArgument("tags", tags));
                }
                else if (!String.IsNullOrEmpty(userid))
                {
                    args.Add(new FlickrArgument("user_id", userid));
                }
            }
Exemple #6
0
 internal override void PopulateArgs(PhotoCollectionLoadContext context, IList <FlickrArgument> args)
 {
     base.PopulateArgs(context, args);
     args.Add(new FlickrArgument("user_id", context.Identity.ToString()));
 }
Exemple #7
0
 internal virtual void PopulateArgs(PhotoCollectionLoadContext context, IList <FlickrArgument> args)
 {
 }
Exemple #8
0
 internal override void PopulateArgs(PhotoCollectionLoadContext context, System.Collections.Generic.IList <FlickrArgument> args)
 {
     base.PopulateArgs(context, args);
     args.Add(new FlickrArgument("photoset_id", context.Identity.ToString()));
 }