Exemple #1
0
        // Returns the Uri tag of the item at the specified point in the specified control,
        // or null if none found
        private Uri GetClickedItemUri(Control control, Point point)
        {
            Uri resourceUri = null;
            ThumbnailControl thumbnailControl = control as ThumbnailControl;

            if (thumbnailControl != null)
            {
                ThumbnailControlItem item = thumbnailControl.PickThumbnail(point);
                if (item != null)
                {
                    resourceUri = GetUriFromTag(item.Tag);
                }
            }
            else
            {
                ListView fileListView = control as ListView;
                if ((fileListView != null) && (fileListView.SelectedItems.Count > 0))
                {
                    ListViewItem item = fileListView.SelectedItems[0];
                    if (item != null)
                    {
                        resourceUri = GetUriFromTag(item.Tag);
                    }
                }
            }

            return(resourceUri);
        }
Exemple #2
0
        private IResource SelectedAsset(Control control, Point point)
        {
            IResource        asset            = null;
            ThumbnailControl thumbnailControl = control as ThumbnailControl;

            if (thumbnailControl != null)
            {
                ThumbnailControlItem item = thumbnailControl.PickThumbnail(point);
                if (item != null)
                {
                    asset = item.Tag as IResource;
                }
            }
            else
            {
                ListView fileListView = control as ListView;
                if ((fileListView != null) && (fileListView.SelectedItems.Count > 0))
                {
                    ListViewItem listItem = fileListView.SelectedItems[0];
                    asset = listItem.Tag as IResource;
                }
            }

            return(asset);
        }