Example #1
0
        public void ExportAsImageImpl(ConceptUsecase useCase)
        {
            var currentDisplay = useCase.GetCurrentDisplay();

            if (currentDisplay != null && currentDisplay.Data != null)
            {
                var saveFileDialog = new FileDialogMemento {
                    DefaultExt = "png",
                    Filter     = "PNG-Image|*.png|All Files|*.*",
                };

                if (useCase.FileDialogShow(saveFileDialog, false) == DialogResult.Ok)
                {
                    var image =
                        new ImageExporter(currentDisplay.Data, currentDisplay.Layout)
                    {
                        StyleSheet = currentDisplay.StyleSheet
                    }
                    .ExportImage();
                    if (image != null)
                    {
                        image.Save(saveFileDialog.FileName, ImageFileType.Png);
                        image.Dispose();
                    }
                }
            }
        }