private void BeginRename() { if (listView.SelectedItems.Count == 1 && listView.SelectedItems[0] is ExplorerObjectListViewItem) { ExplorerObjectListViewItem item = listView.SelectedItems[0] as ExplorerObjectListViewItem; if (item.ExplorerObject is IExplorerObjectRenamable) { BeginRename(item); } } }
private void CheckExplorerObjectEventArgs(ExplorerObjectEventArgs args) { if (args.NewExplorerObject != null) { int imageIndex = gView.Explorer.UI.Framework.UI.ExplorerIcons.ImageIndex(args.NewExplorerObject); string[] texts = { args.NewExplorerObject.Name, args.NewExplorerObject.Type }; ListViewItem item = new ExplorerObjectListViewItem(texts, args.NewExplorerObject); item.ImageIndex = imageIndex; listView.Items.Add(item); if (_tree != null) { _tree.AddChildNode(args.NewExplorerObject); } } }
private void BeginRename(ExplorerObjectListViewItem item) { if (item == null || !(item.ExplorerObject is IExplorerObjectRenamable)) { return; } RenameTextBox box = new RenameTextBox(item.ExplorerObject as IExplorerObjectRenamable); box.Bounds = new Rectangle(16, item.Bounds.Y, item.Bounds.Width - 16, item.Bounds.Height); box.Text = item.Text; listView.Controls.Add(box); box.Visible = true; box.Focus(); box.Select(0, item.Text.Length); }
async void contentsList1_ItemDoubleClicked(ListViewItem node) { if (node is ExplorerObjectListViewItem) { ExplorerObjectListViewItem n = (ExplorerObjectListViewItem)node; if (n.ExplorerObject is IExplorerParentObject) { //contentsList1.ExplorerObject = n.ExplorerObject; if (_open) { if (contentsList1.Filter != null && (!await contentsList1.Filter.Match(n.ExplorerObject) || contentsList1.Filter.BrowseAll || n.ExplorerObject is DirectoryObject // Bei Directory immer weiter hineinbrowsen )) { Cursor = Cursors.WaitCursor; catalogComboBox1.AddChildNode(n.ExplorerObject); Cursor = Cursors.Default; txtElement.Text = ""; } } else { Cursor = Cursors.WaitCursor; catalogComboBox1.AddChildNode(n.ExplorerObject); Cursor = Cursors.Default; txtElement.Enabled = contentsList1.Filter != null && await contentsList1.Filter.Match(n.ExplorerObject); if (ElementTextStatusChanged != null) { ElementTextStatusChanged(txtElement); } } StoreLastPath(n.ExplorerObject); } } }
public void CreateNewItem(IExplorerObject exObject) { if (!(exObject is IExplorerObjectCreatable)) { return; } IExplorerObject newExObj = ((IExplorerObjectCreatable)exObject).CreateExplorerObject(_exObject); if (newExObj == null) { return; } if (_tree != null) { newExObj = _tree.AddChildNode(newExObj); } int imageIndex = gView.Explorer.UI.Framework.UI.ExplorerIcons.ImageIndex(newExObj); string[] texts = { newExObj.Name, newExObj.Type }; ListViewItem item = new ExplorerObjectListViewItem(texts, newExObj); item.ImageIndex = imageIndex; if (newExObj is IExplorerObjectDeletable) { ((IExplorerObjectDeletable)newExObj).ExplorerObjectDeleted += new ExplorerObjectDeletedEvent(ContentsList_ExplorerObjectDeleted); } if (newExObj is IExplorerObjectRenamable) { ((IExplorerObjectRenamable)newExObj).ExplorerObjectRenamed += new ExplorerObjectRenamedEvent(ContentsList_ExplorerObjectRenamed); } listView.Items.Add(item); }
private void BuildListThread(object chkTreeNodes) { bool checkTreeNodes = (bool)chkTreeNodes; ClearList(); if (_exObject is IExplorerParentObject) { List <IExplorerObject> childs = ((IExplorerParentObject)_exObject).ChildObjects; if (childs != null) { IStatusBar statusbar = (_app != null) ? _app.StatusBar : null; List <IExplorerObject> childObjects = ((IExplorerParentObject)_exObject).ChildObjects; if (childObjects == null) { return; } int pos = 0, count = childObjects.Count; if (statusbar != null) { statusbar.ProgressVisible = true; } foreach (IExplorerObject exObject in childObjects) { if (exObject == null) { continue; } if (statusbar != null) { statusbar.ProgressValue = (int)(((double)pos++ / (double)count) * 100.0); statusbar.Text = exObject.Name; statusbar.Refresh(); } if (!_cancelTracker.Continue) { break; } if (_filter != null && !(exObject is IExplorerParentObject) && !(exObject is IExplorerObjectDoubleClick) && _open) { if (!_filter.Match(exObject)) { continue; } } int imageIndex = gView.Explorer.UI.Framework.UI.ExplorerIcons.ImageIndex(exObject); if (imageIndex == -1) { continue; } string[] texts = null; if (exObject is IExporerOjectSchema) { texts = new string[] { exObject.Name, exObject.Type, ((IExporerOjectSchema)exObject).Schema } } ; else { texts = new string[] { exObject.Name, exObject.Type } }; ListViewItem item = new ExplorerObjectListViewItem(texts, exObject); item.ImageIndex = imageIndex; AddListItem(item); if (checkTreeNodes && _tree != null) { CheckTree(exObject); } if (exObject is IExplorerObjectDeletable) { ((IExplorerObjectDeletable)exObject).ExplorerObjectDeleted += new ExplorerObjectDeletedEvent(ContentsList_ExplorerObjectDeleted); } if (exObject is IExplorerObjectRenamable) { ((IExplorerObjectRenamable)exObject).ExplorerObjectRenamed += new ExplorerObjectRenamedEvent(ContentsList_ExplorerObjectRenamed); } } if (statusbar != null) { statusbar.ProgressVisible = false; statusbar.Text = pos.ToString() + " Objects..."; statusbar.Refresh(); } } } _worker = null; }