/// <summary> /// Send online announcement message to the mesh /// </summary> private void SendOnlineAnnouncementMessage() { Task <FullPresenceInfo> .Factory.StartNew(() => businessLogic.ProvideFullPresenceInfo()) .ContinueWith(task => { //exception handling if (task.IsFaulted) { task.Exception.Handle(exception => { LogManager.Fatal(exception); return(true); }); return; } if (task.Result == null) { LogManager.GetCurrentClassLogger().Debug("businessLogic.ProvideFullPresenceInfo() return null - OnlineAnnouncement will not sent to other peers - - its legal , but for debugging information for the implementer should consider if this is the correct behavior"); return; } var onlineAnnouncementMessage = new OnlineAnnouncementMessage { PresenceInfo = task.Result }; //send the online message to the mesh Proxy.OnlineAnnouncement(onlineAnnouncementMessage); }); }
void ISynchronizedState.OnlineAnnouncement(OnlineAnnouncementMessage announcementMessage) { #if DEBUG LogManager.GetCurrentClassLogger().Debug("OnlineAnnouncement {0}", announcementMessage); #endif try { businessLogic.OnOnlineAnnouncementReceived(announcementMessage.PresenceInfo); } catch (Exception exception) { HelperMethods.HandleBusinessLogicException(exception); } }
/// <summary> /// Peer should send it automatically when the mesh become online /// </summary> /// <param name="announcementMessage"></param> void ISynchronizedState.OnlineAnnouncement(OnlineAnnouncementMessage announcementMessage) { Contract.Requires <ArgumentNullException>(announcementMessage != null); }