public void Content_DragDrop(System.Windows.Forms.DragEventArgs e) { foreach (string format in e.Data.GetFormats()) { object ob = e.Data.GetData(format); if (ob is List <IExplorerObjectSerialization> ) { ExplorerObjectManager exObjectManager = new ExplorerObjectManager(); List <IExplorerObject> exObjects = exObjectManager.DeserializeExplorerObject((List <IExplorerObjectSerialization>)ob); if (exObjects == null) { return; } foreach (IExplorerObject exObject in exObjects) { if (exObject is IExplorerParentObject) { ((IExplorerParentObject)exObject).Refresh(); } if (exObject.Object is IFeatureDataset) { IDataset dataset = (IDataset)exObject.Object; FormDatasetProperties dlg = new FormDatasetProperties(dataset); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Map map = new Map(); map.AddDataset(dataset, 0); map.Name = dataset.DatasetName; map.Limit = map.Envelope = ((IFeatureDataset)dataset).Envelope; FormAddServices services = new FormAddServices(map); if (services.ShowDialog() == System.Windows.Forms.DialogResult.OK) { AddMap2Connection(services.ServiceNames, services.Maps); } } } else if (exObject.Object is IMap) { FormAddServices services = new FormAddServices((IMap)exObject.Object); if (services.ShowDialog() == System.Windows.Forms.DialogResult.OK) { AddMap2Connection(services.ServiceNames, services.Maps); } } else if (exObject.Object is IMapDocument) { FormAddServices services = new FormAddServices(((IMapDocument)exObject.Object).Maps); if (services.ShowDialog() == System.Windows.Forms.DialogResult.OK) { AddMap2Connection(services.ServiceNames, services.Maps); } } } } } }
async public void Content_DragDrop(System.Windows.Forms.DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { } else { foreach (string format in e.Data.GetFormats()) { object ob = e.Data.GetData(format); if (ob is IEnumerable <IExplorerObjectSerialization> ) { ExplorerObjectManager exObjectManager = new ExplorerObjectManager(); List <IExplorerObject> exObjects = await exObjectManager.DeserializeExplorerObject((IEnumerable <IExplorerObjectSerialization>) ob); if (exObjects == null) { return; } _dataset = await((IExplorerObject)this).GetInstanceAsync() as IFeatureDataset; foreach (IExplorerObject exObject in ListOperations <IExplorerObject> .Clone(exObjects)) { IFeatureClass fc = await exObject.GetInstanceAsync() as IFeatureClass; if (fc == null) { continue; } if (fc.Dataset != null && fc.Dataset.ConnectionString.ToLower() == _dataset.ConnectionString.ToLower()) { exObjects.Remove(exObject); } } if (exObjects.Count == 0) { return; } FormFeatureclassCopy dlg = await FormFeatureclassCopy.Create(exObjects, _dataset); if (dlg.ShowDialog() != DialogResult.OK) { continue; } foreach (FeatureClassListViewItem fcItem in dlg.FeatureClassItems) { await ImportDatasetObject(fcItem); } exObjectManager.Dispose(); // alle ExplorerObjects wieder löschen... } } } await this.Refresh(); }
public void Content_DragDrop(DragEventArgs e, IUserData userdata) { if (_fdb == null) { return; } bool schemaOnly = false; if (userdata != null && userdata.GetUserData("gView.Framework.UI.BaseTools.PasteSchema") != null && userdata.GetUserData("gView.Framework.UI.BaseTools.PasteSchema").Equals(true)) { schemaOnly = true; } if (e.Data.GetDataPresent(DataFormats.FileDrop)) { } else { foreach (string format in e.Data.GetFormats()) { object ob = e.Data.GetData(format); if (ob is IEnumerable <IExplorerObjectSerialization> ) { ExplorerObjectManager exObjectManager = new ExplorerObjectManager(); List <IExplorerObject> exObjects = new List <IExplorerObject>(exObjectManager.DeserializeExplorerObject((IEnumerable <IExplorerObjectSerialization>)ob)); if (exObjects == null) { return; } foreach (IExplorerObject exObject in ListOperations <IExplorerObject> .Clone(exObjects)) { IFeatureClass fc = exObject.Object as IFeatureClass; if (fc == null) { continue; } if (fc.Dataset != null && fc.Dataset.DatasetName == _dsname && _fdb != null && fc.Dataset.Database is AccessFDB && ((AccessFDB)fc.Dataset.Database)._conn.ConnectionString.ToLower() == _fdb._conn.ConnectionString.ToLower()) { exObjects.Remove(exObject); } } if (exObjects.Count == 0) { return; } FormFeatureclassCopy dlg = new FormFeatureclassCopy(exObjects, _dataset); dlg.SchemaOnly = schemaOnly; if (dlg.ShowDialog() != DialogResult.OK) { continue; } foreach (FeatureClassListViewItem fcItem in dlg.FeatureClassItems) { ImportDatasetObject(fcItem, schemaOnly); } /* * foreach (IExplorerObject exObject in exObjects) * { * ImportDatasetObject(exObject.Object); * } * */ exObjectManager.Dispose(); // alle ExplorerObjects wieder löschen... } } } //_dataset.RefreshClasses(); this.Refresh(); }
public void Content_DragDrop(DragEventArgs e, IUserData userdata) { PlugInManager compMan = new PlugInManager(); List <IFileFeatureDatabase> databases = new List <IFileFeatureDatabase>(); foreach (XmlNode dbNode in compMan.GetPluginNodes(Plugins.Type.IFileFeatureDatabase)) { IFileFeatureDatabase db = compMan.CreateInstance(dbNode) as IFileFeatureDatabase; if (db == null) { continue; } databases.Add(db); } if (databases.Count == 0) { return; } bool schemaOnly = false; if (userdata != null && userdata.GetUserData("gView.Framework.UI.BaseTools.PasteSchema") != null && userdata.GetUserData("gView.Framework.UI.BaseTools.PasteSchema").Equals(true)) { schemaOnly = true; } foreach (string format in e.Data.GetFormats()) { object ob = e.Data.GetData(format); if (ob is IEnumerable <IExplorerObjectSerialization> ) { ExplorerObjectManager exObjectManager = new ExplorerObjectManager(); List <IExplorerObject> exObjects = new List <IExplorerObject>(exObjectManager.DeserializeExplorerObject((IEnumerable <IExplorerObjectSerialization>)ob)); if (exObjects == null) { return; } foreach (IExplorerObject exObject in ListOperations <IExplorerObject> .Clone(exObjects)) { IFeatureClass fc = exObject.Object as IFeatureClass; if (fc == null) { continue; } } if (exObjects.Count == 0) { return; } FormFeatureclassCopy dlg = new FormFeatureclassCopy(exObjects, databases, this.FullName); dlg.SchemaOnly = schemaOnly; if (dlg.ShowDialog() != DialogResult.OK) { continue; } if (dlg.SelectedFeatureDatabase == null) { return; } IFileFeatureDatabase fileDB = dlg.SelectedFeatureDatabase; _dataset = fileDB[this.FullName]; if (_dataset == null) { return; } //_dataset = new ImportFeatureDataset(dlg.SelectedFeatureDatabase); foreach (FeatureClassListViewItem fcItem in dlg.FeatureClassItems) { ImportDatasetObject(fcItem, schemaOnly); } exObjectManager.Dispose(); // alle ExplorerObjects wieder löschen... } } }