示例#1
0
        //adds iceCream to ouput text
        private void AddToOutput()
        {
            if (iceCreamNameFound)
            {
                int charLocation = OutputLabel.Text.IndexOf("*", StringComparison.Ordinal);

                if (charLocation == 0 || charLocation == OutputLabel.Text.Length - 1)
                {
                    textBox1.Text = String.Empty;
                    return;
                }

                int    ammount = int.Parse(OutputLabel.Text.Substring(0, charLocation));
                string name    = OutputLabel.Text.Substring(charLocation + 1);

                for (int i = 0; i < ex.getIceCreamList().Count; i++)
                {
                    if (ex.getIceCreamList()[i].getname() == name)
                    {
                        IceCream select = new IceCream(ex.getIceCreamList()[i].getID(), ex.getIceCreamList()[i].getname(), ex.getIceCreamList()[i].gettype());
                        select.setAmount(ammount);
                        selectedData.addToList(select);
                        break;
                    }
                }

                reDrawOutput();
            }
            else
            {
                textBox1.Text = String.Empty;
            }

            canPrint();
        }