Beispiel #1
0
        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();
                }
            }
        }
Beispiel #2
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));
                }
            }
        }