当前上下文不存在名称“ 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; // }
}
}
![]() | 1 Saber299 OP 解决了,不用管往后码就行。。。。 丢人,,闭贴了 0.0 |
2 Mithril 2019-01-11 11:38:34 +08:00 你这么写谁知道你那 Encoding 是个啥啊。。。 |