private void Form1_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyData) { case Keys.F5: Cursor.Current = Cursors.WaitCursor; VlcViewer.DisconnectAll(myVlcControl); InitializeForm(); Cursor.Current = Cursors.Default; break; case Keys.F11: if (WindowState != FormWindowState.Maximized) { // Change border style first or else the ClientSize will be larger than the screen dimensions FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized; } else { WindowState = FormWindowState.Normal; FormBorderStyle = FormBorderStyle.Sizable; } break; case Keys.Control | Keys.D: foreach (Control c in this.Controls) { if (c.Tag?.ToString() == "Debug") { c.Visible = !c.Visible; c.BringToFront(); } } break; } // Call preset if number key pressed if (char.IsDigit((char)e.KeyCode) && vlcOverlay[ActiveViewer].PtzController != null) { int preset = (int)e.KeyValue - (int)Keys.D0; if (preset > 0) { vlcOverlay[ActiveViewer].ShowNotification(string.Format("Preset {0}", preset), 2000); try { vlcOverlay[ActiveViewer].PtzController.ShowPreset(preset); } catch (IndexOutOfRangeException) { vlcOverlay[ActiveViewer].ShowNotification(string.Format("Preset #{0} undefined", preset), 3000); } } } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { Cursor.Current = Cursors.WaitCursor; VlcViewer.DisconnectAll(myVlcControl); // Call disconnect (if tagClient is not null) //tagClient?.Disconnect(); Cursor.Current = Cursors.Default; log.Info("Application Form closing"); }