/// <summary> /// The <see cref="Control.Click"/> event handler for the /// <see cref="Button"/> <see cref="TrackerWithStatusControls.ShowOnSecondaryScreenButton"/>. /// Shows a new track status object in a new thread. /// </summary> /// <param name="sender"> /// Source of the event. /// </param> /// <param name="e"> /// An empty <see cref="EventArgs"/>. /// </param> protected override void BtnShowOnPresentationScreenClick(object sender, EventArgs e) { if (this.ShowOnSecondaryScreenButton.Text.Contains("Show")) { // Should show TrackStatusDlg if (this.dlgTrackStatus != null) { this.dlgTrackStatus.Dispose(); } this.dlgTrackStatus = new TobiiTrackStatus(this.Settings); Rectangle presentationBounds = PresentationScreen.GetPresentationWorkingArea(); this.dlgTrackStatus.Location = new Point( presentationBounds.Left + presentationBounds.Width / 2 - this.dlgTrackStatus.Width / 2, presentationBounds.Top + presentationBounds.Height / 2 - this.dlgTrackStatus.Height / 2); // Dialog will be disposed when connection failed. if (!this.dlgTrackStatus.IsDisposed) { this.ShowOnSecondaryScreenButton.Text = "Hide from presentation screen"; this.ShowOnSecondaryScreenButton.BackColor = Color.Red; this.dlgTrackStatus.Show(); } } else { // Should hide TrackStatusDlg if (this.dlgTrackStatus != null) { this.ShowOnSecondaryScreenButton.BackColor = Color.Transparent; this.ShowOnSecondaryScreenButton.Text = "Show on presentation screen"; this.dlgTrackStatus.Close(); } } }