Пример #1
0
        private void InitializeEditor()
        {
            _vm = new EditorViewModel();

            _vm.Editor = new SpiroEditor()
            {
                State      = new EditorState(),
                Measure    = new EditorMeasure(),
                Invalidate = () => canvas.InvalidateVisual(),
                Drawing    = SpiroDrawing.Create(600, 600),
                Data       = new Dictionary <SpiroShape, string>(),
                Knots      = new Dictionary <SpiroShape, IList <SpiroKnot> >()
            };

            _vm.InvalidateCommand = Command.Create(_vm.Editor.Invalidate);
            _vm.NewCommand        = Command.Create(New);
            _vm.OpenCommand       = Command.Create(Open);
            _vm.SaveAsCommand     = Command.Create(SaveAs);
            _vm.ExportCommand     = Command.Create(Export);
            _vm.ExitCommand       = Command.Create(Exit);
            _vm.DeleteCommand     = Command.Create(_vm.Editor.Delete);
            _vm.IsStrokedCommand  = Command.Create(_vm.Editor.ToggleIsStroked);
            _vm.IsFilledCommand   = Command.Create(_vm.Editor.ToggleIsFilled);
            _vm.IsClosedCommand   = Command.Create(_vm.Editor.ToggleIsClosed);
            _vm.IsTaggedCommand   = Command.Create(_vm.Editor.ToggleIsTagged);
            _vm.ToolCommand       = Command <string> .Create(_vm.Editor.ToggleTool);

            _vm.PointTypeCommand = Command <string> .Create(_vm.Editor.TogglePointType);

            _vm.ExecuteScriptCommand = Command <string> .Create(_vm.Editor.ExecuteScript);
        }
Пример #2
0
        public void New()
        {
            var drawing = SpiroDrawing.Create(600, 600);

            _vm.Editor.LoadDrawing(drawing);
        }