示例#1
0
        public void FindMissing()
        {
            int i;

            missing.Clear();

            for (i = 0; i < source.Count; i++)
            {
                IPhoto item = source [i];
                string path = item.DefaultVersion.Uri.LocalPath;
                if (!File.Exists(path) || (new FileInfo(path).Length == 0))
                {
                    missing.Add(item);
                }
            }
        }
示例#2
0
        public void SubmitExecute(object obj)
        {
            PhotoList.Clear();
            //Check if search string is null or empty
            if (String.IsNullOrWhiteSpace(ImageSearchKeyword))
            {
                IsPhotoListEmpty      = true;
                EmptyPhotoListMessage = ConstantsUtility.EmptySearchStringErrorMessage;
                return;
            }

            //Fetch data from api call
            var result = (FlickerFeed)_feedApi.ImageSearch(ImageSearchKeyword);

            if (result != null && result.IsSuccessful)
            {
                foreach (var i in result.Entry)
                {
                    foreach (var link in i.Link)
                    {
                        if (link.Type.Contains(ConstantsUtility.LinkTypeImageString))
                        {
                            var pic = new Photo()
                            {
                                Title = i.Title,
                                Url   = link.Href.ToString()
                            };
                            PhotoList.Add(pic);
                        }
                    }
                }
                CheckAndUpdateIsPhotoListEmpty();
            }
            else
            {
                IsPhotoListEmpty = true;
                //We can handle error message based on the business logic scenarios
                if (result != null)
                {
                    EmptyPhotoListMessage = result.ErrorMessage;
                }
                else
                {
                    EmptyPhotoListMessage = ConstantsUtility.ErrorMessageString;
                }
            }
        }