Exemple #1
0
        public MainWindow()
        {
            InitializeComponent();

            var material = DummyData.GetCustomMaterial();

            var exeDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            var customFontsDir = $@"{exeDir}\CustomFonts\";

            var flyer = new FlyerCreator(customFontsDir).CreateFlyer(material);

            using (var fileStream = new FileStream("SilentFlyer.jpg", FileMode.Create))
            {
                flyer.WriteTo(fileStream);
            }

            Process.Start("SilentFlyer.jpg");
        }
Exemple #2
0
        public static FlyerMakerViewModel CreateFlyerViewModel(Window mainWindow)
        {
            var viewModel = new FlyerMakerViewModel(DummyData.GetDummyMaterials(), DummyData.DefaultSelectedMaterialId,
                GetGetFontFunc(), new FontService(CustomFontsDir), new WindowService(mainWindow));

            var flyerCreator = new FlyerCreator(CustomFontsDir);

            viewModel.FlyerCreated += cm =>
            {
                var flyer = flyerCreator.CreateFlyer(cm);

                using (var fileStream = new FileStream(FlyerTestAppSettings.TestappflyerJpg, FileMode.Create))
                {
                    flyer.WriteTo(fileStream);
                    Process.Start(FlyerTestAppSettings.TestappflyerJpg);
                }
            };
            return viewModel;
        }