/// <summary> /// identify the screen with the given id /// </summary> /// <param name="id">the id of the screen to identify</param> /// <param name="timeout">for how long to show the ui</param> public static void IdentifyScreen(int id, int timeout = 5000) { //bounds check if (id < 0 || id >= Screen.AllScreens.Length) { return; } //show ui ScreenIdentifierUI ui = new ScreenIdentifierUI(id); ui.Show(); //hide ui after timeout Task.Run(async() => { await Task.Delay(timeout); ui.Invoke(new MethodInvoker(() => { ui.Close(); })); }); }
/// <summary> /// identify screens button clicked, show screen identification ui /// </summary> void OnIdentifyScreenIds(object sender, EventArgs e) { ScreenIdentifierUI.IdentifyAllScreens(); }