Example #1
0
 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();
     }
 }
Example #2
0
        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);
            }
        }
Example #3
0
        /// <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));
        }
Example #4
0
        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);
            }
        }
Example #5
0
 public static string Choose(string cameraId)
 {
     using (Chooser chooser = new Chooser())
     {
         chooser.DeviceType = "Camera";
         return(chooser.Choose(cameraId));
     }
 }
Example #6
0
        /// <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));
     }
 }
Example #8
0
 /// <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));
     }
 }
Example #9
0
        /// <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));
        }
Example #10
0
 /// <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));
     }
 }
Example #11
0
 /// <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));
     }
 }
Example #12
0
 public static string Choose(string telescopeId)
 {
     using (Chooser chooser = new Chooser())
     {
         chooser.DeviceType = "Telescope";
         return(chooser.Choose(telescopeId));
     }
 }
Example #13
0
        // 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));
            }
        }
Example #14
0
 /// <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));
     }
 }
Example #15
0
        /// <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));
        }
Example #16
0
 public static string Choose(string videoId)
 {
     using (Chooser chooser = new Chooser())
     {
         chooser.DeviceType = "Video";
         return(chooser.Choose(videoId));
     }
 }
Example #17
0
        /// <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));
        }
Example #18
0
 public static string Choose(string switchId)
 {
     using (Chooser chooser = new Chooser())
     {
         chooser.DeviceType = "Switch";
         return(chooser.Choose(switchId));
     }
 }
Example #19
0
 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));
        }
Example #22
0
 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;
     }
 }
Example #23
0
 protected override void ProcessRecord()
 {
     //base.ProcessRecord();
     //WriteObject("Hello World!");
     if (m_deviceType != null)
     {
         m_chooser.DeviceType = m_deviceType;
     }
     WriteObject(m_chooser.Choose(m_driverId));
 }
Example #24
0
 /// <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("");
     }
 }
Example #25
0
 /// <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("");
     }
 }
Example #26
0
 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;
 }
Example #27
0
        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);
        }
Example #28
0
        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);
            }
        }
Example #29
0
        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);
            }
        }
Example #30
0
 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;
     }
 }
Example #31
0
        /// <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();
        }
Example #32
0
        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);
        }
Example #33
0
        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);
            }
        }