예제 #1
0
파일: FormScanOut.cs 프로젝트: N90K/TNBase
        public void addScanItem(int walletId)
        {
            bool scannedAlready = false;

            // Actually process the scanned items!
            for (int i = 0; i <= (lstScanned.Items.Count - 1); i++)
            {
                ListViewItem item = lstScanned.Items[i];
                // If the item exists, just update the quantity.
                if ((item.SubItems[0].Text == walletId.ToString()))
                {
                    scannedAlready = true;
                }
            }

            if ((walletId == lastScanned | scannedAlready))
            {
                txtScannerInput.Text = "";
                ModuleSounds.PlayTwoOut();
                MessageBox.Show("You have just tried to scan the same wallet out twice. Second entry rejected.");
            }
            else
            {
                addListItem(walletId);
            }
            lastScanned = walletId;
        }
예제 #2
0
파일: FormScanOut.cs 프로젝트: N90K/TNBase
 private void doScanAction()
 {
     if ((Information.IsNumeric(txtScannerInput.Text)))
     {
         ModuleSounds.PlayBeep();
         addScanItem(int.Parse(txtScannerInput.Text));
     }
     else if (txtScannerInput.Text.Length > 0)
     {
         txtScannerInput.Text = "";
         ModuleSounds.PlayInvalidBarcode();
     }
 }
예제 #3
0
 public void addScanItem(int walletId)
 {
     if ((walletId == lastScanned))
     {
         ModuleSounds.PlayExplode();
         My.MyProject.Forms.formDuplicateFound.Show();
         My.MyProject.Forms.formDuplicateFound.setupForm(walletId);
     }
     else
     {
         addListItem(walletId);
     }
     lastScanned = walletId;
 }
예제 #4
0
파일: FormScanOut.cs 프로젝트: N90K/TNBase
        public void addListItem(int walletId)
        {
            // If there is no duplicate, just add the item.
            string[]     arr = new string[3];
            ListViewItem itm = null;

            //Add first item
            arr[0] = walletId.ToString();
            arr[1] = "1";

            itm = new ListViewItem(arr);
            lstScanned.Items.Add(itm);

            txtScannerInput.Text = "";
            scannedOut           = scannedOut + 1;

            // Focus list item properly.
            lstScanned.Focus();
            lstScanned.Items[lstScanned.Items.Count - 1].Selected = true;
            lstScanned.Items[lstScanned.Items.Count - 1].Focused  = true;
            lstScanned.Items[lstScanned.Items.Count - 1].EnsureVisible();
            txtScannerInput.Focus();

            // Process and play a second beep.
            ModuleGeneric.Sleep(100);
            Listener theListener = default(Listener);

            theListener = serviceLayer.GetListenerById(walletId);
            if (((theListener == null)))
            {
                ModuleSounds.PlayNotInUse();
            }
            else
            {
                if (theListener.Status == ListenerStates.ACTIVE & (theListener.Joined > DateTime.Now.AddDays(-6) & theListener.Stock == 3))
                {
                    ModuleSounds.PlayNew();
                }
                else if (theListener.Status == ListenerStates.PAUSED)
                {
                    ModuleSounds.PlayStopped();
                }
                else
                {
                    ModuleSounds.PlaySecondBeep();
                }
            }
        }
예제 #5
0
 private void doScanAction()
 {
     if ((Information.IsNumeric(txtScannerInput.Text)))
     {
         ModuleSounds.PlayBeep();
         try
         {
             addScanItem(int.Parse(txtScannerInput.Text));
         }
         catch (Exception e)
         {
             log.Warn(e, "Failed to parse large integer on scanning: " + txtScannerInput.Text);
         }
     }
     else if (txtScannerInput.Text.Length > 0)
     {
         txtScannerInput.Text = "";
         ModuleSounds.PlayInvalidBarcode();
     }
 }
예제 #6
0
        public void addListItem(int walletId)
        {
            for (int i = 0; i <= (lstScanned.Items.Count - 1); i++)
            {
                ListViewItem item = lstScanned.Items[i];
                // If the item exists, just update the quantity.
                if (item.SubItems[0].Text == walletId.ToString())
                {
                    var currentQuantity = int.Parse(item.SubItems[1].Text);
                    currentQuantity = currentQuantity + 1;
                    if (currentQuantity == 2)
                    {
                        ModuleSounds.PlayTwoIn();
                    }
                    else if (currentQuantity == 3)
                    {
                        ModuleSounds.PlayThreeIn();
                    }
                    else if (currentQuantity == 3)
                    {
                        // 3 is the max..
                        currentQuantity = 3;
                    }
                    else
                    {
                        ModuleSounds.PlaySecondBeep();
                    }
                    item.SubItems[1].Text = currentQuantity.ToString();
                    // Clear text and play duplicate sound.
                    txtScannerInput.Text = string.Empty;
                    scannedIn            = scannedIn + 1;

                    // Focus list item properly.
                    lstScanned.Focus();
                    lstScanned.Items[i].Selected = true;
                    lstScanned.Items[i].Focused  = true;
                    lstScanned.Items[i].EnsureVisible();
                    txtScannerInput.Focus();

                    // Check they exist again!
                    if (serviceLayer.GetListenerById(walletId) == null)
                    {
                        ModuleSounds.PlayNotInUse();
                    }

                    return;
                }
            }

            // If there is no duplicate, just add the item.
            string[]     arr = new string[3];
            ListViewItem itm = null;

            //Add first item
            arr[0] = walletId.ToString();
            arr[1] = "1";

            itm = new ListViewItem(arr);
            lstScanned.Items.Add(itm);

            txtScannerInput.Text = "";
            scannedIn            = scannedIn + 1;

            // Focus list item properly.
            lstScanned.Focus();
            lstScanned.Items[lstScanned.Items.Count - 1].Selected = true;
            lstScanned.Items[lstScanned.Items.Count - 1].Focused  = true;
            lstScanned.Items[lstScanned.Items.Count - 1].EnsureVisible();
            txtScannerInput.Focus();

            // Process and play a second beep.
            ModuleGeneric.Sleep(100);
            Listener theListener = default(Listener);

            theListener = serviceLayer.GetListenerById(walletId);
            if (theListener == null)
            {
                ModuleSounds.PlayNotInUse();
            }
            else
            {
                if (theListener.Status == ListenerStates.PAUSED)
                {
                    ModuleSounds.PlayStopped();
                }
                else if (theListener.Status == ListenerStates.DELETED)
                {
                    ModuleSounds.PlayNotInUse();
                    Interaction.MsgBox("This listener has been deleted. Please remove the label and place wallet into the stock of unused wallets.");
                }
                else
                {
                    ModuleSounds.PlaySecondBeep();

                    // Asynchronous
                    //synthesizer.Volume = 100;
                    //synthesizer.Rate = -2;
                    //synthesizer.SpeakAsync(new Prompt("" + walletId));
                }
            }
        }