Пример #1
0
 public void MessageToServer(string message)
 {
     IMyMessageCallBack callBack = OperationContext.Current.GetCallbackChannel<IMyMessageCallBack>();
     Console.WriteLine("message from the client:" + message);
     callBack.OnCallBack("message from server");
     Task.Factory.StartNew(new Action<object>(TaskCallBack), callBack);
 }
Пример #2
0
 private async void TaskCallBack(object sender)
 {
     IMyMessageCallBack callBack = sender as IMyMessageCallBack;
     for(int i = 0;i<10;i++)
     {
         callBack.OnCallBack("Message_" + i);
         await Task.Delay(1000);
     }
 }