// Gets an enumeration of all Uri tags of items selected in the specified control // or an empty enumeration if no items are selected private IEnumerable <Uri> GetSelectedItemUris(Control control) { ThumbnailControl thumbnailControl = control as ThumbnailControl; if (thumbnailControl != null) { foreach (ThumbnailControlItem item in thumbnailControl.Selection) { Uri uri = GetUriFromTag(item.Tag); if (uri != null) { yield return(uri); } } } else { ListView fileListView = control as ListView; if (fileListView != null) { foreach (ListViewItem item in fileListView.SelectedItems) { Uri uri = GetUriFromTag(item.Tag); if (uri != null) { yield return(uri); } } } } }
// 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); }
private Point GetPreviewControlPosition(int i) { ThumbnailControl control = (ThumbnailControl)itemsControl.Items[i]; Point relativePoint = control.TransformToAncestor(page).Transform(new Point(0, 0)); return(relativePoint); }
/// <summary> /// Send the PathToMedia value to ImageDisplay /// </summary> /// <param name="PathToMedia"></param> void SingleFileLoad_SingleMediaSelected(string PathToMedia) { if (ImageDisplay != null) // If the image display form exists. Should make sure it is showing as well! { ConsoleWindow.Log("Loading & Processing Media " + PathToMedia); IdentifyFileType fileType = new IdentifyFileType(PathToMedia); fileType.IdentifyFileTypeComplete += fileType_IdentifyFileTypeComplete; fileType.IdentifyFileTypeError += fileType_IdentifyFileTypeError; fileType.IdentifyFileTypeLog += fileType_IdentifyFileTypeLog; fileType.GetFileType(); if (IsImage) { if (!dFileLoaderThumbnails.ContainsValue(PathToMedia)) { if (FileLoader != null) { ThumbnailControl thumbnail = new ThumbnailControl(PathToMedia); FileLoader.Add(thumbnail); } dFileLoaderThumbnails.Add(ThumbnailControlerCounter, PathToMedia); ThumbnailControlerCounter++; } if (CurrentImage != PathToMedia) { ImageDisplay.ShowSingleMedia(PathToMedia); Histogram.DoHistogram(PathToMedia); Statistics.DoStatistics(PathToMedia); CurrentImage = PathToMedia; } } } }
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); }
/// <summary> /// Initializes the MEF component</summary> public void Initialize() { m_treeControl = new TreeControl(); m_treeControl.Dock = DockStyle.Fill; m_treeControl.AllowDrop = true; m_treeControl.SelectionMode = SelectionMode.MultiExtended; m_treeControl.ImageList = ResourceUtil.GetImageList16(); m_treeControl.StateImageList = ResourceUtil.GetImageList16(); m_treeControl.DragOver += treeControl_DragOver; m_treeControl.DragDrop += treeControl_DragDrop; m_treeControl.MouseUp += treeControl_MouseUp; m_treeControlAdapter = new TreeControlAdapter(m_treeControl); m_listView = new ListView(); m_listView.View = View.Details; m_listView.Dock = DockStyle.Fill; m_listView.AllowDrop = true; m_listView.LabelEdit = false; m_listView.MouseUp += thumbnailControl_MouseUp; m_listView.MouseMove += thumbnailControl_MouseMove; m_listView.MouseLeave += thumbnailControl_MouseLeave; m_listView.DragOver += thumbnailControl_DragOver; m_listViewAdapter = new ListViewAdapter(m_listView); m_thumbnailControl = new ThumbnailControl(); m_thumbnailControl.Dock = DockStyle.Fill; m_thumbnailControl.AllowDrop = true; m_thumbnailControl.BackColor = SystemColors.Window; m_thumbnailControl.SelectionChanged += thumbnailControl_SelectionChanged; m_thumbnailControl.MouseMove += thumbnailControl_MouseMove; m_thumbnailControl.MouseUp += thumbnailControl_MouseUp; m_thumbnailControl.MouseLeave += thumbnailControl_MouseLeave; m_thumbnailControl.DragOver += thumbnailControl_DragOver; m_splitContainer = new SplitContainer(); m_splitContainer.Name = "Resources".Localize(); m_splitContainer.Orientation = Orientation.Vertical; m_splitContainer.Panel1.Controls.Add(m_treeControl); m_splitContainer.Panel2.Controls.Add(m_thumbnailControl); m_splitContainer.Panel2.Controls.Add(m_listView); m_splitContainer.SplitterDistance = 10; m_listView.Hide(); Image resourceImage = ResourceUtil.GetImage16(Resources.ResourceImage); // on initialization, register our tree control with the hosting service m_controlHostService.RegisterControl( m_splitContainer, new ControlInfo( "Resources".Localize(), "Lists available resources".Localize(), StandardControlGroup.Left, resourceImage), this); RegisterCommands(m_commandService); RegisterSettings(); }
internal void Add(ThumbnailControl thumbnail) { thumbnail.ThumbnailSelected += thumbnail_ThumbnailSelected; ThumbnailLayoutPanel.Controls.Add(thumbnail); }
public AssetLister( IControlHostService controlHostService, IContextService contextService, ICommandService commandService, IFileDialogService fileDialogService) { m_controlHostService = controlHostService; m_contextService = contextService; m_commandService = commandService; m_fileDialogService = fileDialogService; m_treeControl = new TreeControl(); m_treeControl.Dock = DockStyle.Fill; m_treeControl.AllowDrop = true; m_treeControl.SelectionMode = SelectionMode.MultiExtended; m_treeControl.ImageList = ResourceUtil.GetImageList16(); m_treeControl.StateImageList = ResourceUtil.GetImageList16(); m_treeControl.DragOver += new DragEventHandler(treeControl_DragOver); m_treeControl.DragDrop += new DragEventHandler(treeControl_DragDrop); m_treeControl.MouseDown += new MouseEventHandler(treeControl_MouseDown); m_treeControl.MouseUp += new MouseEventHandler(treeControl_MouseUp); m_treeControl.NodeLabelEdited += new EventHandler <TreeControl.NodeEventArgs>(treeControl_NodeLabelEdited); m_listView = new ListView(); m_listView.View = View.Details; m_listView.Dock = DockStyle.Fill; m_listView.AllowDrop = true; m_listView.LabelEdit = false; m_listView.MouseDown += new MouseEventHandler(thumbnailControl_MouseDown); m_listView.MouseUp += new MouseEventHandler(thumbnailControl_MouseUp); m_listView.MouseMove += new MouseEventHandler(thumbnailControl_MouseMove); m_listView.MouseLeave += new EventHandler(thumbnailControl_MouseLeave); m_listView.DoubleClick += new EventHandler(thumbnailControl_DoubleClick); m_listView.DragOver += new DragEventHandler(thumbnailControl_DragOver); m_listView.DragDrop += new DragEventHandler(thumbnailControl_DragDrop); m_thumbnailControl = new ThumbnailControl(); m_thumbnailControl.IndicatorImageList = ResourceUtil.GetImageList16(); m_thumbnailControl.Dock = DockStyle.Fill; m_thumbnailControl.AllowDrop = true; m_thumbnailControl.BackColor = SystemColors.Window; m_thumbnailControl.SelectionChanged += new EventHandler(thumbnailControl_SelectionChanged); m_thumbnailControl.MouseDown += new MouseEventHandler(thumbnailControl_MouseDown); m_thumbnailControl.MouseMove += new MouseEventHandler(thumbnailControl_MouseMove); m_thumbnailControl.MouseUp += new MouseEventHandler(thumbnailControl_MouseUp); m_thumbnailControl.MouseLeave += new EventHandler(thumbnailControl_MouseLeave); m_thumbnailControl.DoubleClick += new EventHandler(thumbnailControl_DoubleClick); m_thumbnailControl.DragOver += new DragEventHandler(thumbnailControl_DragOver); m_thumbnailControl.DragDrop += new DragEventHandler(thumbnailControl_DragDrop); m_splitContainer = new SplitContainer(); m_splitContainer.Name = "Asset"; m_splitContainer.Orientation = Orientation.Vertical; m_splitContainer.Panel1.Controls.Add(m_treeControl); m_splitContainer.Panel2.Controls.Add(m_thumbnailControl); m_splitContainer.Panel2.Controls.Add(m_listView); m_listView.Hide(); m_selection.Changed += new EventHandler(selection_Changed); m_treeControlAdapter = new TreeControlAdapter(m_treeControl); m_assetFolderTreeView = new AssetFolderTreeView(this); m_treeControlAdapter.TreeView = m_assetFolderTreeView; m_listViewAdaptor = new ListViewAdaptor(m_listView); m_assetItemListView = new AssetItemListView(this); }