public Browser(string IPAddress, int IPPort, string TrafficFolder, string MessageFolder, int SoftwareVersion)
        {
            InitializeComponent();

            this.Text += " - " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            this.IPAddress     = IPAddress;
            this.IPPort        = IPPort;
            this.TrafficFolder = TrafficFolder;
            this.MessageFolder = MessageFolder;
            this.cbSoftwareVersion.SelectedIndex = SoftwareVersion;

            txtIPAddress.Text  = IPAddress;
            txtPort.Text       = IPPort.ToString();
            txtSaveFolder.Text = TrafficFolder;
            if (!Directory.Exists(txtSaveFolder.Text))
            {
                Directory.CreateDirectory(txtSaveFolder.Text);
            }
            VerifyAddressAndPort();

            EIP                 = new EIP(txtIPAddress.Text, port, TrafficFolder);
            EIP.Log            += EIP_Log;
            EIP.IOComplete     += EIP_IO_Complete;
            EIP.StateChanged   += EIP_StateChanged;
            EIP.SoftwareVersion = cbSoftwareVersion.Text;

            // Initialize all class and attribute structures
            InitializeData();
        }
        private bool BuildShifts()
        {
            // Clean up the display
            EIP.DeleteAllButOne();
            // Point to first item
            EIP.SetAttribute(ccIDX.Item, 1);

            EIP.SetAttribute(ccPF.Print_Character_String, "=>{{E}}<=");

            // Set < Shift Number="1" StartHour="00" StartMinute="00" EndHour="7" EndMinute="59" Text="D" />
            EIP.SetAttribute(ccIDX.Calendar_Block, 1);
            EIP.SetAttribute(ccCal.Shift_Start_Hour, 0);
            EIP.SetAttribute(ccCal.Shift_Start_Minute, 0);
            EIP.SetAttribute(ccCal.Shift_String_Value, "D");

            // Set < Shift Number="2" StartHour="8" StartMinute="00" EndHour="15" EndMinute="59" Text="E" />
            EIP.SetAttribute(ccIDX.Calendar_Block, 2);
            EIP.SetAttribute(ccCal.Shift_Start_Hour, 8);
            EIP.SetAttribute(ccCal.Shift_Start_Minute, 0);
            EIP.SetAttribute(ccCal.Shift_String_Value, "E");

            // Set < Shift Number="2" StartHour="16" StartMinute="00" EndHour="23" EndMinute="59" Text="F" />
            EIP.SetAttribute(ccIDX.Calendar_Block, 3);
            EIP.SetAttribute(ccCal.Shift_Start_Hour, 16);
            EIP.SetAttribute(ccCal.Shift_Start_Minute, 0);
            EIP.SetAttribute(ccCal.Shift_String_Value, "F");
            return(true);
        }
 // Respond to EIP change in success/fail state
 private void EIP_StateChanged(EIP sender, string msg)
 {
     if (!EIP.SessionIsOpen)
     {
         AllGood = false;
     }
     SetButtonEnables();
 }
        private bool MultiLine()
        {
            bool success = true;

            if (EIP.StartSession(true)) // Open a session
            {
                if (EIP.ForwardOpen())  // open a data forwarding path
                {
                    try {
                        // Be sure we are in Individual Layout
                        EIP.SetAttribute(ccPF.Format_Setup, "Individual");
                        // Clean up the display
                        EIP.DeleteAllButOne();
                        // Select item 1 and set to 1 line (1 origin on Line Count)
                        EIP.SetAttribute(ccIDX.Item, 1);
                        EIP.SetAttribute(ccPF.Line_Count, 1);
                        // Add four more columns
                        for (int i = 2; i <= 5; i++)
                        {
                            EIP.ServiceAttribute(ccPF.Add_Column, 0);
                        }
                        // Stack columns 2 and 4 (1 origin on Line Count)
                        EIP.SetAttribute(ccIDX.Item, 2);
                        EIP.SetAttribute(ccPF.Line_Count, 2);
                        EIP.SetAttribute(ccIDX.Item, 4);
                        EIP.SetAttribute(ccPF.Line_Count, 2);

                        // Set the text in the items
                        for (int i = 1; i <= 7; i++)
                        {
                            EIP.SetAttribute(ccIDX.Item, i); // Select item
                            if (i == 1 || i == 4 || i == 7)  // Set the font and text
                            {
                                EIP.SetAttribute(ccPF.Print_Character_String, $"{i}");
                                EIP.SetAttribute(ccPF.Dot_Matrix, "12x16");
                            }
                            else
                            {
                                EIP.SetAttribute(ccPF.Print_Character_String, $" {i} ");
                                EIP.SetAttribute(ccPF.Dot_Matrix, "5x8");
                            }
                        }
                    } catch (EIPIOException e1) {
                        // In case of an EIP I/O error
                        string name = $"{EIP.GetAttributeName(e1.ClassCode, e1.Attribute)}";
                        string msg  = $"EIP I/O Error on {e1.AccessCode}/{e1.ClassCode}/{name}";
                        MessageBox.Show(msg, "EIP I/O Error", MessageBoxButtons.OK);
                        success = false;
                    } catch {
                        // You are on your own here
                    }
                }
                EIP.ForwardClose(); // Must be outside the ForwardOpen if block
            }
            EIP.EndSession();       // Must be outside the StartSession if block
            return(success);
        }
        // Create class
        public XML(Browser parent, EIP EIP, TabPage tab)
        {
            this.parent = parent;
            this.EIP    = EIP;
            this.tab    = tab;

            BuildControls();

            BuildTestFileList();

            SetButtonEnables();
        }
