// Set the substitution rule data
 private void SubSet_Click(object sender, EventArgs e)
 {
     byte[] data;
     if (vCat >= 0)
     {
         if (EIP.StartSession())
         {
             if (EIP.ForwardOpen())
             {
                 Prop   prop = EIP.AttrDict[ClassCode.Substitution_rules, (byte)at[vCat]].Set;
                 string s    = new string(' ', prop.Len);
                 // The correct substitution rule is already set
                 for (int i = 0; i < subLabels[vCat].Length; i++)
                 {
                     // space fill on the left
                     string t = s + subTexts[vCat][i].Text;
                     // Send the substitution data one at a time
                     data = EIP.FormatOutput(prop, i + startWith[vCat], 1, t.Substring(t.Length - prop.Len));
                     if (!EIP.SetAttribute(ClassCode.Substitution_rules, (byte)at[vCat], data))
                     {
                         EIP.LogIt("Error writing substitution data!  Aborting");
                         break;
                     }
                 }
             }
             EIP.ForwardClose();
         }
         EIP.EndSession();
     }
     SetButtonEnables();
 }
 // Send characters to the printer
 private void UpSet_Click(object sender, EventArgs e)
 {
     if (EIP.StartSession())
     {
         if (EIP.ForwardOpen())
         {
             byte[][] b = StripesToBytes(charHeight, BitMapToStripes(bmGrid, charWidth));
             byte[]   data;
             for (int i = 0; i < Count; i++)
             {
                 if ((Layout)cbLayout.SelectedIndex == Layout.Fixed)
                 {
                     AttrData attr = EIP.GetAttrData(ccUP.User_Pattern_Fixed);
                     // Font ID, Position, and Bit Map
                     data = EIP.FormatOutput(attr.Set, new int[] { dotMatrixCode, Registration + i }, b[i]);
                     if (!EIP.SetAttribute(ClassCode.User_pattern, (byte)ccUP.User_Pattern_Fixed, data))
                     {
                         EIP.LogIt("Fixed Pattern Download Failed.  Aborting Download!");
                         break;
                     }
                 }
                 else
                 {
                     AttrData attr = EIP.GetAttrData(ccUP.User_Pattern_Free);
                     // Vertical Size (charHeigth), Horizontol Size (charWidth), Position, Bit Map
                     data = EIP.FormatOutput(attr.Set, new int[] { charHeight, charWidth, Registration + i }, b[i]);
                     if (!EIP.SetAttribute(ClassCode.User_pattern, (byte)ccUP.User_Pattern_Free, data))
                     {
                         EIP.LogIt("Free Pattern Download Failed.  Aborting Download!");
                         break;
                     }
                 }
             }
         }
         EIP.ForwardClose();
     }
     EIP.EndSession();
     SetButtonEnables();
 }
Exemplo n.º 3
0
        // Issue a single Get request
        private void Get_Click(object sender, EventArgs e)
        {
            Button   b    = (Button)sender;
            int      tag  = ((byte[])b.Tag)[0];
            AttrData attr = EIP.AttrDict[cc, ccAttribute[tag]];

            if (attr.Ignore)
            {
                // Avoid a printer hang
                texts[tag].Text       = "Ignored!";
                texts[tag].BackColor  = Color.Pink;
                counts[tag].BackColor = Color.LightGreen;
            }
            else
            {
                // Build and issue the request
                byte[] data = EIP.FormatOutput(attr.Get, texts[tag], dropdowns[tag], attr);
                texts[tag].Text = "Loading";
                parent.AllGood  = EIP.GetAttribute(cc, attr.Val, data);
                // Process the data returned
                EIP.SetBackColor(attr.Data, attr, counts[tag], texts[tag], dropdowns[tag]);
            }
            SetButtonEnables();
        }
 // Issue a Get based on the Class Code and Function dropdowns
 private void btnIssueGet_Click(object sender, EventArgs e)
 {
     byte[] data = EIP.FormatOutput(attr.Get, txtDataOut.Text);
     EIP.GetAttribute(EIP.ClassCodes[cbClassCode.SelectedIndex], (byte)ClassAttr[cbFunction.SelectedIndex], data);
 }