void HandleGrantPerms(object sender, EventArgs ea) { try { GrantEventArgs cea = ea as GrantEventArgs; if (cea.cds == CommonDialogStates.Grant) { if (cea.isPresence) { Display("Running Presence Grant"); pubnub.GrantPresenceAccess <string> (channel, cea.valToSet2, cea.valToSet1, cea.ttl, DisplayReturnMessage, DisplayErrorMessage); } else { Display("Running Subscribe Grant"); pubnub.GrantAccess <string> (channel, cea.valToSet2, cea.valToSet1, cea.ttl, DisplayReturnMessage, DisplayErrorMessage); } } else if (cea.cds == CommonDialogStates.HereNow) { pubnub.HereNow <string> (cea.channel, cea.valToSet2, cea.valToSet1, DisplayReturnMessage, DisplayErrorMessage); } else if (cea.cds == CommonDialogStates.GlobalHereNow) { pubnub.GlobalHereNow <string> (cea.valToSet2, cea.valToSet1, DisplayReturnMessage, DisplayErrorMessage); } } catch (Exception ex) { Display(ex.Message); } finally { GrantDialogFragment coroutine = sender as GrantDialogFragment; coroutine.GrantPerms -= HandleGrantPerms; } }
void GlobalHereNow() { var dialog = new GrantDialogFragment(CommonDialogStates.GlobalHereNow); dialog.GrantPerms += HandleGrantPerms; dialog.Show(SupportFragmentManager, "dialog"); }
public void Publish() { var dialog = new GrantDialogFragment(CommonDialogStates.Publish, this); dialog.GrantPerms += HandleGrantPerms; dialog.Show(SupportFragmentManager, "dialog"); }
void HandleGrantPerms(object sender, EventArgs ea) { try { GrantEventArgs cea = ea as GrantEventArgs; if (cea.cds == CommonDialogStates.Grant) { Display("Running Subscribe Grant"); ThreadPool.QueueUserWorkItem(o => pubnub.Grant() .Channels(new string [] { cea.channel }) .AuthKeys(new string [] { cea.authKey }) .Read(cea.valToSet2) .Write(cea.valToSet1) .TTL(cea.ttl) .Async(new DemoGrantResult(Display)) ); } else if (cea.cds == CommonDialogStates.HereNow) { Display("Running HereNow"); ThreadPool.QueueUserWorkItem(o => pubnub.HereNow() .Channels(new string [] { cea.channel }) .IncludeUUIDs(cea.valToSet2) .IncludeState(cea.valToSet1) .Async(new DemoHereNowResult(Display)) ); } else if (cea.cds == CommonDialogStates.GlobalHereNow) { Display("Running GlobalHereNow"); ThreadPool.QueueUserWorkItem(o => pubnub.HereNow().IncludeUUIDs(cea.valToSet2) .IncludeState(cea.valToSet1) .Async(new DemoHereNowResult(Display)) ); } else if (cea.cds == CommonDialogStates.Publish) { Display("Running Publish"); string[] channels = cea.channel.Split(','); string mess = cea.message; foreach (string channelToCall in channels) { ThreadPool.QueueUserWorkItem(o => pubnub.Publish() .Channel(channelToCall.Trim()) .Message(mess) .ShouldStore(cea.valToSet2) .Async(new DemoPublishResult(Display)) ); } } } catch (Exception ex) { Display(ex.Message); } finally { GrantDialogFragment coroutine = sender as GrantDialogFragment; coroutine.GrantPerms -= HandleGrantPerms; } }
void RunGrant(bool isPresenceGrant) { var dialog = new GrantDialogFragment(CommonDialogStates.Grant, this); dialog.IsPresenceGrant = isPresenceGrant; dialog.GrantPerms += HandleGrantPerms; dialog.Show(SupportFragmentManager, "dialog"); }
void HandleGrantPerms(object sender, EventArgs ea) { try { GrantEventArgs cea = ea as GrantEventArgs; if (cea.cds == CommonDialogStates.Grant) { if (cea.isPresence) { Display("Running Presence Grant"); ThreadPool.QueueUserWorkItem(o => pubnub.GrantPresenceAccess <string> (channel, cea.channel, cea.valToSet2, cea.valToSet1, cea.ttl, DisplayReturnMessage, DisplayErrorMessage) ); } else { Display("Running Subscribe Grant"); ThreadPool.QueueUserWorkItem(o => pubnub.GrantAccess <string> (channel, cea.channel, cea.valToSet2, cea.valToSet1, cea.ttl, DisplayReturnMessage, DisplayErrorMessage) ); } } else if (cea.cds == CommonDialogStates.HereNow) { ThreadPool.QueueUserWorkItem(o => pubnub.HereNow <string> (cea.channel, cea.valToSet2, cea.valToSet1, DisplayReturnMessage, DisplayErrorMessage) ); } else if (cea.cds == CommonDialogStates.GlobalHereNow) { ThreadPool.QueueUserWorkItem(o => pubnub.GlobalHereNow <string> (cea.valToSet2, cea.valToSet1, DisplayReturnMessage, DisplayErrorMessage) ); } else if (cea.cds == CommonDialogStates.Publish) { Display("Running Publish"); string[] channels = cea.channel.Split(','); string mess = cea.message; foreach (string channelToCall in channels) { ThreadPool.QueueUserWorkItem(o => pubnub.Publish <string> (channelToCall.Trim(), mess, cea.valToSet2, DisplayReturnMessage, DisplayErrorMessage) ); } } } catch (Exception ex) { Display(ex.Message); } finally { GrantDialogFragment coroutine = sender as GrantDialogFragment; coroutine.GrantPerms -= HandleGrantPerms; } }
public void HereNow() { //Display ("Running Here Now"); /*string[] channels = channel.Split (','); * foreach (string channelToCall in channels) { * pubnub.HereNow<string> (channelToCall.Trim (), DisplayReturnMessage, DisplayErrorMessage); * }*/ var dialog = new GrantDialogFragment(CommonDialogStates.HereNow, this); dialog.GrantPerms += HandleGrantPerms; dialog.Show(SupportFragmentManager, "dialog"); }
void RunChannelGroupGrant (bool isPresenceGrant) { var dialog = new GrantDialogFragment (CommonDialogStates.ChannelGroupGrant, this); dialog.IsPresenceGrant = isPresenceGrant; dialog.GrantPerms += HandleGrantPerms; dialog.Show (SupportFragmentManager, "dialog"); }
public void HereNow () { //Display ("Running Here Now"); /*string[] channels = channel.Split (','); foreach (string channelToCall in channels) { pubnub.HereNow<string> (channelToCall.Trim (), DisplayReturnMessage, DisplayErrorMessage); }*/ var dialog = new GrantDialogFragment (CommonDialogStates.HereNow, this); dialog.GrantPerms += HandleGrantPerms; dialog.Show (SupportFragmentManager, "dialog"); }
public void Publish () { var dialog = new GrantDialogFragment (CommonDialogStates.Publish, this); dialog.GrantPerms += HandleGrantPerms; dialog.Show (SupportFragmentManager, "dialog"); }
void GlobalHereNow () { var dialog = new GrantDialogFragment (CommonDialogStates.GlobalHereNow, this); dialog.GrantPerms += HandleGrantPerms; dialog.Show (SupportFragmentManager, "dialog"); }
void RunGrant (bool isPresenceGrant) { var dialog = new GrantDialogFragment(); dialog.IsPresenceGrant = isPresenceGrant; dialog.GrantPerms += HandleGrantPerms; dialog.Show(SupportFragmentManager, "dialog"); }