Esempio n. 1
0
        private void btnChannelGroup_Click(object sender, RoutedEventArgs e)
        {
            CheckUserInputs();
            channelGroup = txtChannelGroup.Text.Trim();

            if (authKey.Trim() != "")
            {
                pubnub.AuthenticationKey = authKey;
            }

            ChannelGroupDialog channelGroupPopup = new ChannelGroupDialog();

            channelGroupPopup.txtChannelGroupName.Text = channelGroup;
            channelGroupPopup.Show();

            channelGroupPopup.Closed += (obj, args) =>
            {
                if (channelGroupPopup.DialogResult == true)
                {
                    string userChannelGroupName = channelGroupPopup.txtChannelGroupName.Text.Trim();
                    if (channelGroupPopup.radChannelGroupGet.IsChecked.Value)
                    {
                        Console.WriteLine("Running GetChannelsForChannelGroup()");
                        pubnub.GetChannelsForChannelGroup <string>(userChannelGroupName, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radChannelGroupAdd.IsChecked.Value)
                    {
                        Console.WriteLine("Running AddChannelsToChannelGroup()");
                        string userChannelGroupAddChannel = channelGroupPopup.txtChannelGroupAddChannels.Text;
                        pubnub.AddChannelsToChannelGroup <string>(new string[] { userChannelGroupAddChannel }, userChannelGroupName, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radChannelGroupRemove.IsChecked.Value)
                    {
                        Console.WriteLine("Running RemoveChannelsFromChannelGroup()");
                        string userChannelGroupRemoveChannel = channelGroupPopup.txtChannelGroupRemoveChannels.Text;
                        pubnub.RemoveChannelsFromChannelGroup <string>(new string[] { userChannelGroupRemoveChannel }, userChannelGroupName, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radChannelGroupGrant.IsChecked.Value)
                    {
                        Console.WriteLine("Running ChannelGroupGrantAccess()");
                        pubnub.ChannelGroupGrantAccess <string>(userChannelGroupName, true, true, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radChannelGroupAudit.IsChecked.Value)
                    {
                        Console.WriteLine("Running ChannelGroupAuditAccess()");
                        pubnub.ChannelGroupAuditAccess <string>(userChannelGroupName, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radChannelGroupRevoke.IsChecked.Value)
                    {
                        Console.WriteLine("Running ChannelGroupRevokeAccess()");
                        pubnub.ChannelGroupGrantAccess <string>(userChannelGroupName, false, false, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }

                    else if (channelGroupPopup.radPresenceChannelGroupGrant.IsChecked.Value)
                    {
                        Console.WriteLine("Running ChannelGroupGrantPresenceAccess()");
                        pubnub.ChannelGroupGrantPresenceAccess <string>(userChannelGroupName, true, true, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radPresenceChannelGroupAudit.IsChecked.Value)
                    {
                        Console.WriteLine("Running ChannelGroupAuditPresenceAccess()");
                        pubnub.ChannelGroupAuditPresenceAccess <string>(userChannelGroupName, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radPresenceChannelGroupRevoke.IsChecked.Value)
                    {
                        Console.WriteLine("Running ChannelGroup Revoke PresenceAccess()");
                        pubnub.ChannelGroupGrantPresenceAccess <string>(userChannelGroupName, false, false, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                }
            };
        }
        private void btnChannelGroup_Click(object sender, RoutedEventArgs e)
        {
            CheckUserInputs();
            channelGroup = txtChannelGroup.Text.Trim();

            if (authKey.Trim() != "")
            {
                pubnub.AuthenticationKey = authKey;
            }

            ChannelGroupDialog channelGroupPopup = new ChannelGroupDialog();
            channelGroupPopup.txtChannelGroupName.Text = channelGroup;
            channelGroupPopup.Show();

            channelGroupPopup.Closed += (obj, args) =>
            {
                if (channelGroupPopup.DialogResult == true)
                {
                    string userChannelGroupName = channelGroupPopup.txtChannelGroupName.Text.Trim();
                    if (channelGroupPopup.radChannelGroupGet.IsChecked.Value)
                    {
                        Console.WriteLine("Running GetChannelsForChannelGroup()");
                        pubnub.GetChannelsForChannelGroup<string>(userChannelGroupName, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radChannelGroupAdd.IsChecked.Value)
                    {
                        Console.WriteLine("Running AddChannelsToChannelGroup()");
                        string userChannelGroupAddChannel = channelGroupPopup.txtChannelGroupAddChannels.Text;
                        pubnub.AddChannelsToChannelGroup<string>(new string[] { userChannelGroupAddChannel }, userChannelGroupName, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radChannelGroupRemove.IsChecked.Value)
                    {
                        Console.WriteLine("Running RemoveChannelsFromChannelGroup()");
                        string userChannelGroupRemoveChannel = channelGroupPopup.txtChannelGroupRemoveChannels.Text;
                        pubnub.RemoveChannelsFromChannelGroup<string>(new string[] { userChannelGroupRemoveChannel }, userChannelGroupName, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radChannelGroupGrant.IsChecked.Value)
                    {
                        Console.WriteLine("Running ChannelGroupGrantAccess()");
                        pubnub.ChannelGroupGrantAccess<string>(userChannelGroupName, true, true, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radChannelGroupAudit.IsChecked.Value)
                    {
                        Console.WriteLine("Running ChannelGroupAuditAccess()");
                        pubnub.ChannelGroupAuditAccess<string>(userChannelGroupName, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radChannelGroupRevoke.IsChecked.Value)
                    {
                        Console.WriteLine("Running ChannelGroupRevokeAccess()");
                        pubnub.ChannelGroupGrantAccess<string>(userChannelGroupName, false, false, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }

                    else if (channelGroupPopup.radPresenceChannelGroupGrant.IsChecked.Value)
                    {
                        Console.WriteLine("Running ChannelGroupGrantPresenceAccess()");
                        pubnub.ChannelGroupGrantPresenceAccess<string>(userChannelGroupName, true, true, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radPresenceChannelGroupAudit.IsChecked.Value)
                    {
                        Console.WriteLine("Running ChannelGroupAuditPresenceAccess()");
                        pubnub.ChannelGroupAuditPresenceAccess<string>(userChannelGroupName, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }
                    else if (channelGroupPopup.radPresenceChannelGroupRevoke.IsChecked.Value)
                    {
                        Console.WriteLine("Running ChannelGroup Revoke PresenceAccess()");
                        pubnub.ChannelGroupGrantPresenceAccess<string>(userChannelGroupName, false, false, DisplayUserCallbackMessage, DisplayErrorMessage);
                    }

                }
            };
        }