Beispiel #1
0
        public async Task <TagImage> ShowRandomImage(StorageFolder imageFolder, string tag)
        {
            CommonFileQuery query        = CommonFileQuery.DefaultQuery;
            var             queryOptions = new QueryOptions(query, new[] { ".jpg", ".jpeg" })
            {
                FolderDepth = FolderDepth.Deep
            };

            _ = imageFolder.CreateFileQueryWithOptions(queryOptions);

            var images = await imageFolder.GetFilesAsync();

            TagImage image = await GenerateImage(images, tag);

            while (image.Tags.Contains(tag) && taggedImages.Count < images.Count)
            {
                if (taggedImages.Contains(image.GetHashCode()) == false)
                {
                    taggedImages.Add(image.GetHashCode());
                }
                image = await GenerateImage(images, tag);
            }

            return(image);
        }
Beispiel #2
0
        public virtual TagImage CreateTagImage()
        {
            global::System.IntPtr cPtr = SharingClientPINVOKE.VisualPairReceiver_CreateTagImage(swigCPtr);
            TagImage ret = (cPtr == global::System.IntPtr.Zero) ? null : new TagImage(cPtr, true);

            return(ret);
        }
        //public unsafe bool FindTags(byte[] data, int pixelWidth, int pixelHeight, int bytesPerPixel, ImageTagLocationListener locationCallback) {
        //  fixed ( byte* swig_ptrTo_data = data ) {
        //  {
        //    bool ret = SharingClientPINVOKE.ImageTagManager_FindTags(swigCPtr, (global::System.IntPtr)swig_ptrTo_data, pixelWidth, pixelHeight, bytesPerPixel, ImageTagLocationListener.getCPtr(locationCallback));
        //    return ret;
        //  }
        //  }
        //}

        public virtual TagImage CreateTagImage(int tagId)
        {
            global::System.IntPtr cPtr = SharingClientPINVOKE.ImageTagManager_CreateTagImage(swigCPtr, tagId);
            TagImage ret = (cPtr == global::System.IntPtr.Zero) ? null : new TagImage(cPtr, true);

            return(ret);
        }
        public Task AddImage(TagImage image)
        {
            if (Collection.ContainsKey(image.Guid))
            {
                return(TaskExtensions.CompletedTask);
            }

            return(AddImageRow(image, 0, image.FilePath));
        }
Beispiel #5
0
        private async void GetNextImage()
        {
            if (tag == null || folder == null)
            {
                return;
            }

            StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", folder);
            var image = await imageService.ShowRandomImage(folder, tag);

            if (image != null)
            {
                currentImage        = image;
                ImageDetails.Source = image.ImageData;
                Tags.ItemsSource    = image.Tags;
            }
        }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TagImage obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TagImage obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }