private void btnGrantPresence_Click(object sender, RoutedEventArgs e) { channel = txtChannel.Text; this.IsEnabled = false; Border border = new Border(); border.BorderBrush = new SolidColorBrush(Colors.Black); border.BorderThickness = new Thickness(5.0); StackPanel pamAuthKeyStackPanel = new StackPanel(); pamAuthKeyStackPanel.Background = new SolidColorBrush(Colors.Blue); pamAuthKeyStackPanel.Width = 400; pamAuthKeyStackPanel.Height = 300; Popup pamAuthKeyPopup = new Popup(); pamAuthKeyPopup.Height = 300; pamAuthKeyPopup.Width = 300; pamAuthKeyPopup.HorizontalOffset = 10; pamAuthKeyPopup.VerticalOffset = 100; PAMAuthKeyUserControl control = new PAMAuthKeyUserControl(); TextBox txtPAMAuthKey = control.FindName("txtPAMAuthKey") as TextBox; if (txtPAMAuthKey != null) { txtPAMAuthKey.Text = ""; } pamAuthKeyStackPanel.Children.Add(control); border.Child = pamAuthKeyStackPanel; pamAuthKeyPopup.Child = border; pamAuthKeyPopup.IsOpen = true; pamAuthKeyPopup.Closed += (senderPopup, argsPopup) => { if (control.IsOKButtonEntered) { txtPAMAuthKey = control.FindName("txtPAMAuthKey") as TextBox; if (txtPAMAuthKey != null) { string pamAuthKey = txtPAMAuthKey.Text.Trim(); DisplayMessageInTextBox("Running GrantPresenceAccess:"); int ttlInMinutes = 1440; pubnub.GrantPresenceAccess <string>(channel, pamAuthKey, true, true, ttlInMinutes, PubnubCallbackResult, PubnubDisplayErrorMessage); } } pamAuthKeyPopup = null; this.IsEnabled = true; }; }
private void btnAuditPresence_Click(object sender, RoutedEventArgs e) { this.IsEnabled = false; Border border = new Border(); border.BorderBrush = new SolidColorBrush(Colors.Black); border.BorderThickness = new Thickness(5.0); StackPanel pamAuthKeyStackPanel = new StackPanel(); pamAuthKeyStackPanel.Background = new SolidColorBrush(Colors.Blue); pamAuthKeyStackPanel.Width = 400; pamAuthKeyStackPanel.Height = 300; Popup pamAuthKeyPopup = new Popup(); pamAuthKeyPopup.Height = 300; pamAuthKeyPopup.Width = 300; pamAuthKeyPopup.VerticalOffset = 10; pamAuthKeyPopup.HorizontalOffset = 10; PAMAuthKeyUserControl control = new PAMAuthKeyUserControl(); control.txtPAMAuthKey.Text = ""; pamAuthKeyStackPanel.Children.Add(control); border.Child = pamAuthKeyStackPanel; pamAuthKeyPopup.Child = border; pamAuthKeyPopup.IsOpen = true; control.btnOK.Click += (s, args) => { pamAuthKeyPopup.IsOpen = false; string pamAuthKey = control.txtPAMAuthKey.Text.Trim(); channel = txtChannel.Text; pubnub.AuditPresenceAccess <string>(channel, pamAuthKey, PubnubCallbackResult, PubnubDisplayErrorMessage); TextBlock textBlock = new TextBlock(); textBlock.Text = string.Format("Audit request...\n"); messageStackPanel.Children.Add(textBlock); scrollViewerResult.UpdateLayout(); scrollViewerResult.ScrollToVerticalOffset(scrollViewerResult.ExtentHeight); pamAuthKeyPopup = null; this.IsEnabled = true; }; control.btnCancel.Click += (s, args) => { pamAuthKeyPopup.IsOpen = false; pamAuthKeyPopup = null; this.IsEnabled = true; }; }
private void btnAuditPresence_Click(object sender, RoutedEventArgs e) { channel = txtChannel.Text; this.IsEnabled = false; Border border = new Border(); border.BorderBrush = new SolidColorBrush(Colors.Black); border.BorderThickness = new Thickness(5.0); StackPanel pamAuthKeyStackPanel = new StackPanel(); pamAuthKeyStackPanel.Background = new SolidColorBrush(Colors.Blue); pamAuthKeyStackPanel.Width = 400; pamAuthKeyStackPanel.Height = 300; Popup pamAuthKeyPopup = new Popup(); pamAuthKeyPopup.Height = 300; pamAuthKeyPopup.Width = 300; pamAuthKeyPopup.HorizontalOffset = 10; pamAuthKeyPopup.VerticalOffset = 100; PAMAuthKeyUserControl control = new PAMAuthKeyUserControl(); TextBox txtPAMAuthKey = control.FindName("txtPAMAuthKey") as TextBox; if (txtPAMAuthKey != null) { txtPAMAuthKey.Text = ""; } pamAuthKeyStackPanel.Children.Add(control); border.Child = pamAuthKeyStackPanel; pamAuthKeyPopup.Child = border; pamAuthKeyPopup.IsOpen = true; pamAuthKeyPopup.Closed += (senderPopup, argsPopup) => { if (control.IsOKButtonEntered) { txtPAMAuthKey = control.FindName("txtPAMAuthKey") as TextBox; if (txtPAMAuthKey != null) { string pamAuthKey = txtPAMAuthKey.Text.Trim(); DisplayMessageInTextBox("Running AuditPresenceAccess:"); pubnub.AuditPresenceAccess<string>(channel, pamAuthKey, PubnubCallbackResult, PubnubDisplayErrorMessage); } } pamAuthKeyPopup = null; this.IsEnabled = true; }; }
private void btnAuditPresence_Click(object sender, RoutedEventArgs e) { this.IsEnabled = false; Border border = new Border(); border.BorderBrush = new SolidColorBrush(Colors.Black); border.BorderThickness = new Thickness(5.0); StackPanel pamAuthKeyStackPanel = new StackPanel(); pamAuthKeyStackPanel.Background = new SolidColorBrush(Colors.Blue); pamAuthKeyStackPanel.Width = 400; pamAuthKeyStackPanel.Height = 300; Popup pamAuthKeyPopup = new Popup(); pamAuthKeyPopup.Height = 300; pamAuthKeyPopup.Width = 300; pamAuthKeyPopup.VerticalOffset = 10; pamAuthKeyPopup.HorizontalOffset = 10; PAMAuthKeyUserControl control = new PAMAuthKeyUserControl(); control.txtPAMAuthKey.Text = ""; pamAuthKeyStackPanel.Children.Add(control); border.Child = pamAuthKeyStackPanel; pamAuthKeyPopup.Child = border; pamAuthKeyPopup.IsOpen = true; control.btnOK.Click += (s, args) => { pamAuthKeyPopup.IsOpen = false; string pamAuthKey = control.txtPAMAuthKey.Text.Trim(); channel = txtChannel.Text; pubnub.AuditPresenceAccess<string>(channel, pamAuthKey, PubnubCallbackResult, PubnubDisplayErrorMessage); TextBlock textBlock = new TextBlock(); textBlock.Text = string.Format("Audit request...\n"); messageStackPanel.Children.Add(textBlock); scrollViewerResult.UpdateLayout(); scrollViewerResult.ScrollToVerticalOffset(scrollViewerResult.ExtentHeight); pamAuthKeyPopup = null; this.IsEnabled = true; }; control.btnCancel.Click += (s, args) => { pamAuthKeyPopup.IsOpen = false; pamAuthKeyPopup = null; this.IsEnabled = true; }; }