public void OnEvent(object MapEvent) { if (_exapp != null) { _exapp.RefreshContents(); } }
public Task <bool> OnEvent(object MapEvent) { if (_context != null && _context.Count == 1) { FormRenameExObject dlg = new FormRenameExObject(_context[0]); if (dlg.ShowDialog() == DialogResult.OK) { } _context = null; } else if (_exapp != null && _exapp.SelectedObjects != null && _exapp.SelectedObjects.Count == 1) { FormRenameExObject dlg = new FormRenameExObject(_exapp.SelectedObjects[0]); if (dlg.ShowDialog() == DialogResult.OK) { } } if (_exapp != null) { _exapp.RefreshContents(); } return(Task.FromResult(true)); }
public Task <bool> OnEvent(object MapEvent) { if (_exapp != null) { _exapp.RefreshContents(); } return(Task.FromResult(true)); }
public Task <bool> OnEvent(object MapEvent) { if (_doc != null && _doc.FocusMap != null && _doc.FocusMap.Display != null) { foreach (IGraphicElement element in _doc.FocusMap.Display.GraphicsContainer.SelectedElements) { _doc.FocusMap.Display.GraphicsContainer.Elements.Remove(element); } _doc.FocusMap.Display.GraphicsContainer.SelectedElements.Clear(); if (_doc.Application is IMapApplication) { ((IMapApplication)_doc.Application).RefreshActiveMap(DrawPhase.Graphics); } } if (_context != null) { FormDeleteExObjects dlg = new FormDeleteExObjects(_context); if (dlg.ShowDialog() == DialogResult.OK) { foreach (IExplorerObject exObject in dlg.Selected) { if (exObject is IExplorerObjectDeletable) { ((IExplorerObjectDeletable)exObject).DeleteExplorerObject(new ExplorerObjectEventArgs()); } } } _context = null; } else if (_exapp != null && _exapp.SelectedObjects != null) { FormDeleteExObjects dlg = new FormDeleteExObjects(_exapp.SelectedObjects); if (dlg.ShowDialog() == DialogResult.OK) { foreach (IExplorerObject exObject in dlg.Selected) { if (exObject is IExplorerObjectDeletable) { ((IExplorerObjectDeletable)exObject).DeleteExplorerObject(new ExplorerObjectEventArgs()); } } } } if (_exapp != null) { _exapp.RefreshContents(); } return(Task.FromResult(true)); }
public void OnEvent(object MapEvent) { gView.Framework.UI.Dialogs.FormAddNetworkDirectory dlg = new gView.Framework.UI.Dialogs.FormAddNetworkDirectory(); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK && !String.IsNullOrEmpty(dlg.Path)) { ConfigConnections connStream = new ConfigConnections("directories"); connStream.Add(dlg.Path, dlg.Path); if (_exapp != null) { //_tree.SelectRootNode(); _exapp.RefreshContents(); } } }
private void OnEvent() { if (_context != null && _context.Count == 1) { IExplorerObjectContentDragDropEvents2 ddEvents = _context[0] as IExplorerObjectContentDragDropEvents2; _context = null; if (ddEvents == null) { return; } UserData userData = new UserData(); userData.SetUserData("gView.Framework.UI.BaseTools.PasteSchema", true); IDataObject iData = Clipboard.GetDataObject(); if (iData == null) { return; } foreach (string format in iData.GetFormats()) { object ob = iData.GetData(format); if (ob is List <IExplorerObjectSerialization> ) { DragEventArgs e = new DragEventArgs(iData, 0, 0, 0, DragDropEffects.Copy, DragDropEffects.Copy); ddEvents.Content_DragDrop(e, userData); } } if (_exapp != null) { _exapp.RefreshContents(); } } else if (_exapp != null && _exapp.SelectedObjects != null && _exapp.SelectedObjects.Count == 1) { IExplorerObjectContentDragDropEvents2 ddEvents = _exapp.SelectedObjects[0] as IExplorerObjectContentDragDropEvents2; if (ddEvents == null) { return; } UserData userData = new UserData(); userData.SetUserData("gView.Framework.UI.BaseTools.PasteSchema", true); IDataObject iData = Clipboard.GetDataObject(); if (iData == null) { return; } foreach (string format in iData.GetFormats()) { object ob = iData.GetData(format); if (ob is IEnumerable <IExplorerObjectSerialization> ) { DragEventArgs e = new DragEventArgs(iData, 0, 0, 0, DragDropEffects.Copy, DragDropEffects.Copy); ddEvents.Content_DragDrop(e, userData); } } _exapp.RefreshContents(); } }
private void OnEvent() { if (_exapp != null) { _exapp.SetCursor(Cursors.WaitCursor); } try { if (_doc != null && _doc.FocusMap != null && _doc.FocusMap.Display != null) { IDataObject iData = Clipboard.GetDataObject(); if (iData == null) { 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 = iData.GetData(format); if (ob is IEnumerable <ExtensionSerializer> ) { foreach (ExtensionSerializer ser in (IEnumerable <ExtensionSerializer>)ob) { object extension = ser.Object; if (extension is IGraphicElement2) { IGraphicElement2 element = extension as IGraphicElement2; if (element.Geometry != null) { Point point = new Point( (_doc.FocusMap.Display.Envelope.minx + _doc.FocusMap.Display.Envelope.maxx) / 2.0 - (element.Geometry.Envelope.Width) / 2.0, (_doc.FocusMap.Display.Envelope.miny + _doc.FocusMap.Display.Envelope.maxy) / 2.0 - (element.Geometry.Envelope.Height) / 2.0); element.Translation(point.X, point.Y); } _doc.FocusMap.Display.GraphicsContainer.Elements.Add(element); _doc.FocusMap.Display.GraphicsContainer.SelectedElements.Add(element); } } } } if (_doc.Application is IMapApplication) { ((IMapApplication)_doc.Application).RefreshActiveMap(DrawPhase.Graphics); } } if (_context != null && _context.Count == 1) { IExplorerObjectContentDragDropEvents ddEvents = _context[0] as IExplorerObjectContentDragDropEvents; _context = null; if (ddEvents == null) { return; } IDataObject iData = Clipboard.GetDataObject(); if (iData == null) { return; } if (_exapp != null && _exapp.InvokeRequired) { } else { foreach (string format in iData.GetFormats()) { object ob = iData.GetData(format); if (ob is List <IExplorerObjectSerialization> ) { DragEventArgs e = new DragEventArgs(iData, 0, 0, 0, DragDropEffects.Copy, DragDropEffects.Copy); ddEvents.Content_DragDrop(e); } } if (_exapp != null) { _exapp.RefreshContents(); } } } else if (_exapp != null && _exapp.SelectedObjects != null && _exapp.SelectedObjects.Count == 1) { IExplorerObjectContentDragDropEvents ddEvents = null; // Try some times -> await all async treenode events after copy to: I hate async windows programming!!! for (int i = 0; i < 5; i++) { ddEvents = _exapp.SelectedObjects[0] as IExplorerObjectContentDragDropEvents; if (ddEvents == null) { Thread.Sleep(1000); } else { break; } } if (ddEvents == null) { return; } if (_exapp.InvokeRequired) { _exapp.Invoke((MethodInvoker) delegate { IDataObject iData = Clipboard.GetDataObject(); if (iData == null) { return; } foreach (string format in iData.GetFormats()) { object ob = iData.GetData(format); if (ob is IEnumerable <IExplorerObjectSerialization> ) { DragEventArgs e = new DragEventArgs(iData, 0, 0, 0, DragDropEffects.Copy, DragDropEffects.Copy); ddEvents.Content_DragDrop(e); } } _exapp.RefreshContents(); }); } else { IDataObject iData = Clipboard.GetDataObject(); if (iData == null) { return; } foreach (string format in iData.GetFormats()) { object ob = iData.GetData(format); if (ob is IEnumerable <IExplorerObjectSerialization> ) { DragEventArgs e = new DragEventArgs(iData, 0, 0, 0, DragDropEffects.Copy, DragDropEffects.Copy); ddEvents.Content_DragDrop(e); } } _exapp.RefreshContents(); } } } finally { if (_exapp != null) { _exapp.SetCursor(Cursors.Default); } } }
private void OnEvent() { if (_doc != null && _doc.FocusMap != null && _doc.FocusMap.Display != null) { IDataObject iData = Clipboard.GetDataObject(); if (iData == null) { 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 = iData.GetData(format); if (ob is IEnumerable <ExtensionSerializer> ) { foreach (ExtensionSerializer ser in (IEnumerable <ExtensionSerializer>)ob) { object extension = ser.Object; if (extension is IGraphicElement2) { IGraphicElement2 element = extension as IGraphicElement2; if (element.Geometry != null) { Point point = new Point( (_doc.FocusMap.Display.Envelope.minx + _doc.FocusMap.Display.Envelope.maxx) / 2.0 - (element.Geometry.Envelope.Width) / 2.0, (_doc.FocusMap.Display.Envelope.miny + _doc.FocusMap.Display.Envelope.maxy) / 2.0 - (element.Geometry.Envelope.Height) / 2.0); element.Translation(point.X, point.Y); } _doc.FocusMap.Display.GraphicsContainer.Elements.Add(element); _doc.FocusMap.Display.GraphicsContainer.SelectedElements.Add(element); } } } } if (_doc.Application is IMapApplication) { ((IMapApplication)_doc.Application).RefreshActiveMap(DrawPhase.Graphics); } } if (_context != null && _context.Count == 1) { IExplorerObjectContentDragDropEvents ddEvents = _context[0] as IExplorerObjectContentDragDropEvents; _context = null; if (ddEvents == null) { return; } IDataObject iData = Clipboard.GetDataObject(); if (iData == null) { return; } foreach (string format in iData.GetFormats()) { object ob = iData.GetData(format); if (ob is List <IExplorerObjectSerialization> ) { DragEventArgs e = new DragEventArgs(iData, 0, 0, 0, DragDropEffects.Copy, DragDropEffects.Copy); ddEvents.Content_DragDrop(e); } } if (_exapp != null) { _exapp.RefreshContents(); } } else if (_exapp != null && _exapp.SelectedObjects != null && _exapp.SelectedObjects.Count == 1) { IExplorerObjectContentDragDropEvents ddEvents = _exapp.SelectedObjects[0] as IExplorerObjectContentDragDropEvents; if (ddEvents == null) { return; } IDataObject iData = Clipboard.GetDataObject(); if (iData == null) { return; } foreach (string format in iData.GetFormats()) { object ob = iData.GetData(format); if (ob is IEnumerable <IExplorerObjectSerialization> ) { DragEventArgs e = new DragEventArgs(iData, 0, 0, 0, DragDropEffects.Copy, DragDropEffects.Copy); ddEvents.Content_DragDrop(e); } } _exapp.RefreshContents(); } }