void SetNull(object sender, EventArgs e) { app = null; }
/// <summary> /// The interface is created here, hidden and disabled when not needed and quickly resumes when it is. /// </summary> void ChangeInterface() { // If the interface window doesn't exist yet or got closed by the user if (app == null) { app = new MainWindow(); app.Closed += SetNull; } // Show or hide the window if (!app.IsVisible) { // get the window datacontext MainInterface con = app.DataContext as MainInterface; con.Mouse.AlterSettings(s, es, sp); // Mouse update app.Show(); } else if (app.IsVisible) { app.Hide(); } }