Пример #1
0
        internal IPrintManagerProvider GetPrintManager(string key, PrintMode printMode)
        {
            IPrintManagerProvider provider = null;
            Dictionary <PrintMode, IPrintManagerProvider> printManagerProvider;

            if (false == this.printManagerProviderDictionary.TryGetValue(key, out printManagerProvider))
            {
                printManagerProvider = this.printManagerProviderDictionary["DEFAULT"];
            }

            if (false == printManagerProvider.TryGetValue(printMode, out provider))
            {
                throw new NotImplementedException("Print Manager provider for key= '" + key + "' and Print Mode '" + printMode + "' not implemented. Check configuration");
            }

            return(provider);
        }
Пример #2
0
        public IPrintResult Print(IPrintData printData)
        {
            if (printData == null)
            {
                throw new ArgumentNullException("printData", "Print Data supplied is null");
            }

            if (printData.Settings == null)
            {
                throw new ArgumentNullException("printData.Settings", "Printer Settings supplied is null");
            }

            if (printData.PrintJobIInfo == null)
            {
                throw new ArgumentNullException("printData.PrintJobInfo", "Print Job Id is Null");
            }

            IPrintManagerProvider provider = this.factory.GetPrintManager(printData.PrintJobIInfo.Key, PrintMode.Sync);

            return(provider.Print(printData));
        }
Пример #3
0
        public void PrintAsync(IPrintData printData, Action <IPrintSuccessResult> onPrintSuccess = null, Action <IPrintErrorResult> onPrintFailure = null)
        {
            if (printData == null)
            {
                throw new ArgumentNullException("printData", "Print Data supplied is null");
            }

            if (printData.Settings == null)
            {
                throw new ArgumentNullException("printData.Settings", "Printer Settings supplied is null");
            }

            if (printData.PrintJobIInfo == null)
            {
                throw new ArgumentNullException("printData.PrintJobInfo", "Print Job Id is Null");
            }

            PrintResponse         response = new PrintResponse(printData.PrintJobIInfo, onPrintSuccess, onPrintFailure);
            IPrintManagerProvider provider = this.factory.GetPrintManager(printData.PrintJobIInfo.Key, PrintMode.Async);

            this.printResponseDictionary[printData.PrintJobIInfo] = response;
            provider.Print(printData);
        }