Beispiel #1
0
        private void SigPlusNET1_PenUp(object sender, EventArgs e)
        {
            if (SigPlusNET1.KeyPadQueryHotSpot(1) > 0)
            {
                //OK
                if (SigPlusNET1.NumberOfTabletPoints() > 0)
                {
                    // strSig = SigPlusNET1.GetSigString() 'strSig now holds signature
                    SigPlusNET1.LCDRefresh(0, 0, 0, 640, 480);
                    //Clears entire LCD screen
                    Font thankyou = default(Font);
                    thankyou = new System.Drawing.Font("Arial", 16f, System.Drawing.FontStyle.Regular);
                    SigPlusNET1.SetTabletState(1);
                    SigPlusNET1.LCDWriteString(0, 2, 4, 40, thankyou, "Thank You For Signing!");
                    //Greeting after signing

                    //SigPlusNET1.LCDSendGraphic(0, 2, 58, 90, topazlogo)
                    SigPlusNET1.SetTabletState(0);
                    //turn off tablet to use justification below
                    SigPlusNET1.SetJustifyMode(5);
                    //this will zoom signature & justify to center
                    //Dim s = SigPlusNET1.GetSigString()

                    SigPlusNET1.SetImageXSize(10);
                    SigPlusNET1.SetImageYSize(10);

                    pictureBox1.Image = SigPlusNET1.GetSigImage();
                    btnAccept.Enabled = true;
                    SigPlusNET1.SendToBack();
                }
            }

            if (SigPlusNET1.KeyPadQueryHotSpot(0) > 0)
            {
                //CLEAR
            }
        }
Beispiel #2
0
        private void btnGetSignature_Click(object sender, EventArgs e)
        {
            try
            {
                SigPlusNET1.SetTabletComTest(1);
                SigPlusNET1.SetTabletState(1);
                //open port, turn tablet on

                while ((!SigPlusNET1.TabletConnectQuery() || SigPlusNET1.GetTabletState() != 1))
                {
                    if (MessageBox.Show("Cannot locate signature pad. Please make sure it is connected.", "Cannot locate signature pad", System.Windows.Forms.MessageBoxButtons.RetryCancel, System.Windows.Forms.MessageBoxIcon.Exclamation) == DialogResult.Cancel)
                    {
                        //Continue, turn off test
                        SigPlusNET1.SetTabletComTest(0);
                        return;
                    }
                    else
                    {
                        //Max 08/31/2016 - We must reset the TabletCom and TabletState to zero which is the original state before retryning setting it to 1
                        SigPlusNET1.SetTabletComTest(0);
                        SigPlusNET1.SetTabletState(0);

                        SigPlusNET1.SetTabletComTest(1);
                        SigPlusNET1.SetTabletState(1);
                        //open port, turn tablet on
                        SigPlusNET1.ClearTablet();
                        //Clears the SigPlus object of ink
                    }
                }

                //Continue, turn off test
                SigPlusNET1.SetTabletComTest(0);
                SigPlusNET1.ClearTablet();
                //Clears the SigPlus object of ink

                btnGetSignature.Enabled = false;

                if (pictureBox1.Image != null)
                {
                    pictureBox1.Image.Dispose();
                    pictureBox1.Image = null;
                }

                btnAccept.Enabled = false;
                SigPlusNET1.BringToFront();
                this.Refresh();

                if (this.miSigPadWidth == 640)
                {
                    //******************************************************************'
                    // The following parameters are set in case the user's INI file is not correctly set up for an LCD 4X3 tablet
                    // Otherwise, if the INI is correctly set up, these parameters do not need to be set

                    SigPlusNET1.SetTabletXStart(300);
                    SigPlusNET1.SetTabletXStop(2370);
                    SigPlusNET1.SetTabletYStart(350);
                    SigPlusNET1.SetTabletYStop(1950);
                    SigPlusNET1.SetTabletLogicalXSize(2070);
                    SigPlusNET1.SetTabletLogicalYSize(1600);

                    SigPlusNET1.LCDSetWindow(0, 0, 1, 1);
                    //Prohibit inking on entire LCD
                    SigPlusNET1.SetSigWindow(1, 0, 0, 1, 1);
                    //Prohibit inking in SigPlus
                    SigPlusNET1.LCDRefresh(0, 0, 0, 640, 480);
                    //Refresh entire tablet


                    SigPlusNET1.SetLCDCaptureMode(2);


                    //Dim bmSignHere As New Bitmap(mbmsignhere)
                    //Dim myGR As Graphics = Graphics.FromImage(bmSignHere)
                    //Dim drawFont As Font = New System.Drawing.Font("Arial", 16.0F, System.Drawing.FontStyle.Bold)
                    //Dim drawBrush As New SolidBrush(Color.Black)
                    //Dim drawPoint As New PointF(0.0F, 0.0F)
                    //myGR.DrawString(msInfoLabel, drawFont, drawBrush, drawPoint)

                    SigPlusNET1.LCDSetPixelDepth(8);

                    SigPlusNET1.LCDSendGraphic(0, 2, 0, 0, mbmsignhere);
                    //this BMP is loaded into background

                    //SigPlusNET1.LCDRefresh(2, 0, 0, 240, 128) 'sets the BMP in the background
                    //to the foreground--note the initial argument 2

                    //Harish Ramakrishnan 05/15/2010
                    SigPlusNET1.LCDSetPixelDepth(0);
                    SigPlusNET1.LCDWriteString(0, 2, 0, 430, _sigFont, msInfoLabel);

                    SigPlusNET1.LCDSetPixelDepth(8);
                    Bitmap   objBitmap  = new Bitmap(640, 2);
                    Graphics objGraphic = Graphics.FromImage(objBitmap);
                    Pen      blackPen   = new Pen(Color.Black, 1);
                    objGraphic.DrawLine(blackPen, new Point(5, 1), new Point(630, 195));
                    SigPlusNET1.LCDSendGraphic(1, 2, 0, 428, objBitmap);
                    SigPlusNET1.LCDRefresh(2, 0, 428, 640, 2);
                    SigPlusNET1.LCDSetPixelDepth(0);

                    SigPlusNET1.LCDWriteString(0, 2, 20, 290, _sigFont, "CLEAR");
                    SigPlusNET1.LCDWriteString(0, 2, 400, 290, _sigFont, "OK");

                    SigPlusNET1.KeyPadAddHotSpot(0, 1, 0, 280, 150, 30);
                    SigPlusNET1.KeyPadAddHotSpot(1, 1, 350, 280, 100, 30);

                    //Dim label As Font
                    //label = New System.Drawing.Font("Arial", 16.0F, System.Drawing.FontStyle.Regular)
                    //SigPlusNET1.SetTabletState(1)
                    //SigPlusNET1.LCDWriteString(0, 2, 4, 0, label, msInfoLabel)
                    SigPlusNET1.LCDRefresh(2, 0, 313, 640, 115);
                    SigPlusNET1.LCDSetWindow(0, 313, 640, 115);
                    SigPlusNET1.SetSigWindow(1, 0, 313, 640, 115);
                    //SigPlusNET1.LCDSetWindow(0, 74, 240, 54) 'Permits only the section on LCD
                    //to display ink
                    //SigPlusNET1.SetSigWindow(1, 0, 68, 240, 60)
                    //specifies area in sigplus object to accept ink
                }
                else
                {
                    throw new Exception("Signature pad resolution is not supported");
                }

                //Timer1.Enabled = true;
            }
            catch (Exception ex)
            {
                Logger.LogError("Error reading the signature image from SigPlusNET", ex);
            }
        }
Beispiel #3
0
        private void DigSignature_Load(object sender, EventArgs e)
        {
            counter = 1;
            Font f = new System.Drawing.Font("Arial", 9.0F, System.Drawing.FontStyle.Regular);

            string[] s;
            s = strKeyData.Split('|');
            switch (strTransaction)
            {
            case "ServiceUtilisation":
                data = "Dear member " + s[0] + ", please read and confirm the service(s) utilised before sign";
                if (dtServiceUtilisationTable != null)
                {
                    maxScreen = dtServiceUtilisationTable.Rows.Count;
                }
                break;

            case "CreditUtilisation":
                data = "Dear member " + s[0] + ", please read and confirm the credit(s) utilised before sign";
                if (dtCreditPackageUsageTable != null)
                {
                    if (dtCreditPackageUsageTable.Rows.Count > 0)
                    {
                        maxScreen = dtCreditPackageUsageTable.Rows.Count;
                    }
                    else
                    {
                        if (drCrPktUsageTable != null)
                        {
                            if (drCrPktUsageTable.GetLength(0) > 0)
                            {
                                maxScreen = drCrPktUsageTable.GetLength(0);
                            }
                        }
                    }
                }
                else
                {
                    if (drCrPktUsageTable != null)
                    {
                        if (drCrPktUsageTable.GetLength(0) > 0)
                        {
                            maxScreen = drCrPktUsageTable.GetLength(0);
                        }
                    }
                }
                break;

            case "Redemption":
                data      = "Dear member " + s[2] + ", please read and confirm the redemption(s) details before sign";
                maxScreen = 1;
                break;
            }

            SigPlusNET1.SetTabletState(1);
            SigPlusNET1.SetImagePenWidth(8);
            SigPlusNET1.SetDisplayPenWidth(8);
            SigPlusNET1.LCDRefresh(0, 0, 0, 240, 64);
            SigPlusNET1.SetTranslateBitmapEnable(false);

            //Images sent to the background
            SigPlusNET1.LCDSendGraphic(1, 2, 0, 20, sign);
            SigPlusNET1.LCDSendGraphic(1, 2, 207, 4, ok);
            SigPlusNET1.LCDSendGraphic(1, 2, 15, 4, clear);

            //Get LCD size in pixels.
            lcdSize = SigPlusNET1.LCDGetLCDSize();
            lcdX    = (int)(lcdSize & 0xFFFF);
            lcdY    = (int)((lcdSize >> 16) & 0xFFFF);

            string[] words = data.Split(new char[] { ' ' });
            string   writeData = "", tempData = "";

            int xSize, ySize, i, yPos = 0;

            for (i = 0; i < words.Length; i++)
            {
                tempData += words[i];

                xSize = SigPlusNET1.LCDStringWidth(f, tempData);

                if (xSize < lcdX)
                {
                    writeData = tempData;
                    tempData += " ";

                    xSize = SigPlusNET1.LCDStringWidth(f, tempData);

                    if (xSize < lcdX)
                    {
                        writeData = tempData;
                    }
                }
                else
                {
                    ySize = SigPlusNET1.LCDStringHeight(f, tempData);

                    SigPlusNET1.LCDWriteString(0, 2, 0, yPos, f, writeData);

                    tempData  = "";
                    writeData = "";
                    yPos     += (short)ySize;
                    i--;
                }
            }

            if (writeData != "")
            {
                SigPlusNET1.LCDWriteString(0, 2, 0, yPos, f, writeData);
            }

            //Hotspot text
            SigPlusNET1.LCDWriteString(0, 2, 15, 45, f, "Continue");

            //Create the hot spots for the Continue button
            SigPlusNET1.KeyPadAddHotSpot(0, 1, 12, 40, 40, 15); //For Continue button

            SigPlusNET1.ClearTablet();

            SigPlusNET1.LCDSetWindow(0, 0, 1, 1);
            SigPlusNET1.SetSigWindow(1, 0, 0, 1, 1); //Sets the area where ink is permitted in the SigPlus object
            SigPlusNET1.SetLCDCaptureMode(2);        //Sets mode so ink will not disappear after a few seconds

            screen = 0;
        }
        private void SigPlusNET1_PenUp(object sender, EventArgs e)
        {
            if (SigPlusNET1.KeyPadQueryHotSpot(1) > 0)
            {
                //OK
                if (SigPlusNET1.NumberOfTabletPoints() > 0)
                {
                    Focus();
                    // strSig = SigPlusNET1.GetSigString() 'strSig now holds signature
                    SigPlusNET1.LCDRefresh(0, 0, 0, 640, 480);
                    //Clears entire LCD screen
                    Font thankyou = default(Font);
                    thankyou = new System.Drawing.Font("Arial", 16f, System.Drawing.FontStyle.Regular);

                    if (SigPlusNET1.GetTabletState() != 1)
                    {
                        SigPlusNET1.SetTabletState(1);
                    }

                    SigPlusNET1.LCDWriteString(0, 2, 4, 40, thankyou, "Thank You For Signing!");
                    //Greeting after signing

                    //SigPlusNET1.LCDSendGraphic(0, 2, 58, 90, topazlogo)
                    if (SigPlusNET1.GetTabletState() != 0)
                    {
                        SigPlusNET1.SetTabletState(0);
                    }
                    //turn off tablet to use justification below
                    SigPlusNET1.SetJustifyMode(5);

                    //this will zoom signature & justify to center
                    SigPlusNET1.SetImageXSize(SIG_WIDTH);
                    SigPlusNET1.SetImageYSize(SIG_HEIGHT);

                    _signatureImage = SigPlusNET1.GetSigImage();

                    SigPlusNET1.SendToBack();

                    btnAccept.Enabled       = true;
                    btnGetSignature.Enabled = true;
                }
                return;
            }

            if (SigPlusNET1.KeyPadQueryHotSpot(0) > 0)
            {
                this.TopLevel = true;
                this.TopMost  = true;

                //CLEAR
                SigPlusNET1.ClearSigWindow(1);
                SigPlusNET1.ClearTablet();
                SigPlusNET1.LCDRefresh(1, 0, 280, 150, 30);
                Thread.Sleep(250);
                SigPlusNET1.LCDRefresh(2, 0, 313, 640, 115);
                SigPlusNET1.LCDRefresh(1, 0, 280, 150, 30);

                if (SigPlusNET1.GetTabletState() != 1)
                {
                    SigPlusNET1.SetTabletState(1);
                }

                return;
            }
        }
Beispiel #5
0
        private void SigPlusNET1_PenUp(object sender, EventArgs e)
        {
            string strSig;

            if (SigPlusNET1.KeyPadQueryHotSpot(0) > 0)//If the Continue hotspot is tapped, then...
            {
                if (screen >= 0 && screen < maxScreen)
                {
                    Font     f     = new System.Drawing.Font("Arial", 9.0F, System.Drawing.FontStyle.Regular);
                    string   data2 = "";
                    string[] words;
                    string   writeData, tempData;
                    int      xSize, ySize, i, yPos;

                    SigPlusNET1.ClearSigWindow(1);
                    SigPlusNET1.LCDRefresh(1, 16, 45, 50, 15); //Refresh LCD at 'Continue' to indicate to user that this option has been sucessfully chosen
                    SigPlusNET1.ClearTablet();
                    SigPlusNET1.LCDRefresh(0, 0, 0, 240, 64);
                    string[] s;
                    s = strKeyData.Split('|');
                    switch (strTransaction)
                    {
                    case "ServiceUtilisation":
                        if (dtServiceUtilisationTable.Columns.Contains("strDescription"))
                        {
                            data2 = dtServiceUtilisationTable.Rows[screen]["strDescription"].ToString() + " Qty: " + dtServiceUtilisationTable.Rows[screen]["Quantity"].ToString() + " Bal: " + dtServiceUtilisationTable.Rows[screen]["nBalance"].ToString();
                        }
                        else
                        {
                            data2 = dtServiceUtilisationTable.Rows[screen]["PackageDesc"].ToString() + " Qty: " + dtServiceUtilisationTable.Rows[screen]["Quantity"].ToString() + " Bal: " + dtServiceUtilisationTable.Rows[screen]["Balance"].ToString();
                        }

                        words     = data2.Split(new char[] { ' ' });
                        writeData = "";
                        tempData  = "";

                        xSize = 0; ySize = 0; i = 0; yPos = 0;

                        for (i = 0; i < words.Length; i++)
                        {
                            tempData += words[i];

                            xSize = SigPlusNET1.LCDStringWidth(f, tempData);

                            if (xSize < lcdX)
                            {
                                writeData = tempData;
                                tempData += " ";

                                xSize = SigPlusNET1.LCDStringWidth(f, tempData);

                                if (xSize < lcdX)
                                {
                                    writeData = tempData;
                                }
                            }
                            else
                            {
                                ySize = SigPlusNET1.LCDStringHeight(f, tempData);

                                SigPlusNET1.LCDWriteString(0, 2, 0, yPos, f, writeData);

                                tempData  = "";
                                writeData = "";
                                yPos     += (short)ySize;
                                i--;
                            }
                        }

                        if (writeData != "")
                        {
                            SigPlusNET1.LCDWriteString(0, 2, 0, yPos, f, writeData);
                        }

                        //Hotspot text
                        SigPlusNET1.LCDWriteString(0, 2, 15, 45, f, "Continue");
                        screen++;
                        SigPlusNET1.SetLCDCaptureMode(2);

                        break;

                    case "CreditUtilisation":
                        if (dtCreditPackageUsageTable != null)
                        {
                            if (dtCreditPackageUsageTable.Rows.Count > 0)
                            {
                                if (screen == 0)
                                {
                                    preBalance = Convert.ToDouble(dtCreditPackageUsageTable.Rows[screen]["preBalance"]);
                                }
                                else
                                {
                                    preBalance = preBalance - Convert.ToDouble(dtCreditPackageUsageTable.Rows[screen]["mCreditPackageUsagePrice"]);
                                }

                                data2 = dtCreditPackageUsageTable.Rows[screen]["strDescription"].ToString() + " Pre Bal: " + preBalance + " Usage: " + Convert.ToDouble(dtCreditPackageUsageTable.Rows[screen]["mCreditPackageUsagePrice"]) + " After Bal: " + (preBalance - Convert.ToDouble(dtCreditPackageUsageTable.Rows[screen]["mCreditPackageUsagePrice"])).ToString();
                            }
                            else
                            {
                                if (drCrPktUsageTable != null)
                                {
                                    if (drCrPktUsageTable.GetLength(0) > 0)
                                    {
                                        if (screen == 0)
                                        {
                                            preBalance = Convert.ToDouble(s[2].ToString().Replace("#", ""));
                                        }
                                        else
                                        {
                                            preBalance = preBalance - Convert.ToDouble(drCrPktUsageTable[screen, 1]);
                                        }

                                        data2 = drCrPktUsageTable[screen, 0].ToString() + " Pre Bal: " + preBalance + " Usage: " + Convert.ToDouble(drCrPktUsageTable[screen, 1]).ToString() + " After Bal: " + (preBalance - Convert.ToDouble(drCrPktUsageTable[screen, 1])).ToString();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (drCrPktUsageTable != null)
                            {
                                if (drCrPktUsageTable.GetLength(0) > 0)
                                {
                                    if (screen == 0)
                                    {
                                        preBalance = Convert.ToDouble(Regex.Split(s[2].ToString(), "##")[0]);
                                    }
                                    else
                                    {
                                        preBalance = preBalance - Convert.ToDouble(drCrPktUsageTable[screen, 1]);
                                    }

                                    data2 = drCrPktUsageTable[screen, 0].ToString() + " Pre Bal: " + preBalance + " Usage: " + Convert.ToDouble(drCrPktUsageTable[screen, 1]).ToString() + " After Bal: " + (preBalance - Convert.ToDouble(drCrPktUsageTable[screen, 1])).ToString();
                                }
                            }
                        }

                        words     = data2.Split(new char[] { ' ' });
                        writeData = "";
                        tempData  = "";

                        xSize = 0; ySize = 0; i = 0; yPos = 0;

                        for (i = 0; i < words.Length; i++)
                        {
                            tempData += words[i];

                            xSize = SigPlusNET1.LCDStringWidth(f, tempData);

                            if (xSize < lcdX)
                            {
                                writeData = tempData;
                                tempData += " ";

                                xSize = SigPlusNET1.LCDStringWidth(f, tempData);

                                if (xSize < lcdX)
                                {
                                    writeData = tempData;
                                }
                            }
                            else
                            {
                                ySize = SigPlusNET1.LCDStringHeight(f, tempData);

                                SigPlusNET1.LCDWriteString(0, 2, 0, yPos, f, writeData);

                                tempData  = "";
                                writeData = "";
                                yPos     += (short)ySize;
                                i--;
                            }
                        }

                        if (writeData != "")
                        {
                            SigPlusNET1.LCDWriteString(0, 2, 0, yPos, f, writeData);
                        }

                        //Hotspot text
                        SigPlusNET1.LCDWriteString(0, 2, 15, 45, f, "Continue");
                        screen++;
                        SigPlusNET1.SetLCDCaptureMode(2);
                        break;

                    case "Redemption":
                        data2     = s[3] + " Pre Bal: " + (Convert.ToInt32(s[5]) + Convert.ToInt32(s[6])).ToString() + " Point Redempt: " + s[5] + " After Bal: " + s[6];
                        words     = data2.Split(new char[] { ' ' });
                        writeData = "";
                        tempData  = "";

                        xSize = 0; ySize = 0; i = 0; yPos = 0;

                        for (i = 0; i < words.Length; i++)
                        {
                            tempData += words[i];

                            xSize = SigPlusNET1.LCDStringWidth(f, tempData);

                            if (xSize < lcdX)
                            {
                                writeData = tempData;
                                tempData += " ";

                                xSize = SigPlusNET1.LCDStringWidth(f, tempData);

                                if (xSize < lcdX)
                                {
                                    writeData = tempData;
                                }
                            }
                            else
                            {
                                ySize = SigPlusNET1.LCDStringHeight(f, tempData);

                                SigPlusNET1.LCDWriteString(0, 2, 0, yPos, f, writeData);

                                tempData  = "";
                                writeData = "";
                                yPos     += (short)ySize;
                                i--;
                            }
                        }

                        if (writeData != "")
                        {
                            SigPlusNET1.LCDWriteString(0, 2, 0, yPos, f, writeData);
                        }

                        //Hotspot text
                        SigPlusNET1.LCDWriteString(0, 2, 15, 45, f, "Continue");
                        screen++;
                        SigPlusNET1.SetLCDCaptureMode(2);
                        break;
                    }

                    SigPlusNET1.SetLCDCaptureMode(2);
                }
                else
                {
                    SigPlusNET1.ClearSigWindow(1);
                    SigPlusNET1.LCDRefresh(1, 16, 45, 50, 15); //Refresh LCD at 'Continue' to indicate to user that this option has been sucessfully chosen
                    SigPlusNET1.LCDRefresh(2, 0, 0, 240, 64);  //Brings the background image already loaded into foreground
                    SigPlusNET1.ClearTablet();
                    SigPlusNET1.KeyPadClearHotSpotList();
                    SigPlusNET1.KeyPadAddHotSpot(2, 1, 10, 5, 53, 17);  //For CLEAR button
                    SigPlusNET1.KeyPadAddHotSpot(3, 1, 197, 5, 19, 17); //For OK button
                    SigPlusNET1.LCDSetWindow(2, 22, 236, 40);
                    SigPlusNET1.SetSigWindow(1, 0, 22, 240, 40);        //Sets the area where ink is permitted in the SigPlus object
                }
            }
            else if (SigPlusNET1.KeyPadQueryHotSpot(2) > 0) //If the CLEAR hotspot is tapped, then...
            {
                SigPlusNET1.ClearSigWindow(1);
                SigPlusNET1.LCDRefresh(1, 10, 0, 53, 17); //Refresh LCD at 'CLEAR' to indicate to user that this option has been sucessfully chosen
                SigPlusNET1.LCDRefresh(2, 0, 0, 240, 64); //Brings the background image already loaded into foreground
                SigPlusNET1.ClearTablet();
            }
            else if (SigPlusNET1.KeyPadQueryHotSpot(3) > 0) //If the OK hotspot is tapped, then...
            {
                if (SigPlusNET1.NumberOfTabletPoints() > 0)
                {
                    SigPlusNET1.LCDRefresh(0, 0, 0, 240, 64);
                    Font f = new System.Drawing.Font("Arial", 9.0F, System.Drawing.FontStyle.Regular);
                    SigPlusNET1.LCDWriteString(0, 2, 35, 25, f, "Signature capture complete.\nThank you!");
                    System.Threading.Thread.Sleep(1000);
                    SigPlusNET1.ClearSigWindow(1);
                    SigPlusNET1.LCDRefresh(0, 0, 0, 240, 64);
                    btnPrint_Click(this, e);
                }
                else
                {
                    SigPlusNET1.LCDRefresh(0, 0, 0, 240, 64);
                    Font f = new System.Drawing.Font("Arial", 9.0F, System.Drawing.FontStyle.Regular);
                    SigPlusNET1.LCDWriteString(0, 2, 35, 25, f, "No signature captured.");
                    System.Threading.Thread.Sleep(1000);
                    SigPlusNET1.ClearSigWindow(1);
                    SigPlusNET1.LCDRefresh(0, 0, 0, 240, 64);
                    btnPrint_Click(this, e);
                }
            }
        }