当前上下文不存在名称“ Endcoding ”,前面 using 指令也加上了,但是写 endcoding 这句还是会出错,网上也没找到类似问题,麻烦各位大神指教一下我这个新人。 代码如下
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.IO.Ports; using System.Threading; using System.Net; using System.Net.Sockets; using Microsoft.Win32;
namespace Chapter123 { ///
<summary> /// MainWindow.xaml 的交互逻辑 /// </summary> public partial class MainWindow : Window { Socket soc = null; TcpListener tcp; public MainWindow() { InitializeComponent(); this.Loaded += Window_Loaded; foreach (string item in SerialPort.GetPortNames()) { cmbPortList.Items.Add(item); } } private void Window_Loaded(object sender, RoutedEventArgs e)
{
SetButton(false);
}
private void SetButton(bool p)
{
}
private void btnGet_Click(object sender, RoutedEventArgs e)
{
if(btnGet.Content.ToString().Equals("获取"))
{
btnGet.Content = "关闭";
}
else
{
btnGet.Content = "获取";
Fire.Content = "N/A";
Smoke.Content = "N/A";
}
}
private void btnSend_Click(object sender, RoutedEventArgs e)
{
byte[] buff = Endcoding
}
private void btnStarTCP_Click(object sender, RoutedEventArgs e)
{
IPEndPoint ip = new IPEndPoint(IPAddress.Parse("127.1.1.1"), 8080);
tcp = new TcpListener(ip);
tcp.Start();
tcp.BeginAcceptSocket(new AsyncCallback(AcceptSocketClient), tcp);
btnStarTCP.IsEnabled = false;
}
private void AcceptSocketClient(IAsyncResult ar)
{
tcp = (TcpListener)ar.AsyncState;
soc = (Socket)tcp.EndAcceptSocket(ar);
}
// private void SetButton(bool isTure) // { // btnGet.IsEnabled = isTure; // }
}
}
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.