예제 #1
0
        private void btnChangeUUID_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 changeUUIDStackPanel = new StackPanel();

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

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

            var point = CalcOffsets((UIElement)sender);

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

            ChangeUUIDUserControl control       = new ChangeUUIDUserControl();
            TextBlock             tbCurrentUUID = control.FindName("lblCurrentUUID") as TextBlock;

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

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

            changeUUIDPopup.Child  = border;
            changeUUIDPopup.IsOpen = true;

            changeUUIDPopup.Closed += (senderPopup, argsPopup) =>
            {
                if (!control.IsCancelledButton)
                {
                    TextBox txtNewUUID = control.FindName("txtNewUUID") as TextBox;
                    if (txtNewUUID != null)
                    {
                        data.sessionUUID = txtNewUUID.Text;
                        pubnub.ChangeUUID(data.sessionUUID);
                    }
                }
                changeUUIDPopup = null;
                this.IsEnabled  = true;
            };
        }
        private void btnChangeUUID_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 changeUUIDStackPanel = new StackPanel();
            changeUUIDStackPanel.Background = new SolidColorBrush(Colors.Blue);
            changeUUIDStackPanel.Width = 400;
            changeUUIDStackPanel.Height = 300;

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

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

            ChangeUUIDUserControl control = new ChangeUUIDUserControl();
            TextBlock tbCurrentUUID = control.FindName("lblCurrentUUID") as TextBlock;
            if (tbCurrentUUID != null)
            {
                tbCurrentUUID.Text = data.sessionUUID;
            }

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

            changeUUIDPopup.Child = border;
            changeUUIDPopup.IsOpen = true;

            changeUUIDPopup.Closed += (senderPopup, argsPopup) =>
            {
                if (!control.IsCancelledButton)
                {
                    TextBox txtNewUUID = control.FindName("txtNewUUID") as TextBox;
                    if (txtNewUUID != null)
                    {
                        data.sessionUUID = txtNewUUID.Text;
                        pubnub.ChangeUUID(data.sessionUUID);
                    }
                }
                changeUUIDPopup = null;
                this.IsEnabled = true;
            };

        }