Exemple #1
0
        public void TestVfd()
        {
            var pl = VfdWriter.EnumerateComPortName();

            if (pl.Contains(ComPort))
            {
                try
                {
                    using (var w = new VfdWriterImpl(ComPort))
                    {
                        var panel = new VfdPanel(w, Brightness);
                        panel.Overwrite("Connected to", 0, 0);
                        panel.Overwrite("Yuyushiki", 1, 11);
                        panel.Update();
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Selected COM port is not ready.", "Yuyushiki", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                mainForm.ResetComPortComboBoxItems();
                MessageBox.Show(ComPort + " is missing.", "Yuyushiki", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            mainForm.UpdateStatus();
        }
Exemple #2
0
        private void comPortComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            var pl = VfdWriter.EnumerateComPortName();

            if (pl.Contains(comPortComboBox.SelectedItem))
            {
                play.ComPort = (string)comPortComboBox.SelectedItem;
            }
            UpdateStatus();
        }
Exemple #3
0
        public void ResetComPortComboBoxItems()
        {
            var pl    = VfdWriter.EnumerateComPortName();
            var items = comPortComboBox.Items;

            items.Clear();
            foreach (var s in pl)
            {
                items.Add(s);
            }
            comPortComboBox.SelectedIndex = pl.Contains(play.ComPort) ? items.IndexOf(play.ComPort) : -1;
            comPortComboBox.Enabled       = (!play.IsPlaying) && (pl.Count > 0);
            if (planStatus == PlanStatus.ComPortNotReady)
            {
                OverwritePlanStatus(PlanStatus.Empty);
            }
        }