예제 #1
0
        public static void setDefaultThermalPrinter(string printerName)
        {
            Impresora            pr         = new Impresora(printerName);
            InformacionImpresora info       = new InformacionImpresora(pr);
            XmlSerializer        serializer = new XmlSerializer(typeof(InformacionImpresora));
            TextWriter           textWriter = new StreamWriter(Application.StartupPath + "\\pc.xml");

            serializer.Serialize(textWriter, info);
            textWriter.Close();
        }
예제 #2
0
        public static string getPriterName()
        {
            Impresora            name = new Impresora(" ");
            InformacionImpresora ip;

            if (File.Exists(Application.StartupPath + "\\pc.xml"))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(InformacionImpresora));
                FileStream    fs         = new FileStream(Application.StartupPath + "\\pc.xml", FileMode.Open);
                TextReader    textReader = new StreamReader(fs);
                ip = (InformacionImpresora)serializer.Deserialize(textReader);
                fs.Close();
                name.Nombre = ip.Printer.Nombre;
            }
            return(name.Nombre);
        }
 public InformacionImpresora(Impresora printer)
 {
     Printer = printer;
 }