private void InitializeContext() { _renderer = new Win2dRenderer(); _context = new T2d.EditorContext() { View = this, Renderers = new T2d.IRenderer[] { _renderer }, ProjectFactory = new T2d.ProjectFactory(), TextClipboard = new TextClipboard(), Serializer = new T2d.NewtonsoftSerializer(), //PdfWriter = new T2d.PdfWriter(), //DxfWriter = new T2d.DxfWriter(), //CsvReader = new T2d.CsvHelperReader(), //CsvWriter = new T2d.CsvHelperWriter() }; _context.InitializeEditor(null/*new T2d.TraceLog()*/); _context.Editor.Renderers[0].State.DrawShapeState.Flags = T2d.ShapeStateFlags.Visible; _context.Editor.GetImageKey = async () => await Task.Run(() => _imagePath); _context.Commands.OpenCommand = T2d.Command<object>.Create( async (parameter) => await OnOpen(), (parameter) => _context.IsEditMode()); _context.Commands.SaveAsCommand = T2d.Command.Create( async () => await OnSaveAs(), () => _context.IsEditMode()); DataContext = _context; }
private void InitializeContext() { _renderer = new Win2dRenderer(); _context = new T2d.EditorContext() { View = this, Renderers = new T2d.IRenderer[] { _renderer }, ProjectFactory = new T2d.ProjectFactory(), TextClipboard = new TextClipboard(), Serializer = new T2d.NewtonsoftSerializer(), //PdfWriter = new T2d.PdfWriter(), //DxfWriter = new T2d.DxfWriter(), //CsvReader = new T2d.CsvHelperReader(), //CsvWriter = new T2d.CsvHelperWriter() }; _context.InitializeEditor(null /*new T2d.TraceLog()*/); _context.Editor.Renderers[0].State.DrawShapeState.Flags = T2d.ShapeStateFlags.Visible; _context.Editor.GetImageKey = async() => await Task.Run(() => _imagePath); _context.Commands.OpenCommand = T2d.Command <object> .Create( async (parameter) => await OnOpen(), (parameter) => _context.IsEditMode()); _context.Commands.SaveAsCommand = T2d.Command.Create( async() => await OnSaveAs(), () => _context.IsEditMode()); DataContext = _context; }
/// <summary> /// /// </summary> private void InitializeContext() { _context = new EditorContext() { View = this, Renderers = new IRenderer[] { new PerspexRenderer() }, ProjectFactory = new ProjectFactory(), TextClipboard = new TextClipboard(), Serializer = new NewtonsoftSerializer(), PdfWriter = new PdfWriter(), DxfWriter = new DxfWriter(), CsvReader = new CsvHelperReader(), CsvWriter = new CsvHelperWriter() }; _context.Renderers[0].State.EnableAutofit = true; _context.InitializeEditor(new TraceLog(), System.IO.Path.Combine(GetAssemblyPath(), _logFileName)); _context.Editor.Renderers[0].State.DrawShapeState.Flags = ShapeStateFlags.Visible; _context.Editor.GetImageKey = async () => await OnGetImageKey(); _context.Commands.OpenCommand = Command<object>.Create( async (parameter) => await OnOpen(parameter), (parameter) => _context.IsEditMode()); _context.Commands.SaveCommand = Command.Create( async () => await OnSave(), () => _context.IsEditMode()); _context.Commands.SaveAsCommand = Command.Create( async () => await OnSaveAs(), () => _context.IsEditMode()); _context.Commands.ExportCommand = Command<object>.Create( async (item) => await OnExport(), (item) => _context.IsEditMode()); _context.Commands.ImportDataCommand = Command<object>.Create( async (item) => await OnImportData(), (item) => _context.IsEditMode()); _context.Commands.ExportDataCommand = Command<object>.Create( async (item) => await OnExportData(), (item) => _context.IsEditMode()); _context.Commands.UpdateDataCommand = Command<object>.Create( async (item) => await OnUpdateData(), (item) => _context.IsEditMode()); _context.Commands.ImportStyleCommand = Command<object>.Create( async (item) => await OnImportObject(item, ImportType.Style), (item) => _context.IsEditMode()); _context.Commands.ImportStylesCommand = Command<object>.Create( async (item) => await OnImportObject(item, ImportType.Styles), (item) => _context.IsEditMode()); _context.Commands.ImportStyleLibraryCommand = Command<object>.Create( async (item) => await OnImportObject(item, ImportType.StyleLibrary), (item) => _context.IsEditMode()); _context.Commands.ImportStyleLibrariesCommand = Command<object>.Create( async (item) => await OnImportObject(item, ImportType.StyleLibraries), (item) => _context.IsEditMode()); _context.Commands.ImportGroupCommand = Command<object>.Create( async (item) => await OnImportObject(item, ImportType.Group), (item) => _context.IsEditMode()); _context.Commands.ImportGroupsCommand = Command<object>.Create( async (item) => await OnImportObject(item, ImportType.Groups), (item) => _context.IsEditMode()); _context.Commands.ImportGroupLibraryCommand = Command<object>.Create( async (item) => await OnImportObject(item, ImportType.GroupLibrary), (item) => _context.IsEditMode()); _context.Commands.ImportGroupLibrariesCommand = Command<object>.Create( async (item) => await OnImportObject(item, ImportType.GroupLibraries), (item) => _context.IsEditMode()); _context.Commands.ImportTemplateCommand = Command<object>.Create( async (item) => await OnImportObject(item, ImportType.Template), (item) => _context.IsEditMode()); _context.Commands.ImportTemplatesCommand = Command<object>.Create( async (item) => await OnImportObject(item, ImportType.Templates), (item) => _context.IsEditMode()); _context.Commands.ExportStyleCommand = Command<object>.Create( async (item) => await OnExportObject(item, ExportType.Style), (item) => _context.IsEditMode()); _context.Commands.ExportStylesCommand = Command<object>.Create( async (item) => await OnExportObject(item, ExportType.Styles), (item) => _context.IsEditMode()); _context.Commands.ExportStyleLibraryCommand = Command<object>.Create( async (item) => await OnExportObject(item, ExportType.StyleLibrary), (item) => _context.IsEditMode()); _context.Commands.ExportStyleLibrariesCommand = Command<object>.Create( async (item) => await OnExportObject(item, ExportType.StyleLibraries), (item) => _context.IsEditMode()); _context.Commands.ExportGroupCommand = Command<object>.Create( async (item) => await OnExportObject(item, ExportType.Group), (item) => _context.IsEditMode()); _context.Commands.ExportGroupsCommand = Command<object>.Create( async (item) => await OnExportObject(item, ExportType.Groups), (item) => _context.IsEditMode()); _context.Commands.ExportGroupLibraryCommand = Command<object>.Create( async (item) => await OnExportObject(item, ExportType.GroupLibrary), (item) => _context.IsEditMode()); _context.Commands.ExportGroupLibrariesCommand = Command<object>.Create( async (item) => await OnExportObject(item, ExportType.GroupLibraries), (item) => _context.IsEditMode()); _context.Commands.ExportTemplateCommand = Command<object>.Create( async (item) => await OnExportObject(item, ExportType.Template), (item) => _context.IsEditMode()); _context.Commands.ExportTemplatesCommand = Command<object>.Create( async (item) => await OnExportObject(item, ExportType.Templates), (item) => _context.IsEditMode()); // TODO: Initialize other commands. if (_enableRecent) { try { var path = System.IO.Path.Combine(GetAssemblyPath(), _recentFileName); if (System.IO.File.Exists(path)) { _context.LoadRecent(path); } } catch (Exception ex) { if (_context.Editor.Log != null) { _context.Editor.Log.LogError("{0}{1}{2}", ex.Message, Environment.NewLine, ex.StackTrace); } } } DataContext = _context; }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="invalidate"></param> public ZoomState(EditorContext context, Action invalidate) { _context = context; _invalidate = invalidate; }
/// <summary> /// /// </summary> /// <param name="context"></param> public ZoomState(EditorContext context) { _context = context; }
/// <summary> /// Initializes a new instance of the Factory class. /// </summary> /// <param name="context"></param> public Factory(EditorContext context) { Context = context; }
/// <summary> /// /// </summary> private void InitializeContext() { this.SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer | ControlStyles.SupportsTransparentBackColor, true); var context = new EditorContext() { View = this, Renderers = new IRenderer[] { new EmfRenderer(72.0 / 96.0) }, ProjectFactory = new ProjectFactory(), TextClipboard = new TextClipboard(), Serializer = new NewtonsoftSerializer(), PdfWriter = new PdfWriter(), DxfWriter = new DxfWriter(), CsvReader = new CsvHelperReader(), CsvWriter = new CsvHelperWriter() }; context.Renderers[0].State.EnableAutofit = true; context.InitializeEditor(new TraceLog(), System.IO.Path.Combine(GetAssemblyPath(), _logFileName)); context.Editor.Renderers[0].State.DrawShapeState.Flags = ShapeStateFlags.Visible; context.Editor.GetImageKey = async () => await GetImageKey(); DataContext = context; }
/// <summary> /// /// </summary> /// <param name="context"></param> private void InitializeCommands(EditorContext context) { context.Commands.OpenCommand = Command<object>.Create( (parameter) => OnOpen(parameter), (parameter) => context.IsEditMode()); context.Commands.SaveCommand = Command.Create( () => OnSave(), () => context.IsEditMode()); context.Commands.SaveAsCommand = Command.Create( () => OnSaveAs(), () => context.IsEditMode()); context.Commands.ExportCommand = Command<object>.Create( (item) => OnExport(item), (item) => context.IsEditMode()); context.Commands.ImportDataCommand = Command<object>.Create( (item) => OnImportData(), (item) => context.IsEditMode()); context.Commands.ExportDataCommand = Command<object>.Create( (item) => OnExportData(), (item) => context.IsEditMode()); context.Commands.UpdateDataCommand = Command<object>.Create( (item) => OnUpdateData(), (item) => context.IsEditMode()); context.Commands.ImportStyleCommand = Command<object>.Create( (item) => OnImportObject(item, ImportType.Style), (item) => context.IsEditMode()); context.Commands.ImportStylesCommand = Command<object>.Create( (item) => OnImportObject(item, ImportType.Styles), (item) => context.IsEditMode()); context.Commands.ImportStyleLibraryCommand = Command<object>.Create( (item) => OnImportObject(item, ImportType.StyleLibrary), (item) => context.IsEditMode()); context.Commands.ImportStyleLibrariesCommand = Command<object>.Create( (item) => OnImportObject(item, ImportType.StyleLibraries), (item) => context.IsEditMode()); context.Commands.ImportGroupCommand = Command<object>.Create( (item) => OnImportObject(item, ImportType.Group), (item) => context.IsEditMode()); context.Commands.ImportGroupsCommand = Command<object>.Create( (item) => OnImportObject(item, ImportType.Groups), (item) => context.IsEditMode()); context.Commands.ImportGroupLibraryCommand = Command<object>.Create( (item) => OnImportObject(item, ImportType.GroupLibrary), (item) => context.IsEditMode()); context.Commands.ImportGroupLibrariesCommand = Command<object>.Create( (item) => OnImportObject(item, ImportType.GroupLibraries), (item) => context.IsEditMode()); context.Commands.ImportTemplateCommand = Command<object>.Create( (item) => OnImportObject(item, ImportType.Template), (item) => context.IsEditMode()); context.Commands.ImportTemplatesCommand = Command<object>.Create( (item) => OnImportObject(item, ImportType.Templates), (item) => context.IsEditMode()); context.Commands.ExportStyleCommand = Command<object>.Create( (item) => OnExportObject(item, ExportType.Style), (item) => context.IsEditMode()); context.Commands.ExportStylesCommand = Command<object>.Create( (item) => OnExportObject(item, ExportType.Styles), (item) => context.IsEditMode()); context.Commands.ExportStyleLibraryCommand = Command<object>.Create( (item) => OnExportObject(item, ExportType.StyleLibrary), (item) => context.IsEditMode()); context.Commands.ExportStyleLibrariesCommand = Command<object>.Create( (item) => OnExportObject(item, ExportType.StyleLibraries), (item) => context.IsEditMode()); context.Commands.ExportGroupCommand = Command<object>.Create( (item) => OnExportObject(item, ExportType.Group), (item) => context.IsEditMode()); context.Commands.ExportGroupsCommand = Command<object>.Create( (item) => OnExportObject(item, ExportType.Groups), (item) => context.IsEditMode()); context.Commands.ExportGroupLibraryCommand = Command<object>.Create( (item) => OnExportObject(item, ExportType.GroupLibrary), (item) => context.IsEditMode()); context.Commands.ExportGroupLibrariesCommand = Command<object>.Create( (item) => OnExportObject(item, ExportType.GroupLibraries), (item) => context.IsEditMode()); context.Commands.ExportTemplateCommand = Command<object>.Create( (item) => OnExportObject(item, ExportType.Template), (item) => context.IsEditMode()); context.Commands.ExportTemplatesCommand = Command<object>.Create( (item) => OnExportObject(item, ExportType.Templates), (item) => context.IsEditMode()); context.Commands.CopyAsEmfCommand = Command.Create( () => OnCopyAsEmf(), () => context.IsEditMode()); context.Commands.ZoomResetCommand = Command.Create( () => OnZoomReset(), () => true); context.Commands.ZoomExtentCommand = Command.Create( () => OnZoomExtent(), () => true); context.Commands.ProjectWindowCommand = Command.Create( () => (_layouts["project"] as LayoutAnchorable).Show(), () => true); context.Commands.OptionsWindowCommand = Command.Create( () => (_layouts["options"] as LayoutAnchorable).Show(), () => true); context.Commands.TemplatesWindowCommand = Command.Create( () => (_layouts["templates"] as LayoutAnchorable).Show(), () => true); context.Commands.GroupsWindowCommand = Command.Create( () => (_layouts["groups"] as LayoutAnchorable).Show(), () => true); context.Commands.DatabasesWindowCommand = Command.Create( () => (_layouts["databases"] as LayoutAnchorable).Show(), () => true); context.Commands.DatabaseWindowCommand = Command.Create( () => (_layouts["database"] as LayoutAnchorable).Show(), () => true); //context.Commands.ContainerWindowCommand = // Command.Create( // () => , // () => true); //context.Commands.DocumentWindowCommand = // Command.Create( // () => , // () => true); context.Commands.StylesWindowCommand = Command.Create( () => (_layouts["styles"] as LayoutAnchorable).Show(), () => true); context.Commands.LayersWindowCommand = Command.Create( () => (_layouts["layers"] as LayoutAnchorable).Show(), () => true); context.Commands.ShapesWindowCommand = Command.Create( () => (_layouts["shapes"] as LayoutAnchorable).Show(), () => true); context.Commands.TemplateWindowCommand = Command.Create( () => (_layouts["template"] as LayoutAnchorable).Show(), () => true); context.Commands.PropertiesWindowCommand = Command.Create( () => (_layouts["properties"] as LayoutAnchorable).Show(), () => true); context.Commands.StateWindowCommand = Command.Create( () => (_layouts["state"] as LayoutAnchorable).Show(), () => true); context.Commands.DataWindowCommand = Command.Create( () => (_layouts["data"] as LayoutAnchorable).Show(), () => true); context.Commands.StyleWindowCommand = Command.Create( () => (_layouts["style"] as LayoutAnchorable).Show(), () => true); context.Commands.LoadWindowLayoutCommand = Command.Create( () => OnLoadLayout(), () => true); context.Commands.SaveWindowLayoutCommand = Command.Create( () => OnSaveLayout(), () => true); context.Commands.ResetWindowLayoutCommand = Command.Create( () => OnResetLayout(), () => true); }
/// <summary> /// /// </summary> private void InitializeContext() { var context = new EditorContext() { View = this, Renderers = new IRenderer[] { new WpfRenderer(), new WpfRenderer() }, ProjectFactory = new ProjectFactory(), TextClipboard = new TextClipboard(), Serializer = new NewtonsoftSerializer(), PdfWriter = new PdfWriter(), DxfWriter = new DxfWriter(), CsvReader = new CsvHelperReader(), CsvWriter = new CsvHelperWriter() }; context.Renderers[0].State.EnableAutofit = true; context.InitializeEditor(new TraceLog(), System.IO.Path.Combine(GetAssemblyPath(), _logFileName)); context.Editor.Renderers[0].State.DrawShapeState.Flags = ShapeStateFlags.Visible; context.Editor.Renderers[1].State.DrawShapeState.Flags = ShapeStateFlags.Visible; context.Editor.GetImageKey = async () => await GetImageKey(); InitializeCommands(context); InitializeZoom(context); InitializeDrop(context); Loaded += (s, e) => { if (_isLoaded) return; else _isLoaded = true; InitializeLayouts(); if (_autoRecent) { AutoLoadRecent(context); } if (_restoreLayout) { AutoLoadLayout(context); } }; Unloaded += (s, e) => { if (!_isLoaded) return; else _isLoaded = false; DeInitializeContext(); if (_autoRecent) { AutoSaveRecent(context); } if (_restoreLayout) { AutoSaveLayout(context); } }; DataContext = context; }
/// <summary> /// Auto save docking manager layout. /// </summary> /// <param name="context"></param> private void AutoSaveLayout(EditorContext context) { try { SaveLayout(_defaultLayoutFileName); } catch (Exception ex) { if (context.Editor.Log != null) { context.Editor.Log.LogError("{0}{1}{2}", ex.Message, Environment.NewLine, ex.StackTrace); } } }
/// <summary> /// Auto load recent project files. /// </summary> /// <param name="context"></param> private void AutoLoadRecent(EditorContext context) { try { LoadRecent(_recentFileName, context); } catch (Exception ex) { if (context.Editor.Log != null) { context.Editor.Log.LogError("{0}{1}{2}", ex.Message, Environment.NewLine, ex.StackTrace); } } }
/// <summary> /// /// </summary> /// <param name="context"></param> private void InitializeDrop(EditorContext context) { containerControl.AllowDrop = true; containerControl.DragEnter += (s, e) => { if (!e.Data.GetDataPresent(DataFormats.FileDrop) && !e.Data.GetDataPresent(typeof(XGroup)) && !e.Data.GetDataPresent(typeof(Record)) && !e.Data.GetDataPresent(typeof(ShapeStyle))) { e.Effects = DragDropEffects.None; e.Handled = true; } }; containerControl.Drop += (s, e) => { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { try { var files = (string[])e.Data.GetData(DataFormats.FileDrop); if (context.Drop(files)) { e.Handled = true; } } catch (Exception ex) { if (context.Editor.Log != null) { context.Editor.Log.LogError("{0}{1}{2}", ex.Message, Environment.NewLine, ex.StackTrace); } } } if (e.Data.GetDataPresent(typeof(XGroup))) { try { var group = e.Data.GetData(typeof(XGroup)) as XGroup; if (group != null) { var p = e.GetPosition(containerControl); context.DropAsClone(group, p.X, p.Y); e.Handled = true; } } catch (Exception ex) { if (context.Editor.Log != null) { context.Editor.Log.LogError("{0}{1}{2}", ex.Message, Environment.NewLine, ex.StackTrace); } } } if (e.Data.GetDataPresent(typeof(Record))) { try { var record = e.Data.GetData(typeof(Record)) as Record; if (record != null) { var p = e.GetPosition(containerControl); context.Drop(record, p.X, p.Y); e.Handled = true; } } catch (Exception ex) { if (context.Editor.Log != null) { context.Editor.Log.LogError("{0}{1}{2}", ex.Message, Environment.NewLine, ex.StackTrace); } } } if (e.Data.GetDataPresent(typeof(ShapeStyle))) { try { var style = e.Data.GetData(typeof(ShapeStyle)) as ShapeStyle; if (style != null) { var p = e.GetPosition(containerControl); context.Drop(style, p.X, p.Y); e.Handled = true; } } catch (Exception ex) { if (context.Editor.Log != null) { context.Editor.Log.LogError("{0}{1}{2}", ex.Message, Environment.NewLine, ex.StackTrace); } } } }; }
/// <summary> /// /// </summary> /// <param name="context"></param> private void InitializeZoom(EditorContext context) { border.InvalidateChild = (z, x, y) => { bool invalidate = context.Editor.Renderers[0].State.Zoom != z; context.Editor.Renderers[0].State.Zoom = z; context.Editor.Renderers[0].State.PanX = x; context.Editor.Renderers[0].State.PanY = y; if (invalidate) { context.InvalidateCache(isZooming: true); } }; border.AutoFitChild = (width, height) => { if (border != null && context != null && context.Editor.Project != null && context.Editor.Project.CurrentContainer != null) { border.AutoFit( width, height, context.Editor.Project.CurrentContainer.Width, context.Editor.Project.CurrentContainer.Height); } }; border.MouseDown += (s, e) => { if (e.ChangedButton == MouseButton.Middle && e.ClickCount == 2) { panAndZoomGrid.AutoFit(); } if (e.ChangedButton == MouseButton.Middle && e.ClickCount == 3) { panAndZoomGrid.ResetZoomAndPan(); } }; }
/// <summary> /// /// </summary> /// <param name="context"></param> public static void InitializeCommonCommands(EditorContext context) { NewCommand = Command<object>.Create( (item) => context.OnNew(item), (item) => context.IsEditMode()); CloseCommand = Command.Create( () => context.OnClose(), () => context.IsEditMode()); ExitCommand = Command.Create( () => context.OnExit(), () => true); UndoCommand = Command.Create( () => context.OnUndo(), () => context.IsEditMode() /* && context.CanUndo() */); RedoCommand = Command.Create( () => context.OnRedo(), () => context.IsEditMode() /* && context.CanRedo() */); CutCommand = Command<object>.Create( (item) => context.OnCut(item), (item) => context.IsEditMode() /* && context.CanCopy() */); CopyCommand = Command<object>.Create( (item) => context.OnCopy(item), (item) => context.IsEditMode() /* && context.CanCopy() */); PasteCommand = Command<object>.Create( (item) => context.OnPaste(item), (item) => context.IsEditMode() /* && context.CanPaste() */); DeleteCommand = Command<object>.Create( (item) => context.OnDelete(item), (item) => context.IsEditMode() /* && context.Editor.IsSelectionAvailable() */); SelectAllCommand = Command.Create( () => context.OnSelectAll(), () => context.IsEditMode()); DeselectAllCommand = Command.Create( () => context.OnDeselectAll(), () => context.IsEditMode()); ClearAllCommand = Command.Create( () => context.OnClearAll(), () => context.IsEditMode()); GroupCommand = Command.Create( () => context.Editor.GroupSelected(), () => context.IsEditMode() /* && context.Editor.IsSelectionAvailable() */); UngroupCommand = Command.Create( () => context.Editor.UngroupSelected(), () => context.IsEditMode() /* && context.Editor.IsSelectionAvailable() */); BringToFrontCommand = Command.Create( () => context.Editor.BringToFrontSelected(), () => context.IsEditMode() /* && context.Editor.IsSelectionAvailable() */); SendToBackCommand = Command.Create( () => context.Editor.SendToBackSelected(), () => context.IsEditMode() /* && context.Editor.IsSelectionAvailable() */); BringForwardCommand = Command.Create( () => context.Editor.BringForwardSelected(), () => context.IsEditMode() /* && context.Editor.IsSelectionAvailable() */); SendBackwardCommand = Command.Create( () => context.Editor.SendBackwardSelected(), () => context.IsEditMode() /* && context.Editor.IsSelectionAvailable() */); MoveUpCommand = Command.Create( () => context.Editor.MoveUpSelected(), () => context.IsEditMode() /* && context.Editor.IsSelectionAvailable() */); MoveDownCommand = Command.Create( () => context.Editor.MoveDownSelected(), () => context.IsEditMode() /* && context.Editor.IsSelectionAvailable() */); MoveLeftCommand = Command.Create( () => context.Editor.MoveLeftSelected(), () => context.IsEditMode() /* && context.Editor.IsSelectionAvailable() */); MoveRightCommand = Command.Create( () => context.Editor.MoveRightSelected(), () => context.IsEditMode() /* && context.Editor.IsSelectionAvailable() */); ToolNoneCommand = Command.Create( () => context.OnToolNone(), () => context.IsEditMode()); ToolSelectionCommand = Command.Create( () => context.OnToolSelection(), () => context.IsEditMode()); ToolPointCommand = Command.Create( () => context.OnToolPoint(), () => context.IsEditMode()); ToolLineCommand = Command.Create( () => context.OnToolLine(), () => context.IsEditMode()); ToolArcCommand = Command.Create( () => context.OnToolArc(), () => context.IsEditMode()); ToolBezierCommand = Command.Create( () => context.OnToolBezier(), () => context.IsEditMode()); ToolQBezierCommand = Command.Create( () => context.OnToolQBezier(), () => context.IsEditMode()); ToolPathCommand = Command.Create( () => context.OnToolPath(), () => context.IsEditMode()); ToolRectangleCommand = Command.Create( () => context.OnToolRectangle(), () => context.IsEditMode()); ToolEllipseCommand = Command.Create( () => context.OnToolEllipse(), () => context.IsEditMode()); ToolTextCommand = Command.Create( () => context.OnToolText(), () => context.IsEditMode()); ToolImageCommand = Command.Create( () => context.OnToolImage(), () => context.IsEditMode()); ToolMoveCommand = Command.Create( () => context.OnToolMove(), () => context.IsEditMode()); DefaultIsStrokedCommand = Command.Create( () => context.OnToggleDefaultIsStroked(), () => context.IsEditMode()); DefaultIsFilledCommand = Command.Create( () => context.OnToggleDefaultIsFilled(), () => context.IsEditMode()); DefaultIsClosedCommand = Command.Create( () => context.OnToggleDefaultIsClosed(), () => context.IsEditMode()); DefaultIsSmoothJoinCommand = Command.Create( () => context.OnToggleDefaultIsSmoothJoin(), () => context.IsEditMode()); SnapToGridCommand = Command.Create( () => context.OnToggleSnapToGrid(), () => context.IsEditMode()); TryToConnectCommand = Command.Create( () => context.OnToggleTryToConnect(), () => context.IsEditMode()); AddDatabaseCommand = Command.Create( () => context.Editor.AddDatabase(), () => context.IsEditMode()); RemoveDatabaseCommand = Command<object>.Create( (db) => context.Editor.RemoveDatabase(db), (db) => context.IsEditMode()); AddColumnCommand = Command<object>.Create( (owner) => context.Editor.AddColumn(owner), (owner) => context.IsEditMode()); RemoveColumnCommand = Command<object>.Create( (parameter) => context.Editor.RemoveColumn(parameter), (parameter) => context.IsEditMode()); AddRecordCommand = Command.Create( () => context.Editor.AddRecord(), () => context.IsEditMode()); RemoveRecordCommand = Command.Create( () => context.Editor.RemoveRecord(), () => context.IsEditMode()); ResetRecordCommand = Command<object>.Create( (owner) => context.Editor.ResetRecord(owner), (owner) => context.IsEditMode()); ApplyRecordCommand = Command<object>.Create( (item) => context.OnApplyRecord(item), (item) => context.IsEditMode()); AddBindingCommand = Command<object>.Create( (owner) => context.Editor.AddBinding(owner), (owner) => context.IsEditMode()); RemoveBindingCommand = Command<object>.Create( (parameter) => context.Editor.RemoveBinding(parameter), (parameter) => context.IsEditMode()); AddPropertyCommand = Command<object>.Create( (owner) => context.Editor.AddProperty(owner), (owner) => context.IsEditMode()); RemovePropertyCommand = Command<object>.Create( (parameter) => context.Editor.RemoveProperty(parameter), (parameter) => context.IsEditMode()); AddGroupLibraryCommand = Command.Create( () => context.Editor.AddGroupLibrary(), () => context.IsEditMode()); RemoveGroupLibraryCommand = Command.Create( () => context.Editor.RemoveCurrentGroupLibrary(), () => context.IsEditMode()); AddGroupCommand = Command.Create( () => context.OnAddGroup(), () => context.IsEditMode()); RemoveGroupCommand = Command.Create( () => context.OnRemoveGroup(), () => context.IsEditMode()); AddLayerCommand = Command.Create( () => context.Editor.AddLayer(), () => context.IsEditMode()); RemoveLayerCommand = Command.Create( () => context.Editor.RemoveCurrentLayer(), () => context.IsEditMode()); AddStyleLibraryCommand = Command.Create( () => context.Editor.AddStyleLibrary(), () => context.IsEditMode()); RemoveStyleLibraryCommand = Command.Create( () => context.Editor.RemoveCurrentStyleLibrary(), () => context.IsEditMode()); AddStyleCommand = Command.Create( () => context.Editor.AddStyle(), () => context.IsEditMode()); RemoveStyleCommand = Command.Create( () => context.Editor.RemoveCurrentStyle(), () => context.IsEditMode()); ApplyStyleCommand = Command<object>.Create( (item) => context.OnApplyStyle(item), (item) => context.IsEditMode()); RemoveShapeCommand = Command.Create( () => context.Editor.RemoveCurrentShape(), () => context.IsEditMode()); AddTemplateCommand = Command.Create( () => context.OnAddTemplate(), () => context.IsEditMode()); RemoveTemplateCommand = Command.Create( () => context.OnRemoveTemplate(), () => context.IsEditMode()); AddImageKeyCommand = Command.Create( async () => await context.Editor.AddImageKey(null), () => context.IsEditMode()); RemoveImageKeyCommand = Command<object>.Create( (parameter) => context.Editor.RemoveImageKey(parameter), (parameter) => context.IsEditMode()); EditTemplateCommand = Command.Create( () => context.OnEditTemplate(), () => context.IsEditMode()); ApplyTemplateCommand = Command<object>.Create( (item) => context.OnApplyTemplate(item), (item) => true); SelectedItemChangedCommand = Command<object>.Create( (item) => context.OnSelectedItemChanged(item), (item) => context.IsEditMode()); AddContainerCommand = Command<object>.Create( (item) => context.OnAddContainer(item), (item) => context.IsEditMode()); InsertContainerBeforeCommand = Command<object>.Create( (item) => context.OnInsertContainerBefore(item), (item) => context.IsEditMode()); InsertContainerAfterCommand = Command<object>.Create( (item) => context.OnInsertContainerAfter(item), (item) => context.IsEditMode()); AddDocumentCommand = Command<object>.Create( (item) => context.OnAddDocument(item), (item) => context.IsEditMode()); InsertDocumentBeforeCommand = Command<object>.Create( (item) => context.OnInsertDocumentBefore(item), (item) => context.IsEditMode()); InsertDocumentAfterCommand = Command<object>.Create( (item) => context.OnInsertDocumentAfter(item), (item) => context.IsEditMode()); }