Esempio n. 1
0
        private PrinterSettings GetPrinterSettings(string currentPrinterName)
        {
            var key = String.Format("{0}:PrinterSettings", currentPrinterName);

            if (!_cacheHelper.Contains(key))
            {
                _cacheHelper.Add(key, new PrinterSettings {
                    PrinterName = currentPrinterName
                });
            }
            return((PrinterSettings)_cacheHelper.GetData(key));
        }
Esempio n. 2
0
        protected void SetPrinterSettings()
        {
            var key = string.Format("{0}:PrinterSettings", CurrentPrinterName);

            if (!CacheHelper.Contains(key))
            {
                CacheHelper.Add(key, new System.Drawing.Printing.PrinterSettings {
                    PrinterName = CurrentPrinterName
                });
            }
            _printerSettings = (System.Drawing.Printing.PrinterSettings)CacheHelper.GetData(key);
        }
Esempio n. 3
0
        private PaperSize GetDefaultPaperSize()
        {
            var key = string.Format("{0}:DefaultPageSettings", CurrentPrinterName);

            if (!CacheHelper.Contains(key))
            {
                CacheHelper.Add(key, _printerSettings.DefaultPageSettings);
            }
            var pageSettings = (PageSettings)CacheHelper.GetData(key);

            key = string.Format("{0}:PageSize", CurrentPrinterName);
            if (!CacheHelper.Contains(key))
            {
                CacheHelper.Add(key, pageSettings.PaperSize);
            }
            return((PaperSize)CacheHelper.GetData(key));
        }
Esempio n. 4
0
        private IList <PaperSize> GetPaperSizes()
        {
            var Pss = new List <PaperSize>();
            var key = string.Format("{0}:PaperSizes", CurrentPrinterName);

            if (!CacheHelper.Contains(key))
            {
                var pss = _printerSettings.PaperSizes;
                foreach (var ps in pss)
                {
                    if (((PaperSize)ps).PaperName != "Custom")
                    {
                        Pss.Add((PaperSize)ps);
                    }
                }
                CacheHelper.Add(key, _printerSettings.PaperSizes);
            }
            return((IList <PaperSize>)CacheHelper.GetData(key));
        }