コード例 #1
0
 private Windows.UI.Xaml.Shapes.Rectangle GetPixel(int row, int column)
 {
     Windows.UI.Xaml.Shapes.Rectangle rect =
         new Windows.UI.Xaml.Shapes.Rectangle()
     {
         Height  = size,
         Width   = size,
         Fill    = Foreground,
         RadiusX = 2,
         RadiusY = 2,
         Opacity = 0,
         Margin  = new Thickness(2)
     };
     rect.SetValue(Grid.ColumnProperty, column);
     rect.SetValue(Grid.RowProperty, row);
     return(rect);
 }
コード例 #2
0
 private Windows.UI.Xaml.Shapes.Rectangle GetRectangle(Windows.UI.Color colour, int column)
 {
     Windows.UI.Xaml.Shapes.Rectangle rectangle = new Windows.UI.Xaml.Shapes.Rectangle()
     {
         Height  = 10,
         Stretch = Stretch.UniformToFill,
         Fill    = new SolidColorBrush(colour)
     };
     rectangle.SetValue(Grid.ColumnProperty, column);
     return(rectangle);
 }
コード例 #3
0
ファイル: LagoVistaPage.cs プロジェクト: LagoVista/uwp
        private void AddLoadingMask()
        {
            if (!_initialized)
            {
                lock (this)
                {
                    _initialized = true;
                    var content = Content as Panel;
                    Content = null;
                    var contentContainer = new Grid();

                    _mask = new Grid()
                    {
                        Background = new SolidColorBrush(Colors.Black), Opacity = 0.5
                    };
                    _loadingMessage = new TextBlock()
                    {
                        HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center, Foreground = new SolidColorBrush(Colors.White), FontSize = 32, Text = "Loading...", Margin = new Windows.UI.Xaml.Thickness(0, 80, 0, 0)
                    };
                    _progressRing = new ProgressRing()
                    {
                        HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center, Foreground = new SolidColorBrush(Colors.White), Width = 100, Height = 100, Margin = new Windows.UI.Xaml.Thickness(0, 240, 0, 0)
                    };
                    _mask.Children.Add(_loadingMessage);
                    _mask.Children.Add(_progressRing);
                    _mask.Visibility = Windows.UI.Xaml.Visibility.Collapsed;


                    _popupWindowMask            = new Grid();
                    _popupWindowMask.Visibility = Visibility.Collapsed;
                    _popupWindowMask.RowDefinitions.Add(new RowDefinition()
                    {
                        Height = new GridLength(1, GridUnitType.Star)
                    });
                    _popupWindowMask.RowDefinitions.Add(new RowDefinition()
                    {
                        Height = new GridLength(1, GridUnitType.Auto)
                    });
                    _popupWindowMask.RowDefinitions.Add(new RowDefinition()
                    {
                        Height = new GridLength(1, GridUnitType.Star)
                    });

                    _popupWindowMask.ColumnDefinitions.Add(new ColumnDefinition()
                    {
                        Width = new GridLength(1, GridUnitType.Star)
                    });
                    _popupWindowMask.ColumnDefinitions.Add(new ColumnDefinition()
                    {
                        Width = new GridLength(1, GridUnitType.Auto)
                    });
                    _popupWindowMask.ColumnDefinitions.Add(new ColumnDefinition()
                    {
                        Width = new GridLength(1, GridUnitType.Star)
                    });

                    var messageBackground = new RectangleGeometry();
                    var rect = new Windows.UI.Xaml.Shapes.Rectangle();
                    rect.Fill            = new SolidColorBrush(Colors.White);
                    rect.Stroke          = new SolidColorBrush(Colors.Black);
                    rect.Width           = 600;
                    rect.Height          = 400;
                    rect.StrokeThickness = 4;
                    rect.SetValue(Grid.RowProperty, 1);
                    rect.SetValue(Grid.ColumnProperty, 1);

                    var backgroundRect = new Windows.UI.Xaml.Shapes.Rectangle()
                    {
                        Fill = new SolidColorBrush(Colors.Black), Opacity = 0.5
                    };
                    backgroundRect.SetValue(Grid.ColumnSpanProperty, 3);
                    backgroundRect.SetValue(Grid.RowSpanProperty, 3);

                    _popupMessage = new TextBlock()
                    {
                        Width = 580, VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Left, Foreground = new SolidColorBrush(Colors.Black), FontSize = 32
                    };
                    _popupMessage.Margin = new Thickness(10);
                    _popupMessage.SetValue(Grid.RowProperty, 1);
                    _popupMessage.SetValue(Grid.ColumnProperty, 1);
                    _popupMessage.TextWrapping = TextWrapping.Wrap;
                    _dismissButton             = new Button()
                    {
                        Content = "OK", VerticalAlignment = VerticalAlignment.Bottom, HorizontalAlignment = HorizontalAlignment.Right, Width = 120, Height = 60, Margin = new Thickness(10)
                    };
                    _dismissButton.SetValue(Grid.RowProperty, 1);
                    _dismissButton.SetValue(Grid.ColumnProperty, 1);
                    _dismissButton.Click += (e, a) =>
                    {
                        var containerViewModel = DataContext as ViewModelBase;
                        if (containerViewModel != null)
                        {
                            containerViewModel.MessageText = String.Empty;
                        }
                        _popupWindowMask.Visibility = Visibility.Collapsed;
                    };


                    _popupWindowMask.Children.Add(backgroundRect);
                    _popupWindowMask.Children.Add(rect);
                    _popupWindowMask.Children.Add(_popupMessage);
                    _popupWindowMask.Children.Add(_dismissButton);

                    contentContainer.Children.Add(content);
                    contentContainer.Children.Add(_mask);
                    contentContainer.Children.Add(_popupWindowMask);
                    Content = contentContainer;

                    var vm = DataContext as ViewModelBase;
                    SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = Navigation.Instance.CanGoBack() ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed;
                }
            }
        }