private void PART_ScCompactView_IsLoaded(object sender, RoutedEventArgs e)
        {
            PART_ScCompactView.Children.Clear();
            PART_ScCompactView.ColumnDefinitions.Clear();

            // Prepare Grid 40x40 & add data
            double actualWidth = PART_ScCompactView.ActualWidth;
            int    nbGrid      = (int)actualWidth / 52;

#if DEBUG
            logger.Debug($"SuccessStory - SuccessStoryAchievementsCompact - actualWidth: {actualWidth} - nbGrid: {nbGrid} - AchievementsList: {AchievementsList.Count}");
#endif

            if (nbGrid > 0)
            {
                for (int i = 0; i < nbGrid; i++)
                {
                    ColumnDefinition gridCol = new ColumnDefinition();
                    gridCol.Width = new GridLength(1, GridUnitType.Star);
                    PART_ScCompactView.ColumnDefinitions.Add(gridCol);

                    if (i < AchievementsList.Count)
                    {
                        if (i < nbGrid - 1)
                        {
                            Image gridImage = new Image();
                            gridImage.Stretch = Stretch.UniformToFill;
                            gridImage.Width   = 48;
                            gridImage.Height  = 48;
                            gridImage.ToolTip = AchievementsList[i].Name;
                            gridImage.SetValue(Grid.ColumnProperty, i);

                            if (_withUnlocked)
                            {
                                var converter = new LocalDateTimeConverter();
                                converter.Convert(AchievementsList[i].DateUnlock, null, null, null);
                                gridImage.ToolTip += " (" + converter.Convert(AchievementsList[i].DateUnlock, null, null, null) + ")";
                            }

                            if (AchievementsList[i].IsGray)
                            {
                                var tmpImg = new BitmapImage(new Uri(AchievementsList[i].Icon, UriKind.Absolute));
                                gridImage.Source = ImageTools.ConvertBitmapImage(tmpImg, ImageColor.Gray);

                                ImageBrush imgB = new ImageBrush
                                {
                                    ImageSource = new BitmapImage(new Uri(AchievementsList[i].IconImage, UriKind.Absolute))
                                };
                                gridImage.OpacityMask = imgB;
                            }
                            else
                            {
                                gridImage.Source = new BitmapImage(new Uri(AchievementsList[i].Icon, UriKind.Absolute));
                            }

                            DropShadowEffect myDropShadowEffect = new DropShadowEffect();
                            myDropShadowEffect.ShadowDepth = 0;
                            myDropShadowEffect.BlurRadius  = 30;

                            SetColorConverter setColorConverter = new SetColorConverter();
                            var color = setColorConverter.Convert(AchievementsList[i].Percent, null, null, CultureInfo.CurrentCulture);

                            if (color != null)
                            {
                                myDropShadowEffect.Color = (Color)color;
                            }

                            if (_EnableRaretyIndicator)
                            {
                                gridImage.Effect = myDropShadowEffect;
                            }

                            PART_ScCompactView.Children.Add(gridImage);
                        }
                        else
                        {
                            Label lb = new Label();
                            lb.FontSize            = 16;
                            lb.Content             = $"+{AchievementsList.Count - i}";
                            lb.VerticalAlignment   = VerticalAlignment.Center;
                            lb.HorizontalAlignment = HorizontalAlignment.Center;
                            lb.SetValue(Grid.ColumnProperty, i);

                            PART_ScCompactView.Children.Add(lb);

#if DEBUG
                            logger.Debug($"SuccessStory - SuccessStoryAchievementsCompact - AchievementsList.Count: {AchievementsList.Count} - nbGrid: {nbGrid} - i: {i}");
#endif
                        }
                    }
                }
            }
            else
            {
            }
        }
        private void PART_ScCompactView_IsLoaded(object sender, RoutedEventArgs e)
        {
            if (sender != null)
            {
                IntegrationUI.SetControlSize((FrameworkElement)sender);
            }

            if (double.IsNaN(PART_ScCompactView.ActualHeight) || PART_ScCompactView.ActualHeight == 0)
            {
                return;
            }

            PART_ScCompactView.Children.Clear();
            PART_ScCompactView.ColumnDefinitions.Clear();

            // Prepare Grid 40x40 & add data
            double actualHeight = PART_ScCompactView.ActualHeight;
            int    nbRow        = (int)actualHeight / 52;

#if DEBUG
            logger.Debug($"SuccessStory [Ignored] - SuccessStoryAchievementsCompact - ActualHeight: {actualHeight} - nbGrid: {nbRow} - AchievementsList: {AchievementsList.Count}");
#endif

            if (nbRow > 0)
            {
                for (int i = 0; i < nbRow; i++)
                {
                    RowDefinition gridRow = new RowDefinition();
                    gridRow.Height = new GridLength(1, GridUnitType.Star);
                    PART_ScCompactView.RowDefinitions.Add(gridRow);

                    if (i < AchievementsList.Count)
                    {
                        if (i < nbRow - 1)
                        {
                            Image gridImage = new Image();
                            gridImage.Stretch = Stretch.UniformToFill;
                            gridImage.Width   = 48;
                            gridImage.Height  = 48;
                            gridImage.ToolTip = AchievementsList[i].Name;
                            gridImage.SetValue(Grid.RowProperty, i);

                            if (_withUnlocked)
                            {
                                var converter = new LocalDateTimeConverter();
                                gridImage.ToolTip = AchievementsList[i].NameWithDateUnlock;
                            }

                            if (AchievementsList[i].IsGray)
                            {
                                if (AchievementsList[i].Icon.IsNullOrEmpty() || AchievementsList[i].IconImage.IsNullOrEmpty())
                                {
                                    logger.Warn($"SuccessStory - Empty image");
                                }
                                else
                                {
                                    var tmpImg = new BitmapImage(new Uri(AchievementsList[i].Icon, UriKind.Absolute));
                                    gridImage.Source = ImageTools.ConvertBitmapImage(tmpImg, ImageColor.Gray);

                                    ImageBrush imgB = new ImageBrush
                                    {
                                        ImageSource = new BitmapImage(new Uri(AchievementsList[i].IconImage, UriKind.Absolute))
                                    };
                                    gridImage.OpacityMask = imgB;
                                }
                            }
                            else
                            {
                                if (AchievementsList[i].Icon.IsNullOrEmpty())
                                {
                                    logger.Warn($"SuccessStory - Empty image");
                                }
                                else
                                {
                                    gridImage.Source = new BitmapImage(new Uri(AchievementsList[i].Icon, UriKind.Absolute));
                                }
                            }

                            DropShadowEffect myDropShadowEffect = new DropShadowEffect();
                            myDropShadowEffect.ShadowDepth = 0;
                            myDropShadowEffect.BlurRadius  = 15;

                            SetColorConverter setColorConverter = new SetColorConverter();
                            var color = setColorConverter.Convert(AchievementsList[i].Percent, null, null, CultureInfo.CurrentCulture);

                            if (color != null)
                            {
                                myDropShadowEffect.Color = (Color)color;
                            }

                            if (PluginDatabase.PluginSettings.EnableRaretyIndicator)
                            {
                                gridImage.Effect = myDropShadowEffect;
                            }

                            PART_ScCompactView.Children.Add(gridImage);
                        }
                        else
                        {
                            Label lb = new Label();
                            lb.FontSize            = 16;
                            lb.Content             = $"+{AchievementsList.Count - i}";
                            lb.VerticalAlignment   = VerticalAlignment.Center;
                            lb.HorizontalAlignment = HorizontalAlignment.Center;
                            lb.SetValue(Grid.RowProperty, i);

                            PART_ScCompactView.Children.Add(lb);
                        }
                    }
                }
            }
            else
            {
            }
        }