public override void RunCommand(ElementsCommand command) { switch (command) { case ElementsCommand.MoveUp: _layoutControl.MoveSelectionUp(); break; case ElementsCommand.MoveDown: _layoutControl.MoveSelectionDown(); break; case ElementsCommand.Remove: _layoutControl.DeleteSelected(); break; default: throw new ArgumentOutOfRangeException("command"); } }
public void OnItemClicked(object sender, MenuItemEventArgs e) { _layoutControl.PanMode = false; switch (e.ItemKey) { case LayoutMenuKeys.RestoreToolbars: _view.RestoreToolbars(); break; case LayoutMenuKeys.RestorePanels: _view.RestorePanels(); break; case LayoutMenuKeys.ShowRulers: _layoutControl.ShowRulers = !_layoutControl.ShowRulers; break; case LayoutMenuKeys.AdjustPages: _layoutControl.UpdateLayout(); break; case LayoutMenuKeys.SelectAll: _layoutControl.SelectAll(); break; case LayoutMenuKeys.SelectNone: _layoutControl.ClearSelection(); break; case LayoutMenuKeys.InvertSelection: _layoutControl.InvertSelection(); break; case LayoutMenuKeys.ConvertToBitmap: ConvertElementToBitmap(); break; case LayoutMenuKeys.MoveUp: _layoutControl.MoveSelectionUp(); break; case LayoutMenuKeys.MoveDown: _layoutControl.MoveSelectionDown(); break; case LayoutMenuKeys.DeleteElement: _layoutControl.DeleteSelected(); break; case LayoutMenuKeys.ShowMargins: _layoutControl.ShowMargins = !_layoutControl.ShowMargins; break; case LayoutMenuKeys.ShowPageNumbers: _layoutControl.ShowPageNumbers = !_layoutControl.ShowPageNumbers; break; case LayoutMenuKeys.NewLayout: if (PromptSaveExistingLayout()) { _layoutControl.Filename = string.Empty; _layoutControl.ClearLayout(); } break; case LayoutMenuKeys.SaveLayout: SaveLayout(false); break; case LayoutMenuKeys.SaveLayoutAs: SaveLayout(true); break; case LayoutMenuKeys.LoadLayout: var ls = new LayoutSerializer(); ls.LoadNewLayout(_layoutControl, _context, _view.Model.Extents, _view as IWin32Window); break; case LayoutMenuKeys.Print: { var service = new PrintingService(); service.Print(_layoutControl.Pages, _layoutControl.PrinterSettings, _layoutControl.LayoutElements); } break; case LayoutMenuKeys.PrinterSetup: RunPrinterSetup(); break; case LayoutMenuKeys.PageSetup: RunPageSetup(); break; case LayoutMenuKeys.ExportToPdf: _pdfService.ExportToPdf(_layoutControl, ParentView); break; case LayoutMenuKeys.ExportToBitmap: ExportToBitmap(); break; case LayoutMenuKeys.ZoomIn: _layoutControl.ZoomIn(); break; case LayoutMenuKeys.ZoomOut: _layoutControl.ZoomOut(); break; case LayoutMenuKeys.ZoomFitScreen: _layoutControl.ZoomFitToScreen(); break; case LayoutMenuKeys.ZoomOriginal: _layoutControl.Zoom = 1; break; case LayoutMenuKeys.AddMap: AddMap(); break; case LayoutMenuKeys.AddLegend: AddLegend(); break; case LayoutMenuKeys.AddScaleBar: AddScaleBar(); break; case LayoutMenuKeys.AddNorthArrow: _layoutControl.AddElementWithMouse(new LayoutNorthArrow()); break; case LayoutMenuKeys.AddTable: AddTable(); break; case LayoutMenuKeys.AddLabel: _layoutControl.AddElementWithMouse(new LayoutText()); break; case LayoutMenuKeys.AddRectangle: _layoutControl.AddElementWithMouse(new LayoutRectangle()); break; case LayoutMenuKeys.AddBitmap: AddBitmap(); break; case LayoutMenuKeys.ZoomToMaximum: { var map = SelectedMapElement; if (map != null) { map.ZoomToMaxExtents(); } } break; case LayoutMenuKeys.ZoomToOriginalExtents: { var map = SelectedMapElement; if (map != null) { map.ZooomToOriginalExtents(); } } break; case LayoutMenuKeys.MapZoomIn: { var map = SelectedMapElement; if (map != null) { _layoutControl.ZoomInMap(map); } } break; case LayoutMenuKeys.MapZoomOut: { var map = SelectedMapElement; if (map != null) { _layoutControl.ZoomOutMap(map); } } break; case LayoutMenuKeys.MapPan: { _layoutControl.PanMode = true; } break; } _view.UpdateView(); }