Ejemplo n.º 1
0
        public string GetPrinterStatus()
        {
            string reply;
            var    command = PrintCommand.PrinterStatusCommand(this);
            var    sdk     = new EdiSdkWrapper();

            sdk.CallFunc(ref command, out reply);

            XElement el;

            try
            {
                el = XElement.Parse(reply);
            }
            catch
            {
                return(reply);
            }

            var state    = reply;
            var elStatus = el.Element("status");

            if (!ReferenceEquals(elStatus, null))
            {
                state = elStatus.Attribute("value").Value.ToSafeString();
            }
            return(state.ToLower());
        }
Ejemplo n.º 2
0
        public static List <Printer> GetPrinters()
        {
            string reply;
            var    command = PrintCommand.QueryPrintersCommand();
            var    sdk     = new EdiSdkWrapper();

            sdk.CallFunc(ref command, out reply);

            XElement el;

            try
            {
                el = XElement.Parse(reply);
            }
            catch
            {
                return(null);
            }

            var elPrinter = el.Element("printers");

            if (ReferenceEquals(elPrinter, null))
            {
                return(null);
            }

            var rs    = new List <Printer>();
            var nodes = elPrinter.Elements("printer");

            foreach (var n in nodes)
            {
                var pr = new Printer
                {
                    PortNumber   = n.Attribute("port_number").Value,
                    Port         = n.Attribute("port").Value,
                    HardwareType = n.Attribute("hardware_type").Value
                };
                rs.Add(pr);
            }

            return(rs);
        }
Ejemplo n.º 3
0
        public string SetPrinterPosition(string pos)
        {
            string reply;
            var    command = PrintCommand.PositionCardCommand(this, pos);
            var    sdk     = new EdiSdkWrapper();

            sdk.CallFunc(ref command, out reply);

            XElement el;

            try
            {
                el = XElement.Parse(reply);
            }
            catch
            {
                return(reply);
            }

            var state = el.Attribute("accepted").Value.ToSafeString();

            return(state.ToLower());
        }