public override void Execute(Arguments arguments) { try { arguments.AssertMinimumCount(1); if (arguments.Exists(1) && arguments[1].Text == "/out") { FileName outfile = arguments[2].Text; if (outfile.Exists()) { outfile.Delete(); } fileStream = outfile.WritingStream(); writer = new StreamWriter(fileStream) { AutoFlush = true }; SetOut(writer); SetError(writer); } var file = arguments[0].FileName.Required($"File {arguments[0].Text} not found"); var chooser = new Chooser(file); chooser.Choose(); WriteLine("Done"); } finally { writer?.Close(); fileStream?.Close(); } }
private void btnSelect_Click(object sender, EventArgs e) { try { Chooser choose = new Chooser(); choose.DeviceType = "Telescope"; string ProgId = choose.Choose(progId); if (ProgId != "") { if (Driver != null) { Driver.Dispose(); } Driver = new Telescope(ProgId); btnSetup.Enabled = true; nameTextBox.Text = Driver.Name; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Brings up the ASCOM Chooser Dialog to choose a SafetyMonitor /// </summary> /// <param name="SafetyMonitorID">SafetyMonitor Prog ID for default or null for None</param> /// <returns>Prog ID for chosen SafetyMonitor or null for none</returns> public static string Choose(string SafetyMonitorID) { Chooser oChooser = new Chooser(); oChooser.DeviceType = "SafetyMonitor"; // Requires Helper 5.0.3 (May '07) return(oChooser.Choose(SafetyMonitorID)); }
private void btnSelect_Click(object sender, EventArgs e) { try { Chooser choose = new Chooser(); choose.DeviceType = "Telescope"; string ProgId = choose.Choose(progId); if (ProgId != "") { if (Driver != null) { Driver.Dispose(); } Driver = new Telescope(ProgId); btnSetup.Enabled = true; nameTextBox.Text = Driver.Name; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static string Choose(string cameraId) { using (Chooser chooser = new Chooser()) { chooser.DeviceType = "Camera"; return(chooser.Choose(cameraId)); } }
/// <summary> /// Brings up the ASCOM Chooser Dialog to choose a Switch /// </summary> /// <param name = "switchId">Switch Prog ID for default or null for None</param> /// <returns>Prog ID for chosen Switch or null for none</returns> public static string Choose(string switchId) { var oChooser = new Chooser { DeviceType = "Switch" }; return(oChooser.Choose(switchId)); }
public static string Choose(string observingConditionsId) { using (Chooser chooser = new Chooser()) { chooser.DeviceType = "ObservingConditions"; return(chooser.Choose(observingConditionsId)); } }
/// <summary> /// Brings up the ASCOM Chooser Dialogue to choose a CoverCalibrator /// </summary> /// <param name="coverCalibratorId">CoverCalibrator ProgID for default or null for None</param> /// <returns>ProgID for chosen CoverCalibrator or null for none</returns> public static string Choose(string coverCalibratorId) { using (Chooser chooser = new Chooser()) { chooser.DeviceType = "CoverCalibrator"; return(chooser.Choose(coverCalibratorId)); } }
/// <summary> /// The Choose() method returns the DriverID of the selected driver. /// Choose() allows you to optionally pass the DriverID of a "current" driver, /// and the corresponding camera type is pre-selected in the Chooser///s list. /// In this case, the OK button starts out enabled (lit-up); the assumption is that the pre-selected driver has already been configured. /// </summary> /// <param name="cameraId">Optional DriverID of the previously selected camera that is to be the pre-selected camera in the list.</param> /// <returns> /// The DriverID of the user selected camera. Null if the dialog is canceled. /// </returns> public static string Choose(string cameraId) { var oChooser = new Chooser { DeviceType = "Camera" }; return(oChooser.Choose(cameraId)); }
/// <summary> /// Brings up the ASCOM Chooser Dialog to choose a SafetyMonitor /// </summary> /// <param name="safetyMonitorId">SafetyMonitor Prog ID for default or null for None</param> /// <returns>Prog ID for chosen SafetyMonitor or null for none</returns> public static string Choose(string safetyMonitorId) { using (Chooser chooser = new Chooser()) { chooser.DeviceType = "SafetyMonitor"; return(chooser.Choose(safetyMonitorId)); } }
/// <summary> /// Brings up the ASCOM Chooser Dialogue to choose a Rotator /// </summary> /// <param name="rotatorId">Rotator ProgID for default or null for None</param> /// <returns>ProgID for chosen Rotator or null for none</returns> public static string Choose(string rotatorId) { using (Chooser chooser = new Chooser()) { chooser.DeviceType = "Rotator"; return(chooser.Choose(rotatorId)); } }
public static string Choose(string telescopeId) { using (Chooser chooser = new Chooser()) { chooser.DeviceType = "Telescope"; return(chooser.Choose(telescopeId)); } }
// No member here, we are relying on Dispose in the base class #endregion #endregion #region Convenience Members /// <summary> /// Brings up the ASCOM Chooser Dialog to choose a FilterWheel /// </summary> /// <param name="filterWheelId">FilterWheel Prog ID for default or null for None</param> /// <returns>Prog ID for chosen FilterWheel or null for none</returns> public static string Choose(string filterWheelId) { using (Chooser chooser = new Chooser()) { chooser.DeviceType = "FilterWheel"; return(chooser.Choose(filterWheelId)); } }
/// <summary> /// Brings up the ASCOM Chooser Dialog to choose a Focuser /// </summary> /// <param name="focuserId">Focuser Prog ID for default or null for None</param> /// <returns>Prog ID for chosen focuser or null for none</returns> public static string Choose(string focuserId) { using (Chooser chooser = new Chooser()) { chooser.DeviceType = "Focuser"; return(chooser.Choose(focuserId)); } }
/// <summary> /// Brings up the ASCOM Chooser Dialog to choose a Focuser /// </summary> /// <param name="focuserId">Focuser Prog ID for default or null for None</param> /// <returns>Prog ID for chosen focuser or null for none</returns> public static string Choose(string focuserId) { var oChooser = new Chooser { DeviceType = "Focuser" }; return(oChooser.Choose(focuserId)); }
public static string Choose(string videoId) { using (Chooser chooser = new Chooser()) { chooser.DeviceType = "Video"; return(chooser.Choose(videoId)); } }
/// <summary> /// Shows the ASCOM Chooser to select a Dome. /// </summary> /// <param name="domeId">Prog ID of the default dome to select. Null if no default is to be set.</param> /// <returns>The Prog ID of the Dome chosen, or Null if no dome is chose, or the dialog is canceled.</returns> public static string Choose(string domeId) { var oChooser = new Chooser { DeviceType = "Dome" }; return(oChooser.Choose(domeId)); }
public static string Choose(string switchId) { using (Chooser chooser = new Chooser()) { chooser.DeviceType = "Switch"; return(chooser.Choose(switchId)); } }
public static string Choose(string domeId) { using (Chooser chooser = new Chooser()) { chooser.DeviceType = "Dome"; return(chooser.Choose(domeId)); } }
public static string Choose(string id) { Chooser chooser = new Chooser { DeviceType = "Telescope" }; return(chooser.Choose(id)); }
public static string Choose(string id) { Chooser chooser = new Chooser { DeviceType = "Focuser" }; return(chooser.Choose(id)); }
private void btnChooseCCDCamera_Click(object sender, EventArgs e) { var chooser = new Chooser(); chooser.DeviceType = "Camera"; string driverProdId = chooser.Choose(); if (!string.IsNullOrEmpty(driverProdId)) { tbxCameraProgId.Text = driverProdId; } }
protected override void ProcessRecord() { //base.ProcessRecord(); //WriteObject("Hello World!"); if (m_deviceType != null) { m_chooser.DeviceType = m_deviceType; } WriteObject(m_chooser.Choose(m_driverId)); }
/// <summary> /// Brings up the ASCOM Chooser Dialog to choose a FilterWheel /// </summary> /// <param name="filterWheelId">FilterWheel Prog ID for default or null for None</param> /// <returns>Prog ID for chosen FilterWheel or null for none</returns> public static string Choose(string filterWheelId) { try { var oChooser = new Chooser { DeviceType = "FilterWheel" }; return(oChooser.Choose(filterWheelId)); } catch { return(""); } }
/// <summary> /// Brings up the ASCOM Chooser Dialog to choose a Rotator /// </summary> /// <param name="rotatorId">Focuser Prog ID for default or null for None</param> /// <returns>Prog ID for chosen Rotator or null for none</returns> public static string Choose(string rotatorId) { try { var oChooser = new Chooser { DeviceType = "Rotator" }; return(oChooser.Choose(rotatorId)); } catch { return(""); } }
private void ChooseButton_Click(object sender, EventArgs e) { ASCOM.Utilities.Chooser _chooser = new Chooser(); _chooser.DeviceType = "Focuser"; _progID = _chooser.Choose(_progID); _chooser.Dispose(); ChosenFocuser.Text = _progID; //_profile.WriteValue(_appID, "ChosenFocuser", _progID); if (_progID == "") return; if (_progID == "") ConnectButton.Enabled = false; else ConnectButton.Enabled = true; }
private void Form1_Shown(object sender, EventArgs e) { Chooser ch = new Chooser(); ch.DeviceType = "Focuser"; string device = ch.Choose(); if (string.IsNullOrEmpty(device)) { return; } m_fa = new FocusAdaptor(device, "Dummy Name"); focusControl.Initialize(m_fa); }
private void btnSelect_Click(object sender, RoutedEventArgs e) { try { Chooser choose = new Chooser(); choose.DeviceType = "Telescope"; string ProgId = choose.Choose(progId); if (ProgId != "") { Driver = new Telescope(ProgId); txtTelescopName.Text = Driver.Name; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void OnButton() { var ch = new Chooser {DeviceType = "Telescope"}; var device = ch.Choose(); if (string.IsNullOrEmpty(device)) return; try { var scope = CreateScope(device); Settings1.Default.LastMountId = device; Settings1.Default.LastMount = scope.Name; Settings1.Default.Save(); } catch (Exception e) { _state.ShowMessage("Cannot create ASCOM mount driver " + device + "\r\nBecause : " + e.Message); } }
private void ChooseButton_Click(object sender, EventArgs e) { ASCOM.Utilities.Chooser _chooser = new Chooser(); _chooser.DeviceType = "Focuser"; _progID = _chooser.Choose(_progID); _chooser.Dispose(); ChosenFocuser.Text = _progID; //_profile.WriteValue(_appID, "ChosenFocuser", _progID); if (_progID == "") { return; } if (_progID == "") { ConnectButton.Enabled = false; } else { ConnectButton.Enabled = true; } }
/// <summary> /// Event handler for Choose button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnChoose_Click(System.Object sender, System.EventArgs e) { Chooser chooser = new Chooser(); string NewDevice = null; CurrentDeviceType = cmbDeviceType.SelectedItem.ToString(); chooser.DeviceType = CurrentDeviceType; if (string.IsNullOrEmpty(CurrentDevice)) { CurrentDevice = DefaultDevices[CurrentDeviceType.ToUpperInvariant()]; txtDevice.Text = DefaultDevices[CurrentDeviceType.ToUpperInvariant()]; } NewDevice = chooser.Choose(CurrentDevice); if (!string.IsNullOrEmpty(NewDevice)) { CurrentDevice = NewDevice; } txtDevice.Text = CurrentDevice; chooser.Dispose(); }
protected override void OnKeyDown(KeyEventArgs e) { if (e.KeyData == Keys.F9) { var mnuContext = _grid.ContextMenuStrip; ToolStripMenuItem menuRun = (ToolStripMenuItem)mnuContext.Items["EditRun"]; if (menuRun.HasDropDownItems) { var m = GetFromMenuItems(menuRun.DropDownItems).Where(mi => mi != null && mi.Name != "Blank"); if (m != null && m.Count() > 0) { string key = Chooser.Choose(m.Select(mi => new KeyValuePair <string, string>(mi.Name, mi.Text)), 0); if (!key.IsEmpty()) { ExecuteAction(key); } } } } else if (e.KeyData == Keys.F7) { ToolStripMenuItem menuRel = (ToolStripMenuItem)(GetControl <MenuStrip>("MenuBar").Items["File"] as ToolStripMenuItem) .DropDownItems["FileOpenRelated"]; if (menuRel.HasDropDownItems) { var m = GetFromMenuItems(menuRel.DropDownItems).Where(mi => mi != null); string key = Chooser.Choose(m.Select(mi => new KeyValuePair <string, string>(mi.Name, mi.Text)), 0); if (!key.IsEmpty()) { OpenRelated(key); } } } base.OnKeyDown(e); }
public void OnButton() { var ch = new Chooser { DeviceType = "Telescope" }; var device = ch.Choose(); if (string.IsNullOrEmpty(device)) { return; } try { var scope = CreateScope(device); Settings1.Default.LastMountId = device; Settings1.Default.LastMount = scope.Name; Settings1.Default.Save(); } catch (Exception e) { _state.ShowMessage("Cannot create ASCOM mount driver " + device + "\r\nBecause : " + e.Message); } }