Exemplo n.º 1
0
        private void pbOK_Click(object sender, EventArgs e)
        {
            Speech.SpeechType flags = 0;

            if (chkCommand.Checked) flags |= Speech.SpeechType.Command;
            if (chkErrors.Checked) flags |= Speech.SpeechType.Error;
            if (chkNotify.Checked) flags |= Speech.SpeechType.Announcement;
            if (chkStatus.Checked) flags |= Speech.SpeechType.Status;

            m_Flags = flags;
            m_Voice = (string)(cmbVoices.SelectedIndex>=0? cmbVoices.SelectedItem : "");
        }
        public TelescopeSetupDialogForm()
        {
            m_DoneInitialize = false;

            InitializeComponent();
            InitializeLocal();

            foreach (string s in System.IO.Ports.SerialPort.GetPortNames())
            {
                comboBoxComPort.Items.Add(s);
            }

            // if a network connection is available, add 'Ethernet' for Gemini II 
            if (System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces().Any(
                x => x.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up))
            {
                comboBoxComPort.Items.Add("Ethernet");
            }

            string[] joys = Joystick.JoystickNames;
            if (joys != null)
            {
                foreach (string s in Joystick.JoystickNames)
                {
                    cmbJoystick.Items.Add(s);
                }
                cmbJoystick.SelectedItem = GeminiHardware.Instance.JoystickName;

                chkJoystick.CheckState = GeminiHardware.Instance.UseJoystick ? CheckState.Checked : CheckState.Unchecked;
                if (!chkJoystick.Checked) cmbJoystick.Enabled = false;
                chkJoystick.BackColor = Color.Transparent;
            }
            else
            {   // no joysticks detected
                chkJoystick.CheckState = CheckState.Unchecked;
                chkJoystick.Enabled = false;
                cmbJoystick.Enabled = false;
                chkJoystick.BackColor= Color.FromArgb(64, 64, 64);

            }

            chkVoice.Checked = GeminiHardware.Instance.UseSpeech;
            m_SpeechVoice = GeminiHardware.Instance.SpeechVoice;
            m_SpeechFlags = GeminiHardware.Instance.SpeechFilter;

            Version version = new Version(Application.ProductVersion);
            labelVersion.Text = "ASCOM Gemini Telescope .NET " + string.Format("Version {0}.{1}.{2}", version.Major, version.Minor, version.Build);
            TimeZone localZone = TimeZone.CurrentTimeZone;
            
            labelTime.Text = "Time zone is " + (localZone.IsDaylightSavingTime(DateTime.Now)? localZone.DaylightName : localZone.StandardName);

            foreach (string tz in TimeZones)
            {
                int idx = comboBoxTZ.Items.Add(tz);
            }

            chkSetLanguage.Checked = GeminiHardware.Instance.SetLanguage;

            m_DoneInitialize = true;
        }
 private void chkVoice_CheckedChanged(object sender, EventArgs e)
 {
     if (chkVoice.Checked && m_DoneInitialize)
     {
         frmVoice frm = new frmVoice();
         frm.Flags = m_SpeechFlags;
         frm.Voice = m_SpeechVoice;
         DialogResult res = frm.ShowDialog(this);
         if (res == DialogResult.Cancel) chkVoice.Checked = false;
         else
         {
             m_SpeechVoice = frm.Voice;
             m_SpeechFlags = frm.Flags;
         }
         m_UseSpeech = chkVoice.Checked;
     }
 }