private void OnPluginMessageBroadcasted(object sender, PluginMessageEventArgs e) { if (e.Message == PluginMessages.ShowAttributeTable) { ShowTableEditor(); } }
public override void OnClick() { if (_view.SelectedItemType == esriTOCControlItem.esriTOCControlItemLayer && _view.SelectedLayer != null) { if (_view.SelectedLayer is IFeatureLayer) { var args = new PluginMessageEventArgs(PluginMessages.ShowAttributeTable); _context.Broadcaster.BroadcastEvent(t => t.MessageBroadcasted_, _view, args); // 显示属性表 //IDockPanel dock = _context.DockPanels.Find(DockPanelKeys.TableEditor); //if (dock == null) // return; //dock.Visible = true; } } }
public override void RunCommand(LegendCommand command) { switch (command) { case LegendCommand.AddGroup: Legend.Groups.Add(); break; case LegendCommand.AddLayer: { int groupHandle = _legendDockPanel.SelectedGroupHandle; if (_layerService.AddLayer(DataSourceType.All) && groupHandle != -1) { int layerHandle = _layerService.LastLayerHandle; Legend.Layers.MoveLayer(layerHandle, groupHandle); } break; } case LegendCommand.GroupProperties: { int groupHandle = _legendDockPanel.SelectedGroupHandle; var group = Legend.Groups.ItemByHandle(groupHandle); if (group != null) { if (_context.Container.Run <LegendGroupPresenter, ILegendGroup>(group)) { Legend.Redraw(); } } break; } case LegendCommand.ZoomToGroup: { var group = Legend.Groups.ItemByHandle(_legendDockPanel.SelectedGroupHandle); if (group != null) { var box = group.Envelope; _context.Map.ZoomToExtents(box); } break; } case LegendCommand.RemoveGroup: { var group = Legend.Groups.ItemByHandle(_legendDockPanel.SelectedGroupHandle); if (group != null) { if (MessageService.Current.Ask("Do you want to remove group: " + group.Text + "?")) { Legend.Groups.Remove(group.Handle); } } break; } case LegendCommand.Labels: { var layer = _context.Legend.Layers.Current; if (layer != null && layer.IsVector) { _broadcaster.BroadcastEvent(p => p.LayerLabelsClicked_, _context.Legend, new LayerEventArgs(layer.Handle)); } } break; case LegendCommand.TableEditor: { var layer = _context.Legend.Layers.Current; if (layer != null && layer.IsVector) { var args = new PluginMessageEventArgs(PluginMessages.ShowAttributeTable); _broadcaster.BroadcastEvent(t => t.MessageBroadcasted_, _context.Legend, args); } } break; case LegendCommand.ZoomToLayer: _context.Map.ZoomToLayer(_context.Legend.SelectedLayerHandle); break; case LegendCommand.RemoveLayer: _layerService.RemoveSelectedLayer(); break; case LegendCommand.Properties: _broadcaster.BroadcastEvent(p => p.LayerDoubleClicked_, Legend, new LayerEventArgs(Legend.SelectedLayerHandle)); break; case LegendCommand.SaveStyle: { var layer = Legend.Layers.Current; if (layer != null) { if (!LayerSerializationHelper.CheckFilename(layer.Filename)) { MessageService.Current.Info("Can not save settings for a non-disk based layer."); return; } LayerSerializationHelper.SaveSettings(layer); } break; } case LegendCommand.LoadStyle: { var layer = Legend.Layers.Current; if (layer != null) { if (!LayerSerializationHelper.CheckFilename(layer.Filename)) { MessageService.Current.Info("Can not load settings for a non-disk based layer."); return; } LayerSerializationHelper.LoadSettings(layer, _broadcaster, false); } _context.Legend.Redraw(LegendRedraw.LegendAndMap); } break; case LegendCommand.OpenFileLocation: { var layer = Legend.Layers.Current; if (layer != null && File.Exists(layer.Filename)) { Shared.PathHelper.OpenFolderWithExplorer(layer.Filename); } else { MessageService.Current.Warn("Failed to find file for the layer."); } break; } } }