Ejemplo n.º 1
0
        private void ScanTB_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                var item = listView1.FindItemWithText(ScanTB.Text.Trim());

                if (item != null)
                {
                    //item.Selected = true;
                    item.Checked = true;
                }

                ScanTB.Text = "";

                ScanTB.Focus();


                //                 MessageBox.Show(ScanTB.Text);
                //
                //                 int index = listView1.FindString(myString, -1);
                //                 if (index != -1)
                //                 {
                //                     // Select the found item:
                //                     listBox1.SetSelected(index, true);
                //                     // Send a success message:
                //                     MessageBox.Show("Found the item \"" + myString +
                //                         "\" at index: " + index);
                //                 }
                //                 else
                //                     MessageBox.Show("Item not found.");
            }
        }
Ejemplo n.º 2
0
        // ja - to make the call to the listview thread safe
        //         private delegate ListView.ListViewItemCollection GetItems(ListView lstview);
        //
        //         private ListView.ListViewItemCollection getListViewItems(ListView lstview)
        //         {
        //             ListView.ListViewItemCollection temp = new ListView.ListViewItemCollection(new ListView());
        //             if (!lstview.InvokeRequired)
        //             {
        //                 foreach (ListViewItem item in listView1.Items)
        //                     temp.Add((ListViewItem)item.Clone());
        //                 return temp;
        //             }
        //             else
        //                 return (ListView.ListViewItemCollection)this.Invoke(new GetItems(getListViewItems), new object[] { listView1 });
        //         }

        private void GoBtn_Click(object sender, EventArgs e)
        {
            StatusLabel.Text = "Reading Data from Database...";


            GoBtn.Enabled    = false;
            printBtn.Enabled = false;

            listView1.Clear();
            checkAllChk.Checked = false;

            bool bFinalOverride = singleFinalRB.Checked;

            string sLabelLocation = "";

            ThePrinterArea = 0;


            if (Smt)
            {
                sLabelLocation = "smt_label";
                ThePrinterArea = PrinterArea.smt;

                SmtForm dlg = new SmtForm();
                var     res = dlg.ShowDialog();

                if (res == DialogResult.OK)
                {
                    SmtCount         = dlg.SmtCount;
                    workcodeTB.Text  = dlg.WorkCode;
                    GoBtn.Text       = "Print";
                    clearBtn.Visible = false;
                    printBtn.Visible = false;
                }
                else
                {
                    return;
                }
            }
            else if (BasePlate)
            {
                sLabelLocation = "Large_AMC_BasePlate";
                //sLabelLocation = "burst1_2d";
                ThePrinterArea = PrinterArea.baseplate;

                if (CheckForBurstedSerials())
                {
                    BurstLabels = true;
                }
            }
            else if (InProcess)
            {
                sLabelLocation = "Small_AMC_InProcess";
                //sLabelLocation = "inproc2_2d";
                ThePrinterArea = PrinterArea.in_process;

                if (!RePrintPromt())
                {
                    MessageBox.Show("Aborting Printing");
                    reset_btn.PerformClick();
                    return;
                }
            }
            else if (Final)
            {
                sLabelLocation = "inproc2_2d";
                ThePrinterArea = PrinterArea.final;
            }

            //string sWorkCode = workcodeTB.Text.Trim();
            bool bPrintNow = forcePrintNowCB.Checked == true;

            if (bFinalOverride)
            {
                //LabelOverrides labelOverride = GetOverride();
                string labelOverride = GetFinalDropDownValue();

                LabelGeneratorLib = new LabelGen(labelOverride, true);
            }
            else
            {
                LabelGeneratorLib = new LabelGen(sLabelLocation, true);
            }

            //DataReadThread

            InitLabelGen();

            GoBtn.Enabled    = false;
            clearBtn.Enabled = true;
            printBtn.Enabled = true;

            if (BurstLabels && InProcess)
            {
                RemoveBurstedSerials();
            }

            StatusLabel.Text = "Data Populated...";

            ScanTB.Focus();
        }