Ejemplo n.º 1
0
        private void SetupDialogForm_Load(object sender, EventArgs e)
        {
            string portName;

            using (ASCOM.Utilities.Profile p = new ASCOM.Utilities.Profile())
            {
                p.DeviceType = "Focuser";
                portName     = p.GetValue(Focuser.driverId, "ComPort");
                if (p.GetValue(Focuser.driverId, "TempDisp").Equals("C"))
                {
                    radioCelcius.Checked = true;
                }
                else
                {
                    radioCelcius.Checked = false;
                }
                textBoxRpm.Text = p.GetValue(Focuser.driverId, "RPM");
                if (!(textBoxRpm.Text.Length > 0))
                {
                    textBoxRpm.Text = "75";
                }
            }

            foreach (string s in SerialPort.GetPortNames())
            {
                cbComPort.Items.Add(s);
            }

            cbComPort.SelectedItem = portName;
        }
Ejemplo n.º 2
0
        private void RefreshDome()
        {
            if (!panelDome.Visible)
            {
                return;
            }

            if (labelDomeSlavedConfValue.Text == string.Empty)
            {
                using (ASCOM.Utilities.Profile driverProfile = new ASCOM.Utilities.Profile())
                {
                    driverProfile.DeviceType = "Telescope";
                    bool confDomeSlaved = Convert.ToBoolean(driverProfile.GetValue("ASCOM.Wise40.Telescope", "Enslave Dome", string.Empty, "false"));

                    labelDomeSlavedConfValue.Text = confDomeSlaved ? "Enslaved" : "Not enslaved" + " while tracking";
                }
            }

            if (wisedome.Connected)
            {
                string shutterStatus;
                groupBoxDome.Text = string.Format(" {0} v{1} ", wisedome.Name, wisedome.DriverVersion);

                labelDomeAzimuthValue.Text = wisedome.Calibrated ? wisedome.Azimuth.ToNiceString() : "not calibrated";
                labelDomeStatusValue.Text  = wisedome.Status;

                switch (wisedome.ShutterStatus)
                {
                case ShutterState.shutterClosed:
                    shutterStatus = "Closed";
                    break;

                case ShutterState.shutterClosing:
                    shutterStatus = "Closing";
                    break;

                case ShutterState.shutterOpen:
                    shutterStatus = "Open";
                    break;

                case ShutterState.shutterOpening:
                    shutterStatus = "Opening";
                    break;

                default:
                    shutterStatus = "Unknown";
                    break;
                }
                labelDomeShutterStatusValue.Text = shutterStatus;
            }
            else
            {
                groupBoxDome.Text = " Dome (not connected) ";

                labelDomeAzimuthValue.Text       = string.Empty;
                labelDomeStatusValue.Text        = string.Empty;
                labelDomeShutterStatusValue.Text = string.Empty;
            }
        }
Ejemplo n.º 3
0
        public SetupDialogForm()
        {
            profile.DeviceType = "Telescope";
            InitializeComponent();

            this.comboComPort.Items.AddRange(System.IO.Ports.SerialPort.GetPortNames());
            this.comboComPort.SelectedItem = profile.GetValue(ASCOM.Arduino.Telescope.s_csDriverID, "ComPort");
        }
Ejemplo n.º 4
0
        private string DeviceName(string deviceType, string driverId)
        {
            if (driverId.Length == 0)
            {
                return(String.Empty);
            }

            using (ASCOM.Utilities.Profile profile = new ASCOM.Utilities.Profile())
            {
                profile.DeviceType = deviceType;
                return(profile.GetValue(driverId, string.Empty, string.Empty, driverId));
            }
        }
