// // PUBLIC COM INTERFACE IFocuserV2 IMPLEMENTATION // #region Common properties and methods. /// <summary> /// Displays the Setup Dialog form. /// If the user clicks the OK button to dismiss the form, then /// the new settings are saved, otherwise the old values are reloaded. /// THIS IS THE ONLY PLACE WHERE SHOWING USER INTERFACE IS ALLOWED! /// </summary> public void SetupDialog() { // consider only showing the setup dialog if not connected // or call a different dialog if connected if (IsConnected) { System.Windows.Forms.MessageBox.Show("Already connected, just press OK"); } using (SetupDialogForm F = new SetupDialogForm()) { var result = F.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { WriteProfile(); // Persist device configuration values to the ASCOM Profile store } } }
public static void SetupDialog(int clientNumber) { TL.LogMessage(clientNumber, "SetupDialog", "Connected: " + IsHardwareConnected().ToString()); if (IsHardwareConnected()) { string msg = "Simulator is connected, setup parameters cannot be changed"; #if HAVE_UI MessageBox.Show(msg); #else TL.LogMessage(clientNumber, "SetupDialog", msg); #endif } else { #if HAVE_UI TL.LogMessage(clientNumber, "SetupDialog", "Creating setup form"); using (setupForm = new SetupDialogForm()) { TL.LogMessage(clientNumber, "SetupDialog", "Showing Dialogue"); var result = setupForm.ShowDialog(); TL.LogMessage(clientNumber, "SetupDialog", "Dialogue closed"); if (result == DialogResult.OK) { TL.LogMessage(clientNumber, "SetupDialog", "Dialogue closed with OK status"); WriteProfile(); // Persist device configuration values to the ASCOM Profile store } else { TL.LogMessage(clientNumber, "SetupDialog", "Dialogue closed with Cancel status"); } } if (!(setupForm == null)) { setupForm.Dispose(); setupForm = null; } #else TL.LogMessage(clientNumber, "SetupDialog", "No User Interface, skipping setup..."); #endif } }
public void SetupDialog() { using (var f = new SetupDialogForm()) { f.ShowDialog(); } }