Пример #1
0
        public static ChildWindow PopupMessage(string title, string message)
        {
            if (CurrentPopup != null)
            {
                return(null);
            }

            var msgBox = new ChildWindow();

            CurrentPopup = msgBox;

            msgBox.Style       = System.Windows.Application.Current.Resources["PopupMessageWindow"] as Style;
            msgBox.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xBA, 0xD2, 0xEC));
            msgBox.Title       = title;

            msgBox.MaxWidth = Application.Current.Host.Content.ActualWidth * 0.5;

            msgBox.Content = new TextBlock()
            {
                Text = message, Margin = new Thickness(20), Foreground = new SolidColorBrush(Colors.White), FontSize = 14
            };
            msgBox.IsTabStop = true;
            msgBox.Show();
            msgBox.Focus();

            _currentWindow = msgBox;
            PopupManager.CloseActivePopup();
            return(msgBox);
        }
Пример #2
0
        private void ImageScrollBarScroll(object sender, ScrollEventArgs e)
        {
            PopupManager.CloseActivePopup();
            Focus();
            switch (e.ScrollEventType)
            {
            case ScrollEventType.ThumbTrack:
            case ScrollEventType.ThumbPosition:
            case ScrollEventType.SmallDecrement:
            case ScrollEventType.SmallIncrement:
            case ScrollEventType.Last:
            case ScrollEventType.LargeIncrement:
            case ScrollEventType.LargeDecrement:
            case ScrollEventType.First:
                _scrollbarEventPublisher.Publish(sender, new ScrollBarUpdateEventArgs {
                    ScrollbarPosition = (int)e.NewValue
                });

                // don't move the thumb, keep in sync with the server side.
                // Update will be done via PropertyChange event
                ImageScrollBar.Value = ServerEntity.TopLeftPresentationImageIndex;
                break;

            case ScrollEventType.EndScroll:
                // ignore it
                break;
            }
        }
        private void OnClick(object o, RoutedEventArgs args)
        {
            PopupManager.CloseActivePopup();

            _actionDispatcher.EventDispatcher.DispatchMessage(
                new ActionClickedMessage
            {
                TargetId   = _actionItem.Identifier,
                Identifier = Guid.NewGuid()
            });
        }
        private void OnDropClick(object o, RoutedEventArgs args)
        {
            PopupManager.CloseActivePopup();

            if (_dropMenu.IsOpen)
            {
                Hide();
            }
            else
            {
                Show();
            }
        }
Пример #5
0
        private void OnDropClick(object o, RoutedEventArgs args)
        {
            PopupManager.CloseActivePopup();

            if (IsVisible)
            {
                Hide();
            }
            else
            {
                Show();
            }
        }
    /// <summary>
    /// Adds a token given the info of the token and updates the balances in the TradableAssetManager.
    /// </summary>
    /// <param name="tokenInfo"> The info of the token to add. </param>
    /// <returns> The newly created ERC20 token from this TokenInfo. </returns>
    public ERC20 AddAndUpdateToken(TokenInfo tokenInfo)
    {
        var token = AddToken(tokenInfo);

        new ERC20TokenAsset(token, asset => UpdateTradableAssets(asset, () =>
        {
            if (popupManager.ActivePopupType == typeof(LoadingPopup))
            {
                popupManager.CloseActivePopup();
            }
        }), tradableAssetImageManager, userWalletManager);

        return(token);
    }
Пример #7
0
        /// <summary>
        /// Called by other controls to let MouseHelpers handle the mouse event instead.
        /// </summary>
        /// <param name="element"></param>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void PreprocessLeftMouseButtonDown(IMouseElement element, object sender, MouseButtonEventArgs e)
        {
            PopupManager.CloseActivePopup();

            lock (_mouseEventLock)
            {
                _leftMouseDown = true;

                if (_activeElement == null || !_activeElement.HasCapture)
                {
                    element.OnMouseLeftButtonDown(sender, e);
                    return;
                }

                _activeElement.OnMouseLeftButtonDown(sender, e);
            }
        }
Пример #8
0
        public static ChildWindow PopupMessage(string title, string message, string closeButtonLabel, bool closeWindow)
        {
            if (CurrentPopup != null)
            {
                return(null);
            }

            var msgBox = new ChildWindow();

            CurrentPopup = msgBox;

            msgBox.Style       = Application.Current.Resources["PopupMessageWindow"] as Style;
            msgBox.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xBA, 0xD2, 0xEC));
            msgBox.Title       = title;
            msgBox.MaxWidth    = Application.Current.Host.Content.ActualWidth * 0.5;

            StackPanel content = new StackPanel();

            content.Children.Add(new TextBlock()
            {
                Text = message, Margin = new Thickness(20), Foreground = new SolidColorBrush(Colors.White), FontSize = 14, HorizontalAlignment = HorizontalAlignment.Center
            });

            Button closeButton = new Button {
                Content = closeButtonLabel, FontSize = 14, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(20)
            };

            closeButton.Click += (s, o) =>
            {
                msgBox.Close();
                if (closeWindow)
                {
                    BrowserWindow.Close();
                }
            };
            content.Children.Add(closeButton);
            msgBox.Content   = content;
            msgBox.IsTabStop = true;

            msgBox.Show();
            msgBox.Focus();

            _currentWindow = msgBox;
            PopupManager.CloseActivePopup();
            return(msgBox);
        }
Пример #9
0
        private static void OnBackgroundMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            PopupManager.CloseActivePopup();
            //NOTE: we must set handled to true for double-click to work.
            e.Handled = true;

            lock (_mouseEventLock)
            {
                UIElement ui = _activeElement as UIElement;
                if (ui != null)
                {
                    if (_activeElement != null && _activeElement.HasCapture)
                    {
                        _rightMouseDown = true;
                        _activeElement.OnMouseRightButtonDown(sender, e);
                    }
                }
            }
        }
Пример #10
0
        public static ChildWindow PopupContent(string title, object content, IEnumerable <Button> buttons)
        {
            if (CurrentPopup != null)
            {
                return(null);
            }

            var msgBox = new ChildWindow();

            CurrentPopup       = msgBox;
            msgBox.Style       = Application.Current.Resources["PopupMessageWindow"] as Style;
            msgBox.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xBA, 0xD2, 0xEC));
            msgBox.Title       = title;

            msgBox.MaxWidth = Application.Current.Host.Content.ActualWidth * 0.5;

            StackPanel panel = new StackPanel();

            panel.Children.Add(new ContentPresenter()
            {
                Content = content
            });

            StackPanel buttonPanel = new StackPanel()
            {
                Margin = new Thickness(20), Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center
            };

            if (buttons != null)
            {
                foreach (Button b in buttons)
                {
                    b.Click += (s, e) =>
                    {
                        msgBox.Close();
                    };
                    buttonPanel.Children.Add(b);
                }
            }
            else
            {
                var closeButton = new Button {
                    Content = Labels.ButtonClose, HorizontalAlignment = HorizontalAlignment.Center,
                };
                closeButton.Click += (s, e) =>
                {
                    msgBox.Close();
                };
                buttonPanel.Children.Add(closeButton);
            }

            panel.Children.Add(buttonPanel);
            msgBox.Content = panel;

            msgBox.IsTabStop = true;
            msgBox.Show();
            msgBox.Focus();

            PopupManager.CloseActivePopup();
            return(msgBox);
        }