Exemple #6
0
        // Send xlmDoc from display to printer
        private void SendDisplayToPrinter_Click(object sender, EventArgs e)
        {
            bool success = true;

            success = EIP.SendXMLAsSerialization(txtIndentedView.Text, true);
            if (success)
            {
                EIP.LogIt("Load Successful!");
            }
            else
            {
                EIP.LogIt("Load Failed!");
            }
        }
        private bool TryDayOfWeekEtc()
        {
            // Clean up the display
            EIP.DeleteAllButOne();

            EIP.SetAttribute(ccIDX.Item, 1);
            EIP.SetAttribute(ccPF.Print_Character_String, "=>{{77}-{WW}-{TTT}}<=");
            EIP.GetAttribute(ccCal.First_Calendar_Block, out int block);
            EIP.SetAttribute(ccIDX.Calendar_Block, block);
            EIP.SetAttribute(ccCal.Substitute_Weeks, "Disable");
            EIP.SetAttribute(ccCal.Zero_Suppress_Weeks, "Disable");
            EIP.SetAttribute(ccCal.Substitute_DayOfWeek, "Enable");
            EIP.SetAttribute(ccCal.Zero_Suppress_DayOfWeek, "Disable");
            return(true);
        }
        public bool CleanUpDisplay()
        {
            bool success = true;

            if (EIP.StartSession(true))
            {
                if (EIP.ForwardOpen())
                {
                    try {
                        // Get the number of columns
                        EIP.GetAttribute(ccPF.Number_Of_Columns, out int cols);
                        // No need to delete columns if there is only one
                        if (cols > 1)
                        {
                            // Select to continuously delete column 2 (0 origin on deletes)
                            EIP.SetAttribute(ccIDX.Column, 1);
                            // Column number is 0 origin
                            while (--cols > 0)
                            {
                                // Delete the column
                                EIP.ServiceAttribute(ccPF.Delete_Column);
                            }
                        }
                        // Select item 1 (1 origin on Line Count)
                        EIP.SetAttribute(ccIDX.Item, 1);
                        // Set line count to 1. (Need to find out how delete single item works.)
                        EIP.SetAttribute(ccPF.Line_Count, 1);
                        // Test item size
                        EIP.SetAttribute(ccPF.Dot_Matrix, "5x8");
                        EIP.SetAttribute(ccPF.Barcode_Type, "None");
                        // Set simple text in case Calendar or Counter was used
                        EIP.SetAttribute(ccPF.Print_Character_String, "1");
                    } catch (EIPIOException e1) {
                        // In case of an EIP I/O error
                        string name = $"{EIP.GetAttributeName(e1.ClassCode, e1.Attribute)}";
                        string msg  = $"EIP I/O Error on {e1.AccessCode}/{e1.ClassCode}/{name}";
                        MessageBox.Show(msg, "EIP I/O Error", MessageBoxButtons.OK);
                        success = false;
                    } catch {
                        // You are on your own here
                    }
                }
                EIP.ForwardClose();
            }
            EIP.EndSession();
            return(success);
        }
        public bool SetText(string text)
        {
            bool success = true;

            string[] s = text.Split('\n');
            if (EIP.StartSession(true))
            {
                if (EIP.ForwardOpen())
                {
                    try {
                        // Clean up the display
                        EIP.DeleteAllButOne();
                        // Select the item
                        EIP.SetAttribute(ccIDX.Item, 1);
                        // Insert the text
                        EIP.SetAttribute(ccPF.Print_Character_String, s[0]);
                        for (int i = 1; i < s.Length; i++)
                        {
                            EIP.ServiceAttribute(ccPF.Add_Column);
                            EIP.SetAttribute(ccIDX.Item, i + 1);
                            EIP.SetAttribute(ccPF.Print_Character_String, s[i]);
                        }
                        // Set info in first Calendar Block
                        EIP.SetAttribute(ccIDX.Item, 1);
                        EIP.GetAttribute(ccCal.First_Calendar_Block, out int calNo);
                        EIP.SetAttribute(ccIDX.Calendar_Block, calNo);
                        EIP.SetAttribute(ccCal.Offset_Month, 1);
                        // Set info in Second Calendar Block
                        EIP.SetAttribute(ccIDX.Item, 2);
                        EIP.GetAttribute(ccCal.First_Calendar_Block, out calNo);
                        EIP.SetAttribute(ccIDX.Calendar_Block, calNo);
                        EIP.SetAttribute(ccCal.Zero_Suppress_Hour, "Space Fill");
                    } catch (EIPIOException e1) {
                        // In case of an EIP I/O error
                        string name = $"{EIP.GetAttributeName(e1.ClassCode, e1.Attribute)}";
                        string msg  = $"EIP I/O Error on {e1.AccessCode}/{e1.ClassCode}/{name}";
                        MessageBox.Show(msg, "EIP I/O Error", MessageBoxButtons.OK);
                        success = false;
                    } catch {
                        // You are on your own here
                    }
                }
                EIP.ForwardClose();
            }
            EIP.EndSession();
            return(success);
        }
        private bool BuildTimeCount()
        {
            // Clean up the display
            EIP.DeleteAllButOne();

            EIP.SetAttribute(ccIDX.Item, 1);

            EIP.SetAttribute(ccPF.Print_Character_String, "=>{{FF}}<=");
            EIP.GetAttribute(ccCal.First_Calendar_Block, out int block);
            EIP.SetAttribute(ccIDX.Calendar_Block, block);

            // Set <TimeCount Start="AA" End="JJ" Reset="AA" ResetTime="6" RenewalPeriod="30 Minutes" />
            EIP.SetAttribute(ccCal.Update_Interval_Value, "30 Minutes");
            EIP.SetAttribute(ccCal.Time_Count_Start_Value, "A1");
            EIP.SetAttribute(ccCal.Time_Count_End_Value, "X2");
            EIP.SetAttribute(ccCal.Reset_Time_Value, 6);
            EIP.SetAttribute(ccCal.Time_Count_Reset_Value, "A1");
            return(true);
        }
        public Attributes(Browser parent, EIP EIP, TabPage tab, ClassCode cc, int Extras = 0)
        {
            this.parent      = parent;
            this.EIP         = EIP;
            this.tab         = tab;
            this.cc          = cc;
            this.ccAttribute = ((t1[])typeof(t1).GetEnumValues()).Select(x => Convert.ToByte(x)).ToArray();
            this.Extras      = Extras;

            extrasUsed = AddExtraControls();

            BuildControls();

            // Substitution has extra controls
            if (cc == ClassCode.Substitution_rules)
            {
                // Assumes only one extra control
                Substitution = new Substitution(parent, EIP, tab);
                Substitution.BuildControls();
            }

            // UserPattern has extra controls
            if (cc == ClassCode.User_pattern)
            {
                UserPattern = new UserPattern(parent, EIP, tab);
                UserPattern.BuildControls();
            }

            // IJP operation has extra controls
            if (cc == ClassCode.IJP_operation)
            {
                Errors = new Errors(parent, EIP, tab);
                Errors.BuildControls();
            }

            // Print data management has extra controls
            if (cc == ClassCode.Print_data_management)
            {
                PrintManagement = new PrintManagement(parent, EIP, tab);
                PrintManagement.BuildControls();
            }
        }
