示例#1
0
 void WeatherService_WeatherReporting(object sender, WeatherEventArgs e)
 {
     // Remember check the callback channel's status before using it.
     if (((ICommunicationObject)_callback).State == CommunicationState.Opened)
     {
         try
         {
             _callback.WeatherReport(e.WeatherReport);
         }
         catch
         {
             UnSubscribe();
         }
     }
     else
     {
         UnSubscribe();
     }
 }
示例#2
0
 void WeatherService_WeatherReporting(object sender, WeatherEventArgs e)
 {
     // 在应用回调前需要检查回调通道的状态。
     if (((ICommunicationObject)_callback).State == CommunicationState.Opened)
     {
         try
         {
             _callback.WeatherReport(e.WeatherReport);
         }
         catch
         {
             UnSubscribe();
         }
     }
     else
     {
         UnSubscribe();
     }
 }