Exemple #1
0
        private void btnWhereNow_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 whereNowStackPanel = new StackPanel();

            whereNowStackPanel.Background = new SolidColorBrush(Colors.Blue);
            whereNowStackPanel.Width      = 300;
            whereNowStackPanel.Height     = 300;

            whereNowPopup        = new Popup();
            whereNowPopup.Height = 300;
            whereNowPopup.Width  = 300;

            var point = CalcOffsets((UIElement)sender);

            whereNowPopup.HorizontalOffset = point.X + 70;
            whereNowPopup.VerticalOffset   = point.Y - 100;

            WhereNowUserControl control         = new WhereNowUserControl();
            TextBox             txtWhereNowUUID = control.FindName("txtWhereNowUUID") as TextBox;

            if (txtWhereNowUUID != null)
            {
                txtWhereNowUUID.Text = data.sessionUUID;
            }

            whereNowStackPanel.Children.Add(control);
            border.Child = whereNowStackPanel;

            whereNowPopup.Child  = border;
            whereNowPopup.IsOpen = true;

            whereNowPopup.Closed += (senderPopup, argsPopup) =>
            {
                if (control.IsOKButtonEntered)
                {
                    TextBox txtWhereNowUUIDConfirm = control.FindName("txtWhereNowUUID") as TextBox;
                    if (txtWhereNowUUIDConfirm != null)
                    {
                        string whereNowUUID = txtWhereNowUUIDConfirm.Text.Trim();

                        DisplayMessageInTextBox("Running WhereNow:");
                        pubnub.WhereNow <string>(whereNowUUID, PubnubCallbackResult, PubnubDisplayErrorMessage);
                    }
                }
                whereNowPopup  = null;
                this.IsEnabled = true;
            };
        }
        private void btnWhereNow_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 whereNowStackPanel = new StackPanel();
            whereNowStackPanel.Background = new SolidColorBrush(Colors.Blue);
            whereNowStackPanel.Width = 300;
            whereNowStackPanel.Height = 300;

            whereNowPopup = new Popup();
            whereNowPopup.Height = 300;
            whereNowPopup.Width = 300;

            var point = CalcOffsets((UIElement)sender);
            whereNowPopup.HorizontalOffset = point.X + 70;
            whereNowPopup.VerticalOffset = point.Y - 100;

            WhereNowUserControl control = new WhereNowUserControl();
            TextBox txtWhereNowUUID = control.FindName("txtWhereNowUUID") as TextBox;
            if (txtWhereNowUUID != null)
            {
                txtWhereNowUUID.Text = data.sessionUUID;
            }

            whereNowStackPanel.Children.Add(control);
            border.Child = whereNowStackPanel;

            whereNowPopup.Child = border;
            whereNowPopup.IsOpen = true;
            
            whereNowPopup.Closed += (senderPopup, argsPopup) =>
            {
                if (control.IsOKButtonEntered)
                {
                    TextBox txtWhereNowUUIDConfirm = control.FindName("txtWhereNowUUID") as TextBox;
                    if (txtWhereNowUUIDConfirm != null)
                    {
                        string whereNowUUID = txtWhereNowUUIDConfirm.Text.Trim();
                        
                        DisplayMessageInTextBox("Running WhereNow:");
                        pubnub.WhereNow<string>(whereNowUUID, PubnubCallbackResult, PubnubDisplayErrorMessage);
                    }

                }
                whereNowPopup = null;
                this.IsEnabled = true;
            };
        }