コード例 #1
0
        private void UpdateScore()
        {
            // need both of these
            if (!BackgroundColor.HasValue || !Intensity.HasValue)
            {
                return;
            }

            stackScore.Children.Clear();

            for (int i = 1; i <= 12; i++)
            {
                var border = new Border()
                {
                    Width           = 33,
                    Height          = 33,
                    BorderBrush     = new SolidColorBrush(BackgroundColor.GetValueOrDefault()),
                    BorderThickness = new Thickness(1),
                    Margin          = new Thickness(0, 0, 5, 0)
                };

                if (i <= Intensity)
                {
                    border.Background = new SolidColorBrush(BackgroundColor.GetValueOrDefault());
                }

                stackScore.Children.Add(border);
            }
        }