示例#1
0
文件: Form1.cs 项目: cschlisner/CLC
        public Form1()
        {
            InitializeComponent();
            Controller.port = new SerialPort((string)Properties.Settings.Default["COMPortDefault"], 9600);
            switch ((string)Properties.Settings.Default["ModeDefault"])
            {
                case "ON":
                    Controller.currentMode = Controller.Mode.ON;
                    break;
                case "OFF":
                    Controller.currentMode = Controller.Mode.OFF;
                    break;
                case "LEVELS":
                    Controller.currentMode = Controller.Mode.LEVELS;
                    break;
                case "BEAT":
                    Controller.currentMode = Controller.Mode.BEAT;
                    break;
                case "FADE":
                    Controller.currentMode = Controller.Mode.FADE;
                    break;
            }

            deviceCB.Items.AddRange(controller.getDeviceList());
            int k = (int)Properties.Settings.Default["DeviceDefault"];
            deviceCB.SelectedIndex = (k >= deviceCB.Items.Count) ? 0 : k;
            Controller.port.Open();

            controller.intensity = (int)Properties.Settings.Default["IntDefault"];
            controller.sensitivity = (int)Properties.Settings.Default["SenDefault"];
            controller.speed = (int)Properties.Settings.Default["SpeDefault"];
            settingsForm = new SettingsForm(controller, workerThread);
            workerThread = new Thread(controller.Start);
            workerThread.Start();
        }
示例#2
0
文件: Form1.cs 项目: cschlisner/CLC
 private void toolStripSettings_Click(object sender, EventArgs e)
 {
     if (settingsForm.IsDisposed)
         settingsForm = new SettingsForm(controller, workerThread);
     settingsForm.Show();
     settingsForm.BringToFront();
 }