Exemple #12
0
        // Send xlmDoc from file to printer
        private void SendFileToPrinter_Click(object sender, EventArgs e)
        {
            bool success = true;

            // Need a XMP Document to continue
            if (xmlDoc == null)
            {
                Open_Click(null, null);
            }
            if (xmlDoc != null)
            {
                success = EIP.SendXMLAsSerialization(XMLFileName, true);
            }
            if (success)
            {
                EIP.LogIt("Load Successful!");
            }
            else
            {
                EIP.LogIt("Load Failed!");
            }
        }
        // Close out the application
        private void CloseExcelApplication(bool View)
        {
            if (excelApp != null)
            {
                if (View)
                {
                    // Set the Verify worksheet as active
                    wsVerify.Activate();
                    // Make a table out of the Verify data
                    Excel.Range SourceRange = (Excel.Range)wsVerify.get_Range("A1", $"J{wsVerifyRow - 1}");
                    SourceRange.Worksheet.ListObjects.Add(Excel.XlListObjectSourceType.xlSrcRange,
                                                          SourceRange, System.Type.Missing, Excel.XlYesNoGuess.xlYes, System.Type.Missing).Name = "Verify";
                    SourceRange.Worksheet.ListObjects["Verify"].TableStyle = "TableStyleMedium2";
                    wsVerify.Columns.AutoFit();

                    // Set the Traffic worksheet as active
                    wsTraffic.Activate();
                    // Make a table out of the traffic data
                    SourceRange = (Excel.Range)wsTraffic.get_Range("A1", $"N{wsTrafficRow - 1}");
                    SourceRange.Worksheet.ListObjects.Add(Excel.XlListObjectSourceType.xlSrcRange,
                                                          SourceRange, System.Type.Missing, Excel.XlYesNoGuess.xlYes, System.Type.Missing).Name = "Traffic";
                    SourceRange.Worksheet.ListObjects["Traffic"].TableStyle = "TableStyleMedium2";
                    wsTraffic.Columns.AutoFit();

                    // Save it away
                    TrafficFileName = EIP.CreateFileName(TrafficFolder, "Traffic", "xlsx");
                    excelApp.ActiveWorkbook.SaveAs(TrafficFileName);
                }
                wsVerify  = null;
                wsTraffic = null;
                wb.Close();
                excelApp.Quit();
                Marshal.ReleaseComObject(wb);
                Marshal.ReleaseComObject(excelApp);
                wb       = null;
                excelApp = null;
            }
        }
        private bool BuildMonthDaySR()
        {
            // Set <Substitution Rule="01" StartYear="2010" Delimiter="/">
            char delimiter = '/';

            EIP.SetAttribute(ccIDX.Substitution_Rule, 1);
            EIP.SetAttribute(ccSR.Start_Year, 2010);

            // Set <Month Base="1">JAN/FEB/MAR/APR/MAY/JUN/JUL/AUG/SEP/OCT/NOV/DEC</Month>
            string[] months = "JAN/FEB/MAR/APR/MAY/JUN/JUL/AUG/SEP/OCT/NOV/DEC".Split(delimiter);
            for (int i = 0; i < months.Length; i++)
            {
                EIP.SetAttribute(ccSR.Month, i + 1, months[i]);
            }

            // Set <DayOfWeek Base="1">MON/TUE/WED/THU/FRI/SAT/SUN</DayOfWeek>
            string[] day = "MON/TUE/WED/THU/FRI/SAT/SUN".Split(delimiter);
            for (int i = 0; i < day.Length; i++)
            {
                EIP.SetAttribute(ccSR.DayOfWeek, i + 1, day[i]);
            }
            return(true);
        }
 private void EIP_TrafficRes(EIP sender, string msg)
 {
     string[] t = msg.Split('\t');
     TrafficView.Rows.Add(t);
     TrafficView.FirstDisplayedScrollingRowIndex = TrafficView.RowCount - 1;
 }
Exemple #16
0
 // Generate an XML Doc from the printer contents
 private void Retrieve_Click(object sender, EventArgs e)
 {
     XMLText = EIP.RetrieveXMLAsSerialization(chkIJPLibNames.Checked);
     ProcessLabel(XMLText);
     SetButtonEnables();
 }
        private bool CreateCounter()
        {
            bool success = true;

            if (EIP.StartSession(true))
            {
                if (EIP.ForwardOpen())
                {
                    try {
                        // Clean up the display
                        EIP.DeleteAllButOne();

                        // Select item #1
                        EIP.SetAttribute(ccIDX.Item, 1);

                        // Set Text as a 4 digit counter
                        EIP.SetAttribute(ccPF.Print_Character_String, "{{CCCC}} {{CCC}}");

                        // Now retrieve the counter block allocations
                        EIP.GetAttribute(ccCount.First_Count_Block, out int firstBlock);
                        EIP.GetAttribute(ccCount.Number_Of_Count_Blocks, out int blockCount);

                        // Set <Counter InitialValue="0001" Range1="0000" Range2="9999" JumpFrom="6666" JumpTo ="7777"
                        //      Increment="1" Direction="Up" ZeroSuppression="Enable" UpdateIP="0" UpdateUnit="1"
                        //      Multiplier ="2" CountSkip="0" Reset="0001" ExternalSignal="Disable" ResetSignal="Signal 1" />

                        // Set item number in count block
                        EIP.SetAttribute(ccIDX.Count_Block, firstBlock);

                        EIP.SetAttribute(ccCount.Initial_Value, "0001");
                        EIP.SetAttribute(ccCount.Count_Range_1, "0000");
                        EIP.SetAttribute(ccCount.Count_Range_2, "9999");
                        EIP.SetAttribute(ccCount.Jump_From, "6666");
                        EIP.SetAttribute(ccCount.Jump_To, "7777");
                        EIP.SetAttribute(ccCount.Increment_Value, 1);
                        EIP.SetAttribute(ccCount.Direction_Value, "Up");
                        EIP.SetAttribute(ccCount.Zero_Suppression, "Disable");
                        EIP.SetAttribute(ccCount.Count_Multiplier, "2");
                        EIP.SetAttribute(ccCount.Reset_Value, "0001");
                        EIP.SetAttribute(ccCount.Count_Skip, "0");

                        EIP.SetAttribute(ccCount.Update_Unit_Halfway, 0);           // Causes COM Error
                        EIP.SetAttribute(ccCount.Update_Unit_Unit, 1);              // Causes COM Error
                        EIP.SetAttribute(ccCount.Type_Of_Reset_Signal, "Signal 1"); // Causes COM Error
                        EIP.SetAttribute(ccCount.External_Count, "Disable");        // Causes COM Error

                        // In case it is the two counter test
                        if (blockCount > 1)
                        {
                            EIP.SetAttribute(ccIDX.Count_Block, firstBlock + 1);
                            EIP.SetAttribute(ccCount.Initial_Value, "001");
                            EIP.SetAttribute(ccCount.Count_Range_1, "000");
                            EIP.SetAttribute(ccCount.Count_Range_2, "999");
                            EIP.SetAttribute(ccCount.Jump_From, "199");
                            EIP.SetAttribute(ccCount.Jump_To, "300");
                            EIP.SetAttribute(ccCount.Increment_Value, 2);
                            EIP.SetAttribute(ccCount.Direction_Value, "Down");
                            EIP.SetAttribute(ccCount.Zero_Suppression, "Disable");
                            EIP.SetAttribute(ccCount.Count_Multiplier, "2");
                            EIP.SetAttribute(ccCount.Reset_Value, "001");
                            EIP.SetAttribute(ccCount.Count_Skip, "0");

                            EIP.SetAttribute(ccCount.Update_Unit_Halfway, 0);           // Causes COM Error
                            EIP.SetAttribute(ccCount.Update_Unit_Unit, 1);              // Causes COM Error
                            EIP.SetAttribute(ccCount.Type_Of_Reset_Signal, "Signal 1"); // Causes COM Error
                            EIP.SetAttribute(ccCount.External_Count, "Disable");        // Causes COM Error
                        }
                    } catch (EIPIOException e1) {
                        // In case of an EIP I/O error
                        string name = $"{EIP.GetAttributeName(e1.ClassCode, e1.Attribute)}";
                        string msg  = $"EIP I/O Error on {e1.AccessCode}/{e1.ClassCode}/{name}";
                        MessageBox.Show(msg, "EIP I/O Error", MessageBoxButtons.OK);
                        success = false;
                    } catch {
                        // You are on your own here
                    }
                }
                EIP.ForwardClose();
            }
            EIP.EndSession();
            return(success);
        }
        private bool BuildMDYhms()
        {
            bool success = true;

            try {
                // Clean up the display
                EIP.DeleteAllButOne();
                // Select item 1
                EIP.SetAttribute(ccIDX.Item, 1);

                // Set Text
                EIP.SetAttribute(ccPF.Print_Character_String, "{{MMM}/{DD}/{YY}} {{hh}:{mm}:{ss}}");

                // Get first block and Substitution Rule
                EIP.GetAttribute(ccCal.First_Calendar_Block, out int firstBlock);
                EIP.GetAttribute(ccCal.Number_of_Calendar_Blocks, out int blockCount);

                // Set Item in Calendar Index
                EIP.SetAttribute(ccIDX.Calendar_Block, firstBlock);

                //// Point to first substitution rule
                //EIP.SetAttribute(ccIDX.Substitution_Rules_Setting, Rule);

                // Set <EnableSubstitution SubstitutionRule="01" Year="False" Month="True"  Day="False" />
                EIP.SetAttribute(ccCal.Substitute_Year, "Disable");
                EIP.SetAttribute(ccCal.Substitute_Month, "Enable");
                EIP.SetAttribute(ccCal.Substitute_Day, "Disable");

                // Set <Offset Year="1" Month="2" Day="3" />
                EIP.SetAttribute(ccCal.Offset_Year, 1);
                EIP.SetAttribute(ccCal.Offset_Month, 2);
                EIP.SetAttribute(ccCal.Offset_Day, 3);

                // Set <ZeroSuppress Year="Disable" Month="Disable" Day="Disable" />
                EIP.SetAttribute(ccCal.Zero_Suppress_Year, "Disable");
                EIP.SetAttribute(ccCal.Zero_Suppress_Month, "Disable");
                EIP.SetAttribute(ccCal.Zero_Suppress_Day, "Disable");

                // Set Item in Calendar Index
                if (blockCount > 1)
                {
                    EIP.SetAttribute(ccIDX.Calendar_Block, firstBlock + 1);

                    // Set <EnableSubstitution SubstitutionRule="01" Year="False" Month="True"  Day="False"
                    //      Hour ="False" Minute="False" Week="False" DayOfWeek="False" />
                    EIP.SetAttribute(ccCal.Substitute_Hour, "Disable");
                    EIP.SetAttribute(ccCal.Substitute_Minute, "Disable");

                    // Set <Offset Year="1" Month="2" Day="3" Hour="-4" Minute="-5" />
                    EIP.SetAttribute(ccCal.Offset_Hour, 4);
                    EIP.SetAttribute(ccCal.Offset_Minute, -5);

                    // Set <ZeroSuppress Year="Disable" Month="Disable" Day="Disable"
                    //      Hour ="Space Fill" Minute="Character Fill" />
                    EIP.SetAttribute(ccCal.Zero_Suppress_Hour, "Space Fill");
                    EIP.SetAttribute(ccCal.Zero_Suppress_Minute, "Character Fill");
                }
            } catch (EIPIOException e1) {
                // In case of an EIP I/O error
                string name = $"{EIP.GetAttributeName(e1.ClassCode, e1.Attribute)}";
                string msg  = $"EIP I/O Error on {e1.AccessCode}/{e1.ClassCode}/{name}";
                MessageBox.Show(msg, "EIP I/O Error", MessageBoxButtons.OK);
                success = false;
            } catch {
                // You are on your own here
            }
            return(success);
        }
        // Same as above but recoded for performance
        private bool ComprehensiveII()
        {
            bool success = true;

            string[] itemText = new string[] {
                "SELLBY {{MMM}/{DD}/{YY}}  ", "USE BY {{MMM}/{DD}/{YY}}  ", "PACKED {{TTT} {777}} ",
                "Shift {{E}}", "T-Ct {{FF}} ", "#{{CCCCCC}} ", "{X/0}"
            };
            if (EIP.StartSession(true))
            {
                if (EIP.ForwardOpen())
                {
                    EIP.UseAutomaticReflection = true; // Make things as fast as possible
                    try {
                        // Load the message type
                        {
                            EIP.SetAttribute(ccPF.Format_Setup, "Individual");
                            // Clean up the display
                            EIP.DeleteAllButOne();
                        }
                        // Clean up the display
                        {
                            EIP.GetAttribute(ccPF.Number_Of_Columns, out int cols);
                            if (cols > 1)
                            {
                                EIP.SetAttribute(ccIDX.Column, 1); // Actually column 2
                                while (--cols > 0)
                                {
                                    EIP.ServiceAttribute(ccPF.Delete_Column);
                                }
                            }
                            EIP.SetAttribute(ccIDX.Item, 1);
                            EIP.SetAttribute(ccPF.Line_Count, 1);
                            // Avoid issues with add columns
                            EIP.SetAttribute(ccPF.Dot_Matrix, "5x8");
                            EIP.SetAttribute(ccPF.Barcode_Type, "None");
                            EIP.SetAttribute(ccPF.Print_Character_String, "1");
                        }

                        // Set up the rows and columns
                        {
                            // First column is already there, just create the second and third columns
                            EIP.ServiceAttribute(ccPF.Add_Column);
                            EIP.ServiceAttribute(ccPF.Add_Column);
                            // Allocate the items in each column (Should this be Column and not Item?)
                            EIP.SetAttribute(ccIDX.Item, 1);
                            EIP.SetAttribute(ccPF.Line_Count, 3);
                            EIP.SetAttribute(ccIDX.Item, 2);
                            EIP.SetAttribute(ccPF.Line_Count, 3);
                            EIP.SetAttribute(ccIDX.Item, 3);
                            EIP.SetAttribute(ccPF.Line_Count, 1);
                            // Set the Interline Spacing
                            EIP.SetAttribute(ccIDX.Column, 1);
                            EIP.SetAttribute(ccPF.Line_Spacing, 1);
                            EIP.SetAttribute(ccIDX.Column, 2);
                            EIP.SetAttribute(ccPF.Line_Spacing, 2);
                        }

                        // Format the items
                        {
                            // Set the format consistant for all six items
                            for (int i = 1; i <= 6; i++)
                            {
                                EIP.SetAttribute(ccIDX.Item, i);
                                EIP.SetAttribute(ccPF.Dot_Matrix, "5x8");
                                EIP.SetAttribute(ccPF.InterCharacter_Space, 1);
                                EIP.SetAttribute(ccPF.Character_Bold, 1);
                                EIP.SetAttribute(ccPF.Barcode_Type, "None");
                                EIP.SetAttribute(ccPF.Print_Character_String, itemText[i - 1]);
                            }
                            // Set a logo into the seventh item
                            EIP.SetAttribute(ccIDX.Item, 7);
                            EIP.SetAttribute(ccPF.Dot_Matrix, "18x24");
                            EIP.SetAttribute(ccPF.InterCharacter_Space, 2);
                            EIP.SetAttribute(ccPF.Character_Bold, 2);
                            EIP.SetAttribute(ccPF.Barcode_Type, "None");
                            EIP.SetAttribute(ccPF.Print_Character_String, itemText[6]);
                        }

                        // Now gather all the information needed to set up the Calendar and Counter blocks
                        EIP.UseAutomaticReflection = false; // Make things as fast as possible
                        EIP.SetAttribute(ccIDX.Item, 1);
                        EIP.GetAttribute(ccCal.First_Calendar_Block, out int firstBlock1);
                        EIP.SetAttribute(ccIDX.Item, 2);
                        EIP.GetAttribute(ccCal.First_Calendar_Block, out int firstBlock2);
                        EIP.SetAttribute(ccIDX.Item, 3);
                        EIP.GetAttribute(ccCal.First_Calendar_Block, out int firstBlock3);
                        EIP.SetAttribute(ccIDX.Item, 4);
                        EIP.GetAttribute(ccCal.First_Calendar_Block, out int firstBlock4);
                        EIP.SetAttribute(ccIDX.Item, 5);
                        EIP.GetAttribute(ccCal.First_Calendar_Block, out int firstBlock5);
                        EIP.SetAttribute(ccIDX.Item, 6);
                        EIP.GetAttribute(ccCount.First_Count_Block, out int firstBlock6);
                        EIP.UseAutomaticReflection = true; // Make things as fast as possible

                        // Set up the clock for item 1
                        {
                            EIP.SetAttribute(ccIDX.Item, 1);
                            EIP.SetAttribute(ccIDX.Calendar_Block, firstBlock1);
                            EIP.SetAttribute(ccCal.Substitute_Month, "Enable");
                            EIP.SetAttribute(ccCal.Zero_Suppress_Day, "Space Fill");
                        }
                        // Set up the clock for item 2
                        {
                            EIP.SetAttribute(ccIDX.Item, 2);
                            EIP.SetAttribute(ccIDX.Calendar_Block, firstBlock2);
                            EIP.SetAttribute(ccCal.Substitute_Month, "Enable");
                            EIP.SetAttribute(ccCal.Zero_Suppress_Day, "Space Fill");
                            EIP.SetAttribute(ccCal.Offset_Day, 30);
                            EIP.SetAttribute(ccPF.Calendar_Offset, "From Yesterday");
                        }
                        // Set up the clock for item 3
                        {
                            EIP.SetAttribute(ccIDX.Item, 3);
                            EIP.SetAttribute(ccIDX.Calendar_Block, firstBlock3);
                            EIP.SetAttribute(ccCal.Substitute_DayOfWeek, "Enable");
                        }
                        // Set up the clock for item 4
                        {
                            EIP.SetAttribute(ccIDX.Item, 4);
                            EIP.SetAttribute(ccIDX.Calendar_Block, firstBlock4);

                            // Set < Shift Number="1" StartHour="00" StartMinute="00" EndHour="7" EndMinute="59" Text="D" />
                            EIP.SetAttribute(ccIDX.Calendar_Block, 1);
                            EIP.SetAttribute(ccCal.Shift_Start_Hour, 0);
                            EIP.SetAttribute(ccCal.Shift_Start_Minute, 0);
                            EIP.SetAttribute(ccCal.Shift_String_Value, "D");

                            // Set < Shift Number="2" StartHour="8" StartMinute="00" EndHour="15" EndMinute="59" Text="E" />
                            EIP.SetAttribute(ccIDX.Calendar_Block, 2);
                            EIP.SetAttribute(ccCal.Shift_Start_Hour, 8);
                            EIP.SetAttribute(ccCal.Shift_Start_Minute, 0);
                            EIP.SetAttribute(ccCal.Shift_String_Value, "E");

                            // Set < Shift Number="2" StartHour="16" StartMinute="00" EndHour="23" EndMinute="59" Text="F" />
                            EIP.SetAttribute(ccIDX.Calendar_Block, 3);
                            EIP.SetAttribute(ccCal.Shift_Start_Hour, 16);
                            EIP.SetAttribute(ccCal.Shift_Start_Minute, 0);
                            EIP.SetAttribute(ccCal.Shift_String_Value, "F");
                        }
                        // Set up the clock for item 5
                        {
                            EIP.SetAttribute(ccIDX.Item, 5);
                            EIP.SetAttribute(ccIDX.Calendar_Block, firstBlock5);

                            // Set <TimeCount Start="A1" End="X2" Reset="A1" ResetTime="6" RenewalPeriod="30 Minutes" />
                            EIP.SetAttribute(ccCal.Update_Interval_Value, "30 Minutes");
                            EIP.SetAttribute(ccCal.Time_Count_Start_Value, "A1");
                            EIP.SetAttribute(ccCal.Time_Count_End_Value, "X2");
                            EIP.SetAttribute(ccCal.Reset_Time_Value, 6);
                            EIP.SetAttribute(ccCal.Time_Count_Reset_Value, "A1");
                        }
                        // Set up the counter for item 6
                        {
                            EIP.SetAttribute(ccIDX.Item, 6);
                            EIP.SetAttribute(ccIDX.Count_Block, firstBlock6);

                            EIP.SetAttribute(ccCount.Initial_Value, "000001");
                            EIP.SetAttribute(ccCount.Count_Range_1, "000000");
                            EIP.SetAttribute(ccCount.Count_Range_2, "999999");
                            EIP.SetAttribute(ccCount.Jump_From, "000199");
                            EIP.SetAttribute(ccCount.Jump_To, "000300");
                            EIP.SetAttribute(ccCount.Increment_Value, 2);
                            EIP.SetAttribute(ccCount.Direction_Value, "Down");
                            EIP.SetAttribute(ccCount.Zero_Suppression, "Enable");
                            EIP.SetAttribute(ccCount.Count_Multiplier, "2");
                            EIP.SetAttribute(ccCount.Reset_Value, "000001");
                            EIP.SetAttribute(ccCount.Count_Skip, "0");
                            EIP.SetAttribute(ccCount.Update_Unit_Halfway, 0);
                            EIP.SetAttribute(ccCount.Update_Unit_Unit, 1);
                            EIP.SetAttribute(ccCount.Type_Of_Reset_Signal, "Signal 1");
                            EIP.SetAttribute(ccCount.External_Count, "Disable");
                        }
                        // Set up the logo for item 7
                        {
                            // Once logo processing works in the printer, loading of the logo will be added here.
                        }
                        // Load the message properties
                        {
                            EIP.SetAttribute(ccPS.Character_Orientation, "Inverted/Forward");
                            EIP.SetAttribute(ccPS.Target_Sensor_Filter, "Until End of Print");
                            EIP.SetAttribute(ccPS.Target_Sensor_Filter_Value, 50);
                            EIP.SetAttribute(ccPS.Target_Sensor_Timer, 0);
                            EIP.SetAttribute(ccPS.Character_Height, 99);
                            EIP.SetAttribute(ccPS.Character_Width, 10);
                            EIP.SetAttribute(ccPS.Print_Start_Delay_Forward, 96);
                            EIP.SetAttribute(ccPS.Print_Start_Delay_Reverse, 96);
                            EIP.SetAttribute(ccPS.Ink_Drop_Use, 2);
                            EIP.SetAttribute(ccPS.Ink_Drop_Charge_Rule, "Mixed");
                            EIP.SetAttribute(ccPS.Product_Speed_Matching, "None");
                        }
                    } catch (EIPIOException e1) {
                        // In case of an EIP I/O error
                        string name = EIP.GetAttributeName(e1.ClassCode, e1.Attribute);
                        string msg  = $"EIP I/O Error on {e1.AccessCode}/{e1.ClassCode}/{name}";
                        MessageBox.Show(msg, "EIP I/O Error", MessageBoxButtons.OK);
                        success = false;
                    } catch {
                        // You are on your own here
                    } finally {
                        EIP.UseAutomaticReflection = false; // Make things as fast as possible
                    }
                }
                EIP.ForwardClose();
            }
            EIP.EndSession();
            return(success);
        }
        // A Get/Set/Service request has completed
        private void EIP_IO_Complete(EIP sender, EIPEventArg e)
        {
            // Record status and color it
            txtStatus.Text = EIP.GetStatus;
            if (e.Successful)
            {
                txtStatus.BackColor = Color.LightGreen;
                switch (e.Class)
                {
                case ClassCode.Index:
                    switch (e.Access)
                    {
                    case AccessCode.Set:
                        // reflect any changes back to the Index Function
                        int n = Array.FindIndex(indexAttr.ccAttribute, x => x == e.Attribute);
                        indexAttr.texts[n].Text    = EIP.SetDataValue;
                        indexAttr.texts[n].Visible = true;
                        AttrData attr = EIP.GetAttrData((ccIDX)e.Attribute);
                        if (attr.Data.DropDown != fmtDD.None)
                        {
                            int i = EIP.SetDecValue - (int)attr.Data.Min;
                            if (i >= 0 && i < indexAttr.dropdowns[n].Items.Count)
                            {
                                indexAttr.dropdowns[n].SelectedIndex = i;
                                indexAttr.texts[n].Visible           = false;
                                indexAttr.dropdowns[n].Visible       = true;
                            }
                            else
                            {
                                indexAttr.dropdowns[n].Visible = false;
                            }
                        }
                        break;
                    }
                    break;

                case ClassCode.IJP_operation:
                    if ((ccIJP)e.Attribute == ccIJP.Online_Offline)
                    {
                        switch (e.Access)
                        {
                        case AccessCode.Set:
                            break;

                        case AccessCode.Get:
                            break;
                        }
                    }
                    break;
                }
            }
            else
            {
                txtStatus.BackColor = Color.Pink;
            }

            // Display the data sent to the printer
            txtCountOut.Text     = EIP.SetDataLength.ToString();
            txtDataOut.Text      = EIP.SetDataValue;
            txtDataBytesOut.Text = EIP.GetBytes(EIP.SetData, 0, EIP.SetDataLength);

            // Display the printer's response
            txtCountIn.Text     = EIP.GetDataLength.ToString();
            txtDataIn.Text      = EIP.GetDataValue;
            txtDataBytesIn.Text = EIP.GetBytes(EIP.GetData, 0, EIP.GetDataLength);

            // Record the operation in the log
            lstErrors.Items.Add($"{EIP.LastIO} -- {e.Access}/{e.Class}/{EIP.GetAttributeName(e.Class, e.Attribute)} Complete");
            lstErrors.SelectedIndex = lstErrors.Items.Count - 1;
        }
 // Log messages from EIP
 public void EIP_Log(EIP sender, string msg)
 {
     lstErrors.Items.Add(msg);
     lstErrors.SelectedIndex = lstErrors.Items.Count - 1;
 }
 private void EIP_VerifyEvent(EIP sender, string msg)
 {
     string[] v = msg.Split('\t');
     VerifyView.Rows.Add(v);
     VerifyView.FirstDisplayedScrollingRowIndex = VerifyView.RowCount - 1;
 }
 public Substitution(Browser parent, EIP EIP, TabPage tab)
 {
     this.parent = parent;
     this.EIP    = EIP;
     this.tab    = tab;
 }
 public Errors(Browser parent, EIP EIP, TabPage tab)
 {
     this.parent = parent;
     this.EIP    = EIP;
     this.tab    = tab;
 }
 // Just tuck away the calling parameters
 public UserPattern(Browser parent, EIP EIP, TabPage tab)
 {
     this.parent = parent;
     this.EIP    = EIP;
     this.tab    = tab;
 }
 public PrintManagement(Browser parent, EIP EIP, TabPage tab)
 {
     this.parent = parent;
     this.EIP    = EIP;
     this.tab    = tab;
 }
        // Run hard coded test
        private void cmdRunHardTest_Click(object sender, EventArgs e)
        {
            if (EIP.StartSession(true))
            {
                if (EIP.ForwardOpen())
                {
                    try {
                        // Run selected test
                        switch (cbAvailableHardTests.SelectedIndex)
                        {
                        case 0:
                            // Clean up the display
                            EIP.DeleteAllButOne();
                            // Gets us down to a single item
                            break;

                        case 1:
                            BuildShifts();
                            break;

                        case 2:
                            BuildMonthDaySR();
                            break;

                        case 3:
                            BuildTimeCount();
                            break;

                        case 4:
                            TryDayOfWeekEtc();
                            break;

                        case 5:
                            BuildMDYhms();
                            break;

                        case 6:
                            MultiLine();
                            break;

                        case 7:
                            CreateCounter();
                            break;

                        case 8:
                            ComprehensiveI();
                            break;

                        case 9:
                            ComprehensiveII();
                            break;

                        case 10:
                            SetText("{{MMM}/{DD}/{YY}}\n {{hh}:{mm}:{ss}}");
                            break;
                        }
                        //VerifyShifts(Item++);
                    } catch (EIPIOException e1) {
                        // In case of an EIP I/O error
                        string name = $"{EIP.GetAttributeName(e1.ClassCode, e1.Attribute)}";
                        string msg  = $"EIP I/O Error on {e1.AccessCode}/{e1.ClassCode}/{name}";
                        MessageBox.Show(msg, "EIP I/O Error", MessageBoxButtons.OK);
                    } catch {
                        // You are on your own here
                    }
                }
                EIP.ForwardClose();
            }
            EIP.EndSession();
        }