Example #1
0
        /// <summary>
        /// event handler de geselecteerde stack laad en de andere stacks leeg maakt.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SelectRadiobutton(object sender, EventArgs e)
        {
            switch (((Control)sender).Text)
            {
            case "arraystack":
                selectedStack = "arraystack";
                listbox.Items.Clear();
                MLstack = null;
                Lstack  = null;
                break;

            case "Liststack":
                selectedStack = "Liststack";
                listbox.Items.Clear();
                MLstack = null;
                Astack  = null;
                break;

            case "MyListstack":
                selectedStack = "MyListStack";
                listbox.Items.Clear();
                Astack = null;
                Lstack = null;
                break;
            }
        }
Example #2
0
        /// <summary>
        /// functie die de text in de label verplaatst naar de listbox en de geselecteerde stack
        /// daarna wordt de label weer geleegd
        /// </summary>
        private void Submitevent()
        {
            if (text != "" && text != "+" && text != "-" && text != "*" && text != "/")
            {
                listbox.Items.Add(Convert.ToDecimal(text));
                switch (selectedStack)
                {
                case "arraystack":
                    if (Astack == null)
                    {
                        Astack = new ArrayStack <decimal>();
                    }
                    Astack.Push(Convert.ToDecimal(text));
                    break;

                case "Liststack":
                    if (Lstack == null)
                    {
                        Lstack = new ListStack <decimal>();
                    }
                    Lstack.Push(Convert.ToDecimal(text));
                    break;

                case "MyListStack":
                    if (MLstack == null)
                    {
                        MLstack = new MyListStack <decimal>();
                    }
                    MLstack.Push(Convert.ToDecimal(text));
                    break;
                }
                text       = "";
                label.Text = "";
            }
        }