コード例 #1
0
ファイル: MainForm.cs プロジェクト: brooklikeme/PCI
        private void MainForm_Load(object sender, EventArgs e)
        {
            // load config
            PCIConfig.LoadBaseConfig();
            int value = 0;

            this.sharedMemoryInterval = Int32.TryParse(PCIConfig.NewBaseConfig["Interval"], out value) ? value : 100;

            detectList.Add(false);
            detectList.Add(false);
            detectList.Add(false);

            // fill components
            travelLabelList.Add(lbTravelValue1);
            travelLabelList.Add(lbTravelValue2);
            travelLabelList.Add(lbTravelValue3);

            rotationLabelList.Add(lbRotationValue1);
            rotationLabelList.Add(lbRotationValue2);
            rotationLabelList.Add(lbRotationValue3);

            travelBarList.Add(tbrTravel1);
            travelBarList.Add(tbrTravel2);
            travelBarList.Add(tbrTravel3);

            rotationBarList.Add(cpbRotation1);
            rotationBarList.Add(cpbRotation2);
            rotationBarList.Add(cpbRotation3);

            cbxForce1.SelectedIndex = 0;
            cbxForce2.SelectedIndex = 0;
            cbxForce3.SelectedIndex = 0;

            diameterList.Add(0.8F);
            diameterList.Add(0.3F);
            diameterList.Add(2.0F);

            // Create a new InputDevice object, get the number of
            // keyboards, and register the method which will handle the
            // InputDevice KeyPressed event
            Global.MouseInput = new RawInput(Handle);
            NumberOfMouses    = Global.MouseInput.EnumerateDevices();
            Global.MouseInput.UpdateProbeIndexes();
            Global.MouseInput.MouseMoved += new RawInput.DeviceEventHandler(m_MouseMoved);

            // register serial data received event
            USBSerial.deviceDataReceived    += new USBSerial.DeviceDataReceived(deviceDataReceived);
            USBSerial.advConfigDataReceived += new USBSerial.AdvConfigDataReceived(advConfigDataReceived);

            USBSerial.sendDataError += new USBSerial.SendDataError(sendDataError);

            initSharedMemory();
        }
コード例 #2
0
ファイル: ConfigForm.cs プロジェクト: brooklikeme/PCI
        private void CheckBaseConfigChanged()
        {
            // modify serial port info
            string selectedSerialPort = cbxSerialPorts.GetItemText(cbxSerialPorts.SelectedItem);

            selectedSerialPort = selectedSerialPort == "<未设置>" ? "" : selectedSerialPort;
            if (PCIConfig.NewBaseConfig.ContainsKey("SerialPort"))
            {
                PCIConfig.NewBaseConfig["SerialPort"] = selectedSerialPort;
            }
            else
            {
                PCIConfig.NewBaseConfig.Add("SerialPort", selectedSerialPort);
            }

            // modify probe info
            for (int i = 1; i < 4; i++)
            {
                if (PCIConfig.NewBaseConfig.ContainsKey("Probe" + i))
                {
                    PCIConfig.NewBaseConfig["Probe" + i] = "";
                }
                else
                {
                    PCIConfig.NewBaseConfig.Add("Probe" + i, "");
                }
            }
            for (int i = 0; i < 5; i++)
            {
                if (deviceIdentityTextList[i].Text != "" && setProbeComboBoxList[i].SelectedIndex > 0)
                {
                    PCIConfig.NewBaseConfig["Probe" + setProbeComboBoxList[i].SelectedIndex] = deviceIdentityTextList[i].Text;
                }
            }

            if (PCIConfig.NewBaseConfig.ContainsKey("Interval"))
            {
                PCIConfig.NewBaseConfig["Interval"] = txtInterval.Text;
            }
            else
            {
                PCIConfig.NewBaseConfig.Add("Interval", txtInterval.Text);
            }

            // compare new config to old
            btnApply.Enabled = !PCIConfig.CompareBaseConfig();
        }
コード例 #3
0
ファイル: ConfigForm.cs プロジェクト: brooklikeme/PCI
 private void btnOK_Click(object sender, EventArgs e)
 {
     PCIConfig.CompareAndSaveBaseConfig();
     Global.MouseInput.UpdateProbeIndexes();
     this.Close();
 }
コード例 #4
0
ファイル: ConfigForm.cs プロジェクト: brooklikeme/PCI
 private void btnApply_Click(object sender, EventArgs e)
 {
     PCIConfig.SaveBaseConfig();
     Global.MouseInput.UpdateProbeIndexes();
     btnApply.Enabled = false;
 }