private void manager_UpdateInfo(object sender, PrinterEventArgs e)
        {
            PrinterInfo info = e.Info;

            _lastInfo = info;
            UpdateInfo(info);
        }
        public void UpdatePrinterInfo()
        {
            if (Properties.Settings.Default.PrinterType.Equals("Magicard"))
            {
                OnDebug(new DebugEventArgs("", "Updating magicard printer info"));

                try
                {
                    _printerInfo        = magi_api.GetPrinterInfoA();
                    _printerInfo.status = magi_api.GetStatus();
                    OnPrinterUpdate(new PrinterEventArgs(null, "Update", _printerInfo));
                }
                catch (Exception ex)
                {
                    OnDebug(new DebugEventArgs("", "Magicard UpdatePrinterInfo Error: " + ex.Message));
                }
            }
            else
            {
                _printerInfo                   = new PrinterInfo();
                _printerInfo.sModel            = Properties.Settings.Default.LocalPrinter.ToCharArray();
                _printerInfo.bPrinterConnected = true;
                OnPrinterUpdate(new PrinterEventArgs(null, "Update", _printerInfo));
            }
        }
        public PrinterInfo GetPrinterInfoA()
        {
            byte[] rBytes = new byte[501];
            //for a total length of 192

            IntPtr pPrinterInfo = Marshal.AllocHGlobal(500);
            int    res          = GetPrinterInfo(hSession, pPrinterInfo);

            Marshal.Copy(pPrinterInfo, rBytes, 0, 500);
            Marshal.FreeHGlobal(pPrinterInfo);

            if (!(res == ERROR_SUCCESS))
            {
                ThrowException("GetPrinterInfoA", res);
            }

            PrinterInfo pInfo = new PrinterInfo(rBytes);

            pInfo.LastEnduroMessage = this.GetLastEnduroMessage();
            return(pInfo);
        }
        private void UpdateInfo(PrinterInfo p)
        {
            if (tbPrinterStatus.InvokeRequired == false)
            {
                //tbPrinterStatus.Text = (p.bPrinterConnected) ? "Connected" : "Not Connected";
                String printerStatus = "";
                switch (p.status)
                {
                case MagiCardStatus.STATUS_READY:
                    printerStatus = "Ready";
                    break;

                case MagiCardStatus.STATUS_BUSY:
                    printerStatus = "BUSY";
                    break;

                case MagiCardStatus.STATUS_ERROR:
                    printerStatus = "ERROR";
                    break;

                case MagiCardStatus.STATUS_OFFLINE:
                    printerStatus = "Offline";
                    break;

                default:
                    printerStatus = "Unknown";
                    break;
                }
                tbPrinterStatus.Text      = printerStatus;
                tbPrinterName.Text        = new String(p.sModel);
                tbPrinterLastMessage.Text = p.LastEnduroMessage;
            }
            else
            {
                UpdateInfoDelegate updateInfo = new UpdateInfoDelegate(UpdateInfo);
                this.BeginInvoke(updateInfo, new object[] { p });
            }
        }
 public MabelPrinterInfo(PrinterInfo _info)
 {
     model                 = StripString(new String(_info.sModel).TrimEnd('\0'));
     modelId               = _info.eModel;
     connected             = _info.bPrinterConnected;
     printerSerial         = StripString(new String(_info.sPrinterSerial));
     printHeadSerial       = StripString(new String(_info.sPrintheadSerial));
     PCBSerial             = StripString(new String(_info.sPCBSerial));
     firmwareVersion       = StripString(new String(_info.sFirmwareVersion));
     esDensity             = _info.iES_Density;
     handFeed              = _info.iHandFeed;
     cardsPrinted          = _info.iCardsPrinted;
     cardsOnPrintHead      = _info.iCardsOnPrinthead;
     dyePanelsPrinted      = _info.iDyePanelsPrinted;
     cleansSinceShipped    = _info.iCleansSinceShipped;
     dyePanelsSinceCleaned = _info.iDyePanelsSinceClean;
     cardsSinceCleaned     = _info.iCardsSinceClean;
     cardsBetweenCleans    = _info.iCardsBetweenCleans;
     printHeadPosition     = _info.iPrintHeadPosn;
     imageStartPosition    = _info.iImageStartPosn;
     imageEndPosition      = _info.iImageEndPosn;
     tagUID                = StripString(new String(_info.sTagUID));
     shotsOnFilm           = _info.iShotsOnFilm;
     shotsUsed             = _info.iShotsUsed;
     filmType              = StripString(new String(_info.sDyeFilmType));
     colourLength          = _info.iColourLength;
     resinLength           = _info.iResinLength;
     overcoatLength        = _info.iOvercoatLength;
     dyeFlags              = _info.eDyeFlags;
     dob           = _info.iDOB;
     dyeFilmMfrId  = _info.eDyeFilmManuf;
     dyeFilmProgId = _info.eDyeFilmProg;
     if (_info.LastEnduroMessage != null)
     {
         lastMessage = StripString(_info.LastEnduroMessage);
     }
 }
 public PrinterEventArgs(MabelCard _card, String _status, PrinterInfo _info)
 {
     this.Card   = _card;
     this.Status = _status;
     this.Info   = _info;
 }
        // API Functions  //

        /// <summary>
        /// Registers the printer
        /// </summary>
        /// <param name="printerId">The printer ID to register</param>
        /// <param name="printerName">The "name" of the printer (as in windows)</param>
        /// <param name="printerLocation">The location of the printer</param>
        /// <param name="printerModel">The model of the printer</param>
        /// <returns></returns>
        public MabelResponse RegisterPrinter(int printerId, string printerName, string printerLocation, PrinterInfo info)
        {
            MabelResponse response = MakeRequest(
                new MabelRequest(
                    this,
                    "cardPrinter.register",
                    new MabelPrinterRegisterParams(printerId, printerName, printerLocation, new MabelPrinterInfo(info))
                    )
                );

            return(response);
        }
Example #8
0
 public void UpdateInfo(PrinterInfo info)
 {
     this._info = info;
 }
Example #9
0
 public ViewPrinterInfo(PrinterInfo info)
 {
     InitializeComponent();
     _info = info;
 }