This repository was archived by the owner on Jan 12, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPrinterConfiguration.cs
More file actions
42 lines (35 loc) · 2.17 KB
/
PrinterConfiguration.cs
File metadata and controls
42 lines (35 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace TSVCEO.CloudPrint
{
public class PrinterConfiguration : ConfigurationElement
{
public const string DefaultJobPrinter = "PopplerPostscriptPrinter";
public static readonly Type DefaultJobPrinterType = typeof(Printing.PopplerPostscriptPrinter);
[ConfigurationProperty("name", IsKey = true, IsRequired = true)]
public string Name { get { return (string)base["name"]; } set { base["name"] = value; } }
[ConfigurationProperty("jobPrinter", IsRequired = false, DefaultValue = DefaultJobPrinter)]
public string JobPrinter { get { return (string)base["jobPrinter"]; } set { base["jobPrinter"] = value; } }
}
[ConfigurationCollection(typeof(PrinterConfiguration))]
public class PrinterConfigurationCollection : ConfigurationElementCollection
{
public override ConfigurationElementCollectionType CollectionType { get { return ConfigurationElementCollectionType.BasicMapAlternate; } }
protected override string ElementName { get { return "printer"; } }
protected override bool IsElementName(string elementName) { return elementName == ElementName; }
public override bool IsReadOnly() { return false; }
protected override ConfigurationElement CreateNewElement() { return new PrinterConfiguration(); }
protected override object GetElementKey(ConfigurationElement element) { return ((PrinterConfiguration)element).Name; }
public PrinterConfiguration this[int idx] { get { return (PrinterConfiguration)base.BaseGet(idx); } }
}
public class PrinterConfigurationSection : ConfigurationSection
{
[ConfigurationProperty("defaultJobPrinter", IsRequired = false, DefaultValue = PrinterConfiguration.DefaultJobPrinter)]
public string DefaultJobPrinter { get { return (string)base["defaultJobPrinter"]; } set { base["defaultJobPrinter"] = value; } }
[ConfigurationProperty("printers")]
public PrinterConfigurationCollection Printers { get { return (PrinterConfigurationCollection)base["printers"]; } set { base["printers"] = value; } }
}
}