Beispiel #1
0
        /// <inheritdoc/>
        public async Task Print(PrintingOptions options, TimeSpan?timeout = null)
        {
            await this.semaphore.WaitAsync().ConfigureAwait(false);

            try
            {
                using (IProcess proc = this.processFactory.Create(UtilPath, options))
                {
                    proc.Start();
                    bool result = await proc
                                  .WaitForExitAsync(timeout ?? PrintTimeout)
                                  .ConfigureAwait(false);

                    if (!result)
                    {
                        proc.Kill();
                    }
                }
            }
            finally
            {
                this.semaphore.Release();
            }
        }
        /// <inheritdoc/>
        public async Task Print(PrintingOptions options, TimeSpan?timeout = null)
        {
            await this.inner.Print(options, timeout);

            this.EnqueuePrintingFile(options.PrinterName, options.FilePath);
        }