public IExplorerObject DeserializeExplorerObject(string FullName) { IExplorerObject cached = GetExObjectFromCache(FullName); if (cached != null) { return(cached); } PlugInManager compManager = new PlugInManager(); foreach (XmlNode exNode in compManager.GetPluginNodes(Plugins.Type.IExplorerObject)) { IExplorerObject exObject = (IExplorerObject)compManager.CreateInstance(exNode); if (!(exObject is ISerializableExplorerObject)) { continue; } exObject = ((ISerializableExplorerObject)exObject).CreateInstanceByFullName(FullName, this); if (exObject != null) { return(exObject); } } return(null); }
public void FolderClick(object sender, KeyEventArgs e) { string folder = ((TreeViewItem)sender).Tag.ToString(); if (e.Key == Key.F6) { IExplorerObject obj = Buffer.getInstance().ExpObj; if (obj != null) { obj.Paste(folder); FillFileTree(CurrentLocation); RefreshSubFolders((TreeViewItem)sender); } } if (e.Key == Key.F5) { new Folder(folder).Copy(); } if (e.Key == Key.F4) { new Folder(folder).Cut(); } if (e.Key == Key.F8) { new Folder(folder).Delete(); var parent = (TreeViewItem)((TreeViewItem)sender).Parent; RefreshSubFolders(parent); FileTree.Items.Clear(); } e.Handled = true; }
internal TOCElementExplorerObject(IExplorerObject parent, ITOCElement element) : base(parent, typeof(ITOCElement), 2) { _parent = parent; _element = element; _icon = new MapDocumentExploererIcon(2); }
public Task <IExplorerObject> CreateExplorerObject(IExplorerObject parentExObject) { if (!CanCreate(parentExObject)) { return(null); } SaveFileDialog dlg = new SaveFileDialog(); dlg.Title = "New SQLite Feature Database..."; dlg.Filter = "SQLite DB(*.fdb)|*.fdb"; dlg.InitialDirectory = parentExObject.FullName; dlg.FileName = "database1.fdb"; if (dlg.ShowDialog() == DialogResult.OK) { SQLiteFDB fdb = new SQLiteFDB(); if (!fdb.Create(dlg.FileName)) { MessageBox.Show(fdb.LastErrorMessage, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(Task.FromResult <IExplorerObject>(null)); } _filename = dlg.FileName; return(Task.FromResult <IExplorerObject>(this)); } return(null); }
async public Task <IExplorerFileObject> CreateInstance(IExplorerObject parent, string filename) { string f = filename.ToLower(); if (!f.ToLower().EndsWith(".fdb")) { return(null); } try { if (!(new FileInfo(f).Exists)) { return(null); } using (SQLiteFDB fdb = new SQLiteFDB()) { if (!await fdb.Open(f) || !await fdb.IsValidAccessFDB()) { return(null); } } } catch { return(null); } return(new SQLiteFDBExplorerObject(parent, filename)); }
internal bool HasChildNode(IExplorerObject exObject) { if (exObject == null) { return(true); } TreeNode node = treeView.SelectedNode; if (node == null) { return(true); } node.Expand(); foreach (TreeNode n in node.Nodes) { if (!(n is ExplorerObjectNode)) { continue; } IExplorerObject ex = ((ExplorerObjectNode)n).ExplorerObject; if (ex == null) { continue; } if (ExObjectComparer.Equals(ex, exObject)) { return(true); } } return(false); }
private void btnSelect_Click(object sender, EventArgs e) { List <ExplorerDialogFilter> filters = new List <ExplorerDialogFilter>(); filters.Add(new OpenFeatureDatasetFilter()); ExplorerDialog exDlg = new ExplorerDialog("Target Feature Dataset", filters, true); if (exDlg.ShowDialog() == DialogResult.OK && exDlg.ExplorerObjects.Count == 1) { IExplorerObject parentObject = exDlg.ExplorerObjects[0]; if (parentObject.Object is IFeatureDataset && ((IDataset)parentObject.Object).Database is IFeatureUpdater) { _dataset = (IFeatureDataset)parentObject.Object; } else { MessageBox.Show("Can't determine target featureclass!"); return; } txtDatasetName.Text = _dataset.Database.ToString(); txtDatasetLocation.Text = parentObject.FullName; } }
async public override Task <bool> Match(IExplorerObject exObject) { bool match = await base.Match(exObject); // Grouplayer nicht... if (exObject is IExplorerParentObject) { return(false); } var instance = await exObject?.GetInstanceAsync(); if (match && instance is ITOCElement && _geomType != geometryType.Unknown) { ITOCElement tocElement = instance as ITOCElement; if (tocElement.Layers != null) { foreach (ILayer layer in tocElement.Layers) { if (layer is IFeatureLayer && ((IFeatureLayer)layer).FeatureClass != null) { return(((IFeatureLayer)layer).FeatureClass.GeometryType == _geomType); } } } } //if (match && _geomType != geometryType.Unknown && exObject.Object is IFeatureLayer && ((IFeatureLayer)exObject.Object).FeatureClass != null) //{ // return ((IFeatureLayer)exObject.Object).FeatureClass.GeometryType == _geomType; //} return(match); }
private void lstFavorites_MouseDoubleClick(object sender, MouseEventArgs e) { ListViewItem item = lstFavorites.GetItemAt(e.X, e.Y); if (item == null) { return; } if (item.ImageIndex == 1 && _tree != null) { IExplorerObject selected = _tree.SelectedExplorerObject; if (selected == null) { return; } FormAddToFavorites dlg = new FormAddToFavorites(selected.FullName, true); if (dlg.ShowDialog() == DialogResult.OK) { MyFavorites favs = new MyFavorites(); favs.AddFavorite(dlg.FavoriteName, selected.FullName, (selected.Icon != null) ? selected.Icon.Image : null); BuildList(); } } }
private void catalogTreeControl1_NodeDeleted(IExplorerObject exObject) { if (NodeDeleted != null) { NodeDeleted(exObject); } }
public override bool Match(IExplorerObject exObject) { bool match = base.Match(exObject); // Grouplayer nicht... if (exObject is IExplorerParentObject) { return(false); } if (match && exObject != null && exObject.Object is ITOCElement && _geomType != geometryType.Unknown) { ITOCElement tocElement = exObject.Object as ITOCElement; if (tocElement.Layers != null) { foreach (ILayer layer in tocElement.Layers) { if (layer is IFeatureLayer && ((IFeatureLayer)layer).FeatureClass != null) { return(((IFeatureLayer)layer).FeatureClass.GeometryType == _geomType); } } } } //if (match && _geomType != geometryType.Unknown && exObject.Object is IFeatureLayer && ((IFeatureLayer)exObject.Object).FeatureClass != null) //{ // return ((IFeatureLayer)exObject.Object).FeatureClass.GeometryType == _geomType; //} return(match); }
internal ContextMenuStrip BuildContextMenu(IExplorerObject exObject) { List <IExplorerObject> context = new List <IExplorerObject>(); context.Add(exObject); return(BuildContextMenu(exObject, context, false)); }
private void IsEnabled(object obj) { if (!(obj is BooleanClass)) { return; } BooleanClass boolean = (BooleanClass)obj; IDataObject iData; try { iData = Clipboard.GetDataObject(); } catch { boolean.Value = false; return; } if (iData == null) { boolean.Value = false; return; } foreach (string format in iData.GetFormats()) { if (!format.Contains("gView.Plugins.MapTools.ExtensionSerializer") && !format.Contains("gView.Framework.system.ExplorerObjectSerialization") && !format.Contains("gView.Framework.UI.IExplorerObjectSerialization")) { continue; } object ob = null; try { ob = iData.GetData(format); } catch { } if (ob is IEnumerable <IExplorerObjectSerialization> && _exapp != null && _exapp.SelectedObjects != null && _exapp.SelectedObjects.Count == 1) { IExplorerObject exObject = _exapp.SelectedObjects[0]; if (exObject is IExplorerObjectContentDragDropEvents) { IExplorerObjectContentDragDropEvents ddEvents = exObject as IExplorerObjectContentDragDropEvents; DragEventArgs e = new DragEventArgs(iData, 0, 0, 0, DragDropEffects.Copy, DragDropEffects.Copy); ddEvents.Content_DragEnter(e); if (e.Effect == DragDropEffects.Copy) { boolean.Value = true; return; } } } } boolean.Value = false; return; }
public DriveObject(IExplorerObject parent, string drive, uint type) : base(parent, null) { _drive = drive; switch (type) { case 2: _imageIndex = 7; _type = "Floppy Disk (" + _drive + ")"; break; case 5: _imageIndex = 4; _type = "CD-ROM Drive (" + _drive + ")"; break; case 4: _imageIndex = 5; _type = "Mapped Drive (" + _drive + ")"; break; case 999: _imageIndex = 5; _type = drive; break; default: _imageIndex = 6; _type = "Local Drive (" + _drive + ")"; break; } }
async internal Task <ContextMenuStrip> BuildContextMenu(IExplorerObject exObject) { List <IExplorerObject> context = new List <IExplorerObject>(); context.Add(exObject); return(await BuildContextMenu(exObject, context, false)); }
public IExplorerObject CreateExplorerObject(IExplorerObject parentExObject) { ExplorerObjectEventArgs e = new ExplorerObjectEventArgs(); ExplorerObjectDoubleClick(e); return(e.NewExplorerObject); }
public IExplorerObject CreateInstanceByFullName(string FullName, ISerializableExplorerObjectCache cache) { IExplorerObject obj = (cache.Contains(FullName)) ? cache[FullName] : CreateInstance(null, FullName); cache.Append(obj); return(obj); }
private void toolAddToFavorites_Click(object sender, EventArgs e) { IExplorerObject selected = catalogComboBox1.SelectedExplorerObject; if (selected == null) { return; } FormAddToFavorites dlg = new FormAddToFavorites(selected.FullName, false); if (dlg.ShowDialog() == DialogResult.OK) { MyFavorites favs = new MyFavorites(); favs.AddFavorite(dlg.FavoriteName, selected.FullName, (selected.Icon != null) ? selected.Icon.Image : null); FavoriteMenuItem fItem = new FavoriteMenuItem(new MyFavorites.Favorite(dlg.FavoriteName, dlg.FavoritePath, (selected.Icon != null) ? selected.Icon.Image : null)); fItem.Click += new EventHandler(fItem_Click); if (btnFavorites.DropDownItems.Count < 2) { btnFavorites.DropDownItems.Add(new ToolStripSeparator()); } btnFavorites.DropDownItems.Add(fItem); } }
public GMLExplorerObject(IExplorerObject parent, string filename) : base(parent, typeof(OGC.Dataset.GML.Dataset), 2) { _filename = filename; _dataset = new gView.Interoperability.OGC.Dataset.GML.Dataset(); }
public CatalogComboItem(string text, int level, int imageIndex, IExplorerObject exObject) { _text = text; _level = level; _imageIndex = imageIndex; _exObject = exObject; }
private void PasteClick(object sender, RoutedEventArgs e) { TreeViewItem lselected = (TreeViewItem)leftFolderTree.SelectedItem; TreeViewItem rselected = (TreeViewItem)rightFolderTree.SelectedItem; if (lselected != null) { IExplorerObject obj = Buffer.getInstance().ExpObj; if (obj != null) { obj.Paste(lselected.Tag.ToString()); left.FillFileTree(left.CurrentLocation); left.RefreshSubFolders(lselected); return; } } if (rselected != null) { IExplorerObject obj = Buffer.getInstance().ExpObj; if (obj != null) { obj.Paste(lselected.Tag.ToString()); right.FillFileTree(left.CurrentLocation); right.RefreshSubFolders(lselected); return; } } }
public AccessFDBDatasetExplorerObject(IExplorerObject parent, string filename, string dsname) : base(parent, typeof(AccessFDBDataset)) { _filename = filename; if (dsname.IndexOf("#") == 0) { _isImageDataset = true; dsname = dsname.Substring(1, dsname.Length - 1); _icon = new AccessFDBImageDatasetIcon(); } else { _isImageDataset = false; _icon = new AccessFDBDatasetIcon(); } _dsname = dsname; _dataset = new AccessFDBDataset(); _dataset.ConnectionString = "mdb=" + _filename + ";dsname=" + _dsname; _dataset.Open(); _contextItems = new ToolStripItem[2]; _contextItems[0] = new ToolStripMenuItem("Spatial Reference..."); _contextItems[0].Click += new EventHandler(SpatialReference_Click); _contextItems[1] = new ToolStripMenuItem("Shrink Spatial Indices..."); _contextItems[1].Click += new EventHandler(ShrinkSpatialIndices_Click); }
public IExplorerFileObject CreateInstance(IExplorerObject parent, string filename) { string f = filename.ToLower(); if (f.EndsWith(".jpg.mdb") || f.EndsWith(".png.mdb") || f.EndsWith(".tif.mdb") || f.EndsWith(".tiff.mdb")) { return(null); } if (!f.ToLower().EndsWith(".mdb")) { return(null); } try { if (!(new FileInfo(f).Exists)) { return(null); } using (AccessFDB fdb = new AccessFDB()) { if (!fdb.Open(f) || !fdb.IsValidAccessFDB) { return(null); } } } catch { return(null); } return(new AccessFDBExplorerObject(parent, filename)); }
public IExplorerObject CreateExplorerObject(IExplorerObject parentExObject) { if (!CanCreate(parentExObject)) { return(null); } SaveFileDialog dlg = new SaveFileDialog(); dlg.Title = "New AccessFDB..."; dlg.Filter = "MSAccess DB(*.mdb)|*.mdb"; dlg.FileName = parentExObject.FullName + @"\fdb.mdb"; if (dlg.ShowDialog() == DialogResult.OK) { AccessFDB fdb = new AccessFDB(); if (!fdb.Create(dlg.FileName)) { MessageBox.Show(fdb.lastErrorMsg, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } _filename = dlg.FileName; return(this); } return(null); }
public Task <IExplorerObject> CreateExplorerObject(IExplorerObject parentExObject) { ExplorerObjectEventArgs e = new ExplorerObjectEventArgs(); ExplorerObjectDoubleClick(e); return(Task.FromResult <IExplorerObject>(e.NewExplorerObject)); }
private void Add2Favorites_Click(object sender, RoutedEventArgs e) { if (_tree == null) { return; } IExplorerObject exObject = _tree.SelectedExplorerObject; if (exObject == null) { return; } gView.Framework.UI.Dialogs.FormAddToFavorites dlg = new gView.Framework.UI.Dialogs.FormAddToFavorites(exObject.FullName, false); if (dlg.ShowDialog() == global::System.Windows.Forms.DialogResult.OK) { MyFavorites favs = new MyFavorites(); favs.AddFavorite(dlg.FavoriteName, exObject.FullName, (exObject.Icon != null) ? exObject.Icon.Image : null); WpfFavoriteMenuItem fItem = new WpfFavoriteMenuItem(new MyFavorites.Favorite(dlg.FavoriteName, dlg.FavoritePath, (exObject.Icon != null) ? exObject.Icon.Image : null)); fItem.Click += new RoutedEventHandler(MenuItem_Favorite_Click); _favDropDownButton.Items.Add(fItem); } }
public bool CanCreate(IExplorerObject parentExObject) { if (parentExObject is SQLiteFDBDatasetExplorerObject) { return(true); } return(false); }
public void Append(IExplorerObject exObject) { if (exObject == null || Contains(exObject.FullName)) { return; } _exObjectsCache.Add(exObject); }
public bool CanCreate(IExplorerObject parentExObject) { if (parentExObject == null) { return(false); } return(PlugInManager.PlugInID(parentExObject) == KnownExplorerObjectIDs.Directory); }
internal GeoServicesServiceExplorerObject(IExplorerObject parent, string name, string folder, string connectionString) : base(parent, typeof(GeoServicesClass), 1) { _name = name; _folder = folder; _connectionString = connectionString; _parent = parent; }