Ejemplo n.º 5
0
        private void SetupDialogForm_Load(object sender, EventArgs e)
        {
            string portName;
            using (ASCOM.Utilities.Profile p = new ASCOM.Utilities.Profile())
            {
                p.DeviceType = "Focuser";
                portName = p.GetValue(Focuser.driverId, "ComPort");
                if (p.GetValue(Focuser.driverId, "TempDisp").Equals("C"))
                    radioCelcius.Checked = true;
                else
                    radioCelcius.Checked = false;
                textBoxRpm.Text = p.GetValue(Focuser.driverId, "RPM");
                if (!(textBoxRpm.Text.Length > 0))
                    textBoxRpm.Text = "75";
            }

            foreach (string s in SerialPort.GetPortNames())
            {
                cbComPort.Items.Add(s);
            }

            cbComPort.SelectedItem = portName;
        }
        public ParkHomeAndStartupForm()
        {
            InitializeComponent();

            // Draw the combobox in combobox style rather than comboboxlist style
            cmbStartupMode.DrawMode  = DrawMode.OwnerDrawVariable;
            cmbStartupMode.DrawItem += DropDownListComboBox_DrawItem;

            // Set invalid input event handlers
            txtStartAzimuth.TextChanged  += Textbox_TextChanged;
            txtStartAltitude.TextChanged += Textbox_TextChanged;
            txtParkAzimuth.TextChanged   += Textbox_TextChanged;
            txtParkAltitude.TextChanged  += Textbox_TextChanged;
            TxtHomeAzimuth.TextChanged   += Textbox_TextChanged;
            TxtHomeAltitude.TextChanged  += Textbox_TextChanged;

            txtStartAzimuth.Validating  += TextBox_Validating;
            txtStartAltitude.Validating += TextBox_Validating;
            txtParkAzimuth.Validating   += TextBox_Validating;
            txtParkAltitude.Validating  += TextBox_Validating;
            TxtHomeAzimuth.Validating   += TextBox_Validating;
            TxtHomeAltitude.Validating  += TextBox_Validating;

            // Populate startup options list
            foreach (string option in TelescopeHardware.StartupOptions)
            {
                cmbStartupMode.Items.Add(option);
            }

            string startupOption;

            using (ASCOM.Utilities.Profile profile = new ASCOM.Utilities.Profile())
            {
                startupOption = profile.GetValue(SharedResources.PROGRAM_ID, "StartUpMode", "", TelescopeHardware.StartupOptions[0]);
            }

            cmbStartupMode.SelectedItem = startupOption;

            // Populate the form text boxes
            txtStartAzimuth.Text  = TelescopeHardware.StartCoordinates.X.ToString();
            txtStartAltitude.Text = TelescopeHardware.StartCoordinates.Y.ToString();
            txtParkAzimuth.Text   = TelescopeHardware.ParkAzimuth.ToString();
            txtParkAltitude.Text  = TelescopeHardware.ParkAltitude.ToString();
            TxtHomeAzimuth.Text   = TelescopeHardware.HomePosition.X.ToString();
            TxtHomeAltitude.Text  = TelescopeHardware.HomePosition.Y.ToString();
        }
Ejemplo n.º 7
0
        public void init()
        {
            if (_initialized)
            {
                return;
            }

            using (ASCOM.Utilities.Profile driverProfile = new ASCOM.Utilities.Profile()
            {
                DeviceType = "FilterWheel"
            })
            {
                string port = driverProfile.GetValue(Const.wiseFilterWheelDriverID, "Port", string.Empty, "COM7");
                if (System.IO.Ports.SerialPort.GetPortNames().Contains(port))
                {
                    _serialPortName = port;
                    _serialPort     = new System.IO.Ports.SerialPort(_serialPortName, _serialPortSpeed);
                    communicationCompleteHandler += onCommunicationComplete;
                }
            }

            _initialized = true;
        }
Ejemplo n.º 8
0
 public string ReadStringFromProfile(string Key)
 {
     return(Profile.GetValue(ProfileName, Key));
 }
Ejemplo n.º 9
0
 public string Get(string name, string defaultval)
 {
     return(profile.GetValue(SharedResources.ScopeDriverId, name, string.Empty, defaultval));
 }