示例#1
0
        /// <summary>
        ///
        /// </summary>
        private void InitializeContext()
        {
            _context = new Core2D.EditorContext()
            {
                View           = this,
                Renderers      = new Core2D.IRenderer[] { new EtoRenderer(72.0 / 96.0) },
                ProjectFactory = new Core2D.ProjectFactory(),
                TextClipboard  = new TextClipboard(),
                Serializer     = new Core2D.NewtonsoftSerializer(),
                PdfWriter      = new Core2D.PdfWriter(),
                DxfWriter      = new Core2D.DxfWriter(),
                CsvReader      = new Core2D.CsvHelperReader(),
                CsvWriter      = new Core2D.CsvHelperWriter()
            };

            _context.Renderers[0].State.EnableAutofit = true;
            _context.InitializeEditor(new Core2D.TraceLog(), System.IO.Path.Combine(GetAssemblyPath(), _logFileName));
            _context.Editor.Renderers[0].State.DrawShapeState.Flags = Core2D.ShapeStateFlags.Visible;
            _context.Editor.GetImageKey = async() => await GetImageKey();

            _context.Invalidate = this.UpdateAndInvalidate;

            _state = new Core2D.ZoomState(_context, this.UpdateAndInvalidate);

            DataContext = _context;
        }
示例#2
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;
        }
示例#3
0
        /// <summary>
        /// 
        /// </summary>
        private void InitializeContext()
        {
            _context = new Core2D.EditorContext()
            {
                View = this,
                Renderers = new Core2D.IRenderer[] { new EtoRenderer(72.0 / 96.0) },
                ProjectFactory = new Core2D.ProjectFactory(),
                TextClipboard = new TextClipboard(),
                Serializer = new Core2D.NewtonsoftSerializer(),
                PdfWriter = new Core2D.PdfWriter(),
                DxfWriter = new Core2D.DxfWriter(),
                CsvReader = new Core2D.CsvHelperReader(),
                CsvWriter = new Core2D.CsvHelperWriter()
            };

            _context.Renderers[0].State.EnableAutofit = true;
            _context.InitializeEditor(new Core2D.TraceLog(), System.IO.Path.Combine(GetAssemblyPath(), _logFileName));
            _context.Editor.Renderers[0].State.DrawShapeState.Flags = Core2D.ShapeStateFlags.Visible;
            _context.Editor.GetImageKey = async () => await GetImageKey();

            _context.Invalidate = this.UpdateAndInvalidate;

            _state = new Core2D.ZoomState(_context, this.UpdateAndInvalidate);

            DataContext = _context;
        }