示例#1
0
 void HandleAddRemoveFromCgPerms(object sender, EventArgs ea)
 {
     try {
         AddRemoveFromCgEventArgs cea = ea as AddRemoveFromCgEventArgs;
         if (cea.cds == CommonDialogStates.AddToChannelGroup)
         {
             Display("Running AddChannelsToChannelGroup");
             ThreadPool.QueueUserWorkItem(o =>
                                          pubnub.AddChannelsToChannelGroup <string> (new string[] { cea.channel }, cea.channelGroup, DisplayReturnMessage, DisplayErrorMessage)
                                          );
         }
         else if (cea.cds == CommonDialogStates.RemoveFromChannelGroup)
         {
             Display("Running RemoveChannelsFromChannelGroup");
             ThreadPool.QueueUserWorkItem(o =>
                                          pubnub.RemoveChannelsFromChannelGroup <string> (new string[] { cea.channel }, cea.channelGroup, DisplayReturnMessage, DisplayErrorMessage)
                                          );
         }
         else if (cea.cds == CommonDialogStates.GetChannelGroup)
         {
             Display("Running GetChannelsForChannelGroup");
             ThreadPool.QueueUserWorkItem(o =>
                                          pubnub.GetChannelsForChannelGroup <string> (cea.channelGroup, DisplayReturnMessage, DisplayErrorMessage)
                                          );
         }
     }
     catch (Exception ex) {
         Display(ex.Message);
     } finally {
         AddRemoveFromChannelGroupDialogFragment coroutine = sender as AddRemoveFromChannelGroupDialogFragment;
         coroutine.AddRemoveFromCgPerms -= HandleAddRemoveFromCgPerms;
     }
 }
 public void FireEvent (string channel, string channelgroup)
 {
     if (AddRemoveFromCgPerms != null) {
         AddRemoveFromCgEventArgs cea = new AddRemoveFromCgEventArgs ();
         cea.channel = channel;
         cea.channelGroup = channelgroup;
         cea.cds = cds;
         AddRemoveFromCgPerms (this, cea);
     }
 }
示例#3
0
 public void FireEvent(string channel, string channelgroup)
 {
     if (AddRemoveFromCgPerms != null)
     {
         AddRemoveFromCgEventArgs cea = new AddRemoveFromCgEventArgs();
         cea.channel      = channel;
         cea.channelGroup = channelgroup;
         cea.cds          = cds;
         AddRemoveFromCgPerms(this, cea);
     }
 }
示例#4
0
 void HandleAddRemoveFromCgPerms(object sender, EventArgs ea)
 {
     try {
         AddRemoveFromCgEventArgs cea = ea as AddRemoveFromCgEventArgs;
         if (cea.cds == CommonDialogStates.AddToChannelGroup)
         {
             Display("Running AddChannelsToChannelGroup");
             ThreadPool.QueueUserWorkItem(o =>
                                          pubnub.AddChannelsToChannelGroup().Channels(new [] { cea.channel })
                                          .ChannelGroup(cea.channelGroup)
                                          .Async(new DemoChannelGroupAddChannel(Display))
                                          );
         }
         else if (cea.cds == CommonDialogStates.RemoveFromChannelGroup)
         {
             Display("Running RemoveChannelsFromChannelGroup");
             ThreadPool.QueueUserWorkItem(o =>
                                          pubnub.RemoveChannelsFromChannelGroup()
                                          .Channels(new [] { cea.channel })
                                          .ChannelGroup(cea.channelGroup)
                                          .Async(new DemoChannelGroupRemoveChannel(Display))
                                          );
         }
         else if (cea.cds == CommonDialogStates.GetChannelGroup)
         {
             Display("Running GetChannelsForChannelGroup");
             ThreadPool.QueueUserWorkItem(o =>
                                          pubnub.ListChannelsForChannelGroup()
                                          .ChannelGroup(cea.channelGroup)
                                          .Async(new DemoChannelGroupAllChannels(Display))
                                          );
         }
     }
     catch (Exception ex) {
         Display(ex.Message);
     } finally {
         AddRemoveFromChannelGroupDialogFragment coroutine = sender as AddRemoveFromChannelGroupDialogFragment;
         coroutine.AddRemoveFromCgPerms -= HandleAddRemoveFromCgPerms;
     }
 }