⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 settingsform.cs

📁 Bluetooth Simulation in C# with Serial Ports By Badea Florin
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
namespace CSSP
{
    public partial class SettingsForm : Form
    {
        private string  inboundPort;
        private string outboundPort;
        public SettingsForm(string inbound,string outbound)
        {
            InitializeComponent();
            inboundPort = inbound;
            outboundPort = outbound;
            string[] ports = SerialPort.GetPortNames();
            comboBox1.Items.Add("NO PORT SELECTED");
            for (int i = 0; i < ports.Length; i++)
                comboBox1.Items.Add(ports[i]);
            comboBox2.Items.Add("NO PORT SELECTED");
            for (int i = 0; i < ports.Length; i++)
                comboBox2.Items.Add(ports[i]);
            if (comboBox1.Items.Contains(inboundPort))
                comboBox1.SelectedItem=inboundPort;
            else
                comboBox1.SelectedIndex = 0;
            if (comboBox2.Items.Contains(outboundPort))
                comboBox2.SelectedItem=outboundPort;
            else
                comboBox2.SelectedIndex = 0;
          
        }
        public string GetInboundPort()
        {
            return (string)comboBox1.SelectedItem;
        }
        public string GetOutboundPort()
        {
            return (string)comboBox2.SelectedItem;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -