Ejemplo n.º 1
0
        public static void Save(PrintSettings settings)
        {
            var file = GetConfigFile();

            var s = file.GetSection(SECTION) as PrintSettingsConfigSection;

            Action<PrintSettingsConfigSection> act = (section) =>
                                                         {
                                                             section.FntDescription = settings.FntDescription;
                                                             section.FntTitle = settings.FntTitle;
                                                             section.FntPrice = settings.FntPrice;

                                                             section.PntTitle = settings.PntTitle;
                                                             section.PntDescription = settings.PntDescription;
                                                             section.PntPrice = settings.PntPrice;

                                                             section.PntBarcodeRect = settings.PntBarcodeRect;
                                                             section.SizeBarcodeRect = settings.SizeBarcodeRect;
                                                         };

            if (s == null)
            {
                s = new PrintSettingsConfigSection();
                act(s);

                s.SectionInformation.AllowExeDefinition = ConfigurationAllowExeDefinition.MachineToLocalUser;
                file.Sections.Add(SECTION, s);
            }

            act(s);

            file.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection(file.Sections[SECTION].SectionInformation.Name);
        }
Ejemplo n.º 2
0
        static PrintSettings()
        {
            Defaults = new PrintSettings
                           {
                               FntDescription = new Font("Arial", 6f, FontStyle.Bold),
                               FntTitle = new Font("Arial", 7f, FontStyle.Bold),
                               FntPrice = new Font("Arial", 12f, FontStyle.Bold),

                               PntTitle = new Point {X = 0, Y = 10},
                               PntDescription = new Point {X = 0, Y = 22},
                               PntPrice = new Point {X = 0, Y = 75},

                               PntBarcodeRect = new Point {X = 0, Y = 30},
                               SizeBarcodeRect = new Size(100, 50),
                           };

            Defaults.Init();
        }
Ejemplo n.º 3
0
        public static PrintSettings Load()
        {
            var file = GetConfigFile();

            var s = file.GetSection(SECTION) as PrintSettingsConfigSection;
            if (s == null)
                return PrintSettings.Defaults;

            var result = new PrintSettings
                             {
                                 FntDescription = s.FntDescription,
                                 FntTitle = s.FntTitle,
                                 FntPrice = s.FntPrice,
                                 PntTitle = s.PntTitle,
                                 PntDescription = s.PntDescription,
                                 PntPrice = s.PntPrice,
                                 PntBarcodeRect = s.PntBarcodeRect,
                                 SizeBarcodeRect = s.SizeBarcodeRect
                             };

            return result;
        }