public void Run(IBackgroundTaskInstance taskInstance) { // // TODO: Insert code to perform background work // // If you start any asynchronous methods here, prevent the task // from closing prematurely by using BackgroundTaskDeferral as // described in http://aka.ms/backgroundtaskdeferral // BackgroundTaskDeferral background = taskInstance.GetDeferral(); var server = new ServerTcp(9000); server.OnError += Server_OnError; server.OnDataReceive += Server_OnDataReceive; ThreadPool.RunAsync(x => { server.StartAsync(); }); }
private void Server_OnError(ServerTcp sender, string args) { }
private async void Server_OnDataReceive(ServerTcp sender, string args) { //Answear text Recive await sender.SendAsync(string.Concat("Text Recive:", args)); }