Пример #1
0
        private void btnHereNow_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 herenowStackPanel = new StackPanel();

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

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

            var point = CalcOffsets((UIElement)sender);

            hereNowPopup.HorizontalOffset = point.X + 50;
            hereNowPopup.VerticalOffset   = point.Y - 70;


            HereNowOptionsUserControl control = new HereNowOptionsUserControl();

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

            hereNowPopup.Child  = border;
            hereNowPopup.IsOpen = true;

            hereNowPopup.Closed += (senderPopup, argsPopup) =>
            {
                if (control.IsOKButtonEntered)
                {
                    CheckBox chkShowUUID = control.FindName("chkHereNowShowUUID") as CheckBox;
                    bool     showUUID    = (chkShowUUID != null) ? chkShowUUID.IsChecked.Value : false;

                    CheckBox chkIncludeUserState = control.FindName("chkHereIncludeUserState") as CheckBox;
                    bool     includeState        = (chkIncludeUserState != null) ? chkIncludeUserState.IsChecked.Value : false;

                    DisplayMessageInTextBox("Running HereNow:");
                    pubnub.HereNow <string>(channel, showUUID, includeState, PubnubCallbackResult, PubnubDisplayErrorMessage);
                }
                hereNowPopup   = null;
                this.IsEnabled = true;
            };
        }
        private void btnHereNow_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 herenowStackPanel = new StackPanel();
            herenowStackPanel.Background = new SolidColorBrush(Colors.Blue);
            herenowStackPanel.Width = 300;
            herenowStackPanel.Height = 300;

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

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


            HereNowOptionsUserControl control = new HereNowOptionsUserControl();
            herenowStackPanel.Children.Add(control);
            border.Child = herenowStackPanel;

            hereNowPopup.Child = border;
            hereNowPopup.IsOpen = true;

            hereNowPopup.Closed += (senderPopup, argsPopup) =>
                {
                    if (control.IsOKButtonEntered)
                    {
                        CheckBox chkShowUUID = control.FindName("chkHereNowShowUUID") as CheckBox;
                        bool showUUID = (chkShowUUID != null) ? chkShowUUID.IsChecked.Value : false;

                        CheckBox chkIncludeUserState = control.FindName("chkHereIncludeUserState") as CheckBox;
                        bool includeState = (chkIncludeUserState != null) ? chkIncludeUserState.IsChecked.Value : false;

                        DisplayMessageInTextBox("Running HereNow:");
                        pubnub.HereNow<string>(channel, showUUID, includeState, PubnubCallbackResult, PubnubDisplayErrorMessage);
                    }
                    hereNowPopup = null;
                    this.IsEnabled = true;
                };
        }