📄 serialport.cs
字号:
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.IO.Ports;
namespace Tollkuci.GsmModem
{
/// <summary>
/// Contains the details of the serial communication with the modem.
/// </summary>
internal partial class SerialPort : Component
{
#region Constructors
/// <summary>
/// Initialize a new instance of the <see cref="SerialPort"/> class.
/// </summary>
public SerialPort()
{
InitializeComponent();
}
/// <summary>
/// Initialize a new instance of the <see cref="SerialPort"/> class using the specified container.
/// </summary>
/// <param name="container">A <see cref="IContainer"/> object that will contain the newly created object.</param>
public SerialPort(IContainer container)
{
container.Add(this);
InitializeComponent();
}
#endregion
#region Properties
internal string PortName
{
get
{
return this.port.PortName;
}
set
{
this.port.PortName = value;
}
}
internal int BaudRate
{
get
{
return this.port.BaudRate;
}
set
{
this.port.BaudRate = value;
}
}
internal int DataBits
{
get
{
return this.port.DataBits;
}
set
{
this.port.DataBits = value;
}
}
internal System.IO.Ports.StopBits StopBits
{
get
{
return this.port.StopBits;
}
set
{
this.port.StopBits = value;
}
}
internal System.IO.Ports.Parity Parity
{
get
{
return this.port.Parity;
}
set
{
this.port.Parity = value;
}
}
internal Handshake FlowControl
{
get
{
return this.port.Handshake;
}
set
{
this.port.Handshake = value;
}
}
#endregion
#region Methods
/// <summary>
/// Connect with the serial port.
/// </summary>
internal void Connect()
{
this.port.Open();
}
/// <summary>
/// Disconnect the serial port.
/// </summary>
internal void Disconnect()
{
this.port.Close();
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -