Beispiel #1
0
        /// <inheritdoc/>
        public override void Run(object item)
        {
            var editor = ServiceProvider.GetService <ProjectEditor>();
            var page   = editor.Project?.CurrentContainer;

            if (page != null)
            {
                if (editor.Renderers[0]?.State?.SelectedShape != null)
                {
                    var shapes = Enumerable.Repeat(editor.Renderers[0].State.SelectedShape, 1).ToList();
                    EmfWriter.SetClipboard(
                        shapes,
                        page.Template.Width,
                        page.Template.Height,
                        page.Data.Properties,
                        page.Data.Record,
                        editor.Project);
                }
                else if (editor.Renderers?[0]?.State?.SelectedShapes != null)
                {
                    var shapes = editor.Renderers[0].State.SelectedShapes.ToList();
                    EmfWriter.SetClipboard(
                        shapes,
                        page.Template.Width,
                        page.Template.Height,
                        page.Data.Properties,
                        page.Data.Record,
                        editor.Project);
                }
                else
                {
                    EmfWriter.SetClipboard(page, editor.Project);
                }
            }
        }
Beispiel #2
0
        /// <inheritdoc/>
        public void OnCopyAsEmf(object item)
        {
            var editor = _serviceProvider.GetService <ProjectEditor>();
            var page   = editor.Project?.CurrentContainer;

            var dataFlow = _serviceProvider.GetService <IDataFlow>();
            var db       = (object)page.Data.Properties;
            var record   = (object)page.Data.Record;

            dataFlow.Bind(page.Template, db, record);
            dataFlow.Bind(page, db, record);

            if (page != null && editor.Project is IImageCache imageChache)
            {
                if (editor.Renderers[0]?.State?.SelectedShape != null)
                {
                    var shapes = Enumerable.Repeat(editor.Renderers[0].State.SelectedShape, 1).ToList();
                    var writer = new EmfWriter(_serviceProvider);
                    writer.SetClipboard(
                        shapes,
                        page.Template.Width,
                        page.Template.Height,
                        imageChache);
                }
                else if (editor.Renderers?[0]?.State?.SelectedShapes != null)
                {
                    var shapes = editor.Renderers[0].State.SelectedShapes.ToList();
                    var writer = new EmfWriter(_serviceProvider);
                    writer.SetClipboard(
                        shapes,
                        page.Template.Width,
                        page.Template.Height,
                        imageChache);
                }
                else
                {
                    var writer = new EmfWriter(_serviceProvider);
                    writer.SetClipboard(page, imageChache);
                }
            }
        }
        /// <inheritdoc/>
        public void OnCopyAsEmf(object item)
        {
#if NET461 && _WINDOWS
            var editor = _serviceProvider.GetService <ProjectEditor>();
            var page   = editor.Project?.CurrentContainer;
            if (page != null)
            {
                if (editor.Renderers[0]?.State?.SelectedShape != null)
                {
                    var shapes = Enumerable.Repeat(editor.Renderers[0].State.SelectedShape, 1).ToList();
                    var writer = new EmfWriter(_serviceProvider);
                    writer.SetClipboard(
                        shapes,
                        page.Template.Width,
                        page.Template.Height,
                        page.Data.Properties,
                        page.Data.Record,
                        editor.Project as IImageCache);
                }
                else if (editor.Renderers?[0]?.State?.SelectedShapes != null)
                {
                    var shapes = editor.Renderers[0].State.SelectedShapes.ToList();
                    var writer = new EmfWriter(_serviceProvider);
                    writer.SetClipboard(
                        shapes,
                        page.Template.Width,
                        page.Template.Height,
                        page.Data.Properties,
                        page.Data.Record,
                        editor.Project as IImageCache);
                }
                else
                {
                    var writer = new EmfWriter(_serviceProvider);
                    writer.SetClipboard(page, editor.Project as IImageCache);
                }
            }
#else
            throw new NotImplementedException("Not implemented for this platform.");
#endif
        }
Beispiel #4
0
        /// <inheritdoc/>
        async Task IEditorApplication.OnCopyAsEmfAsync()
        {
            var page = _editor?.Project?.CurrentContainer;

            if (page != null)
            {
                if (_editor?.Renderers[0]?.State?.SelectedShape != null)
                {
                    var shapes = Enumerable.Repeat(_editor.Renderers[0].State.SelectedShape, 1).ToList();
                    EmfWriter.SetClipboard(
                        shapes,
                        page.Template.Width,
                        page.Template.Height,
                        page.Data.Properties,
                        page.Data.Record,
                        _editor.Project);
                }
                else if (_editor?.Renderers?[0]?.State?.SelectedShapes != null)
                {
                    var shapes = _editor.Renderers[0].State.SelectedShapes.ToList();
                    EmfWriter.SetClipboard(
                        shapes,
                        page.Template.Width,
                        page.Template.Height,
                        page.Data.Properties,
                        page.Data.Record,
                        _editor.Project);
                }
                else
                {
                    EmfWriter.SetClipboard(page, _editor.Project);
                }
            }

            await Task.Delay(0);
        }