Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 
        /// </summary>
        private void InitializeContext()
        {
            _renderer = new Win2dRenderer();

            _context = new Core2D.EditorContext()
            {
                View = this,
                Renderers = new Core2D.IRenderer[] { _renderer },
                ProjectFactory = new Core2D.ProjectFactory(),
                TextClipboard = new TextClipboard(),
                Serializer = new Dependencies.NewtonsoftSerializer(),
                //PdfWriter = new Dependencies.PdfWriter(),
                //DxfWriter = new Dependencies.DxfWriter(),
                //CsvReader = new Dependencies.CsvHelperReader(),
                //CsvWriter = new Dependencies.CsvHelperWriter()
            };

            _context.Renderers[0].State.EnableAutofit = true;
            _context.InitializeEditor(null/*new Dependencies.TraceLog()*/);
            _context.Editor.Renderers[0].State.DrawShapeState.Flags = Core2D.ShapeStateFlags.Visible;
            _context.Editor.GetImageKey = async () => await Task.Run(() => _imagePath);
            _context.Editor.Invalidate = () => canvas.Invalidate();

            Core2D.Commands.InitializeCommonCommands(_context);

            Core2D.Commands.OpenCommand =
                Core2D.Command<object>.Create(
                    async (parameter) => await OnOpen(),
                    (parameter) => _context.IsEditMode());

            Core2D.Commands.SaveAsCommand =
                Core2D.Command.Create(
                    async () => await OnSaveAs(),
                    () => _context.IsEditMode());

            _state = new Core2D.ZoomState(_context.Editor);

            DataContext = _context;
        }