Example #1
0
        private void button_Click(object sender, EventArgs e)
        {
            Button Bt = (Button)sender;

            this.Hide();
            switch (Convert.ToString(Bt.Tag)) //Needs to be linked with database
            {
            case "City":

                ShowBike citybike = new ShowBike("City", ref _currentUser);
                citybike.FormClosed += (s, args) => this.Close();
                citybike.Show();
                break;

            case "Adventure":
                ShowBike adventure = new ShowBike("Adventure", ref _currentUser);
                adventure.FormClosed += (s, args) => this.Close();
                adventure.Show();
                break;

            case "Explorer":
                ShowBike explorerbike = new ShowBike("Explorer", ref _currentUser);
                explorerbike.FormClosed += (s, args) => this.Close();
                explorerbike.Show();
                break;

            case "Electric":
                //to implement
                break;
            }
        }
Example #2
0
        void ButtonClickOneEvent(object sender, EventArgs e)
        {
            Button button = sender as Button;

            if (button != null)
            {
                // now you know the button that was clicked
                this.Hide();
                try
                {
                    ShowBike explorerbike = new ShowBike(button.Text, ref _currentUser);
                    explorerbike.FormClosed += (s, args) => this.Close();
                    explorerbike.Show();
                }
                catch
                {
                    ShowBike explorerbike = new ShowBike("City", ref _currentUser);
                    explorerbike.FormClosed += (s, args) => this.Close();
                    explorerbike.Show();
                }
            }
        }