public AddApplication(GamingUseCase game) { this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); InitializeComponent(); // These simply set the order of Tabs and allow these controls to be changed via Tab textBox1.TabStop = true; textBox1.TabIndex = 0; textBox1.ReadOnly = true; textBox2.TabStop = true; textBox2.TabIndex = 1; textBox2.ReadOnly = true; textBox3.TabStop = true; textBox3.TabIndex = 2; button1.TabStop = true; button1.TabIndex = 4; button2.TabStop = true; button2.TabIndex = 3; // Add keydown events on the constructor here // Gets overwritten when this is put in the designer.cs adn the form changes textBox1.KeyDown += textBox1_KeyDown; textBox2.KeyDown += textBox2_KeyDown; textBox3.KeyDown += textBox3_KeyDown; button1.KeyDown += button1_KeyDown; button2.KeyDown += button2_KeyDown; this.Click += Form_OnClick; GamingWindow = game; // Bring focus this.Activate(); }
private void open_gaming_case(object sender, RoutedEventArgs e) { // If the application is already open, then don't open another instance... if (currentInstance) { MessageBox.Show("What are you doing? You have an instance of this window open already!", "Already opened"); return; } currentInstance = true; game_window = new GamingUseCase(); game_window.Show(); // After showing the gaming use case window, the behavior will force both windows' opacities to be the same // To prevent this behavior, manually change the main window's background brush and opacity background_design_change_nosender(); }