public UtilityProvider(DIContainer container, IConfigService configService, IMessageProvider messageProvider) { this.container = container; this.debug = new Lazy <IDebug>(() => DebugFactory.Create(configService), LazyThreadSafetyMode.ExecutionAndPublication); this.instrumentation = new Lazy <IInstrumentation>(() => InstrumentationFactory.Create(configService), LazyThreadSafetyMode.ExecutionAndPublication); this.compression = new Lazy <ICompression>(() => new Compression.Compression(), LazyThreadSafetyMode.ExecutionAndPublication); this.logger = new Lazy <ILogger>(() => LoggerFactory.Create(configService, messageProvider), LazyThreadSafetyMode.ExecutionAndPublication); this.safeBlockProvider = new Lazy <ISafeBlockProvider>(() => new SafeBlockProvider(configService, this.logger.Value), LazyThreadSafetyMode.ExecutionAndPublication); this.defaultSerializer = new Lazy <Serializer>(() => Serializer.Binary, LazyThreadSafetyMode.ExecutionAndPublication); this.printService = new Lazy <IPrintService>(() => PrintServiceFactory.Create(configService, this.logger.Value), LazyThreadSafetyMode.ExecutionAndPublication); this.threadProvider = new Lazy <IThreadPoolFactory>(() => new ThreadPoolFactory(configService), LazyThreadSafetyMode.ExecutionAndPublication); }
private void Button_Click(object sender, RoutedEventArgs e) { var printDialog = new PrintDialog { UserPageRangeEnabled = true, PrintTicket = { PageOrientation = PageOrientation.Portrait } }; printDialog.PrintTicket = printDialog.PrintQueue.UserPrintTicket; printDialog.PrintQueue = LocalPrintServer.GetDefaultPrintQueue(); if (printDialog.ShowDialog().Value) { var xpsVisualPrinter = PrintServiceFactory.CreateXpsVisualPrinter(); xpsVisualPrinter.Print(printDialog.PrintQueue, PrintTarget); } }