Beispiel #1
0
 /// <summary>
 /// 开启新线程进行信息封装以及异步发送消息
 /// </summary>
 /// <param name="type">消息类型</param>
 /// <param name="content">内容</param>
 private void SendMessage(string type, string content)
 {
     if ("Text".Equals(type))
     {
         Task.Run(async() =>
         {
             string s = TransmissionData.DataPackaging(content, ID.Text, "Text");
             await UDP_Util.UdpSend(s);
         });
         input.Text = "";
     }
 }
        public MainWindow()
        {
            InitializeComponent();
            mw = this;
            TransmissionData.Getuuid();

            navigateTable.Add("All", new List <asdasdasd.Receive>());
            listContent.Add("All", CreatItem("All", 0));

            Task.Run(async() =>
            {
                await UDP_Util.UdpSocket();
            });
            HelloWord();
        }
 private async void HelloWord()
 {
     string result = TransmissionData.DataPackaging("Hello World", "All", "Text");
     await UDP_Util.UdpSend(result);
 }