Ejemplo n.º 1
0
        private void WindowClosed(object sender, EventArgs e)
        {
            ConfigUtil.SetSetting("ShowDamageSummaryAtStartup", (DamageWindow?.IsOpen == true).ToString(CultureInfo.CurrentCulture));
            ConfigUtil.SetSetting("ShowHealingSummaryAtStartup", (HealingWindow?.IsOpen == true).ToString(CultureInfo.CurrentCulture));
            ConfigUtil.SetSetting("ShowTankingSummaryAtStartup", (TankingWindow?.IsOpen == true).ToString(CultureInfo.CurrentCulture));
            ConfigUtil.SetSetting("ShowDamageChartAtStartup", (DamageChartWindow?.IsOpen == true).ToString(CultureInfo.CurrentCulture));
            ConfigUtil.SetSetting("ShowHealingChartAtStartup", (HealingChartWindow?.IsOpen == true).ToString(CultureInfo.CurrentCulture));
            ConfigUtil.SetSetting("ShowTankingChartAtStartup", (TankingChartWindow?.IsOpen == true).ToString(CultureInfo.CurrentCulture));

            StopProcessing();
            OverlayUtil.CloseOverlay();
            taskBarIcon?.Dispose();
            PlayerChatManager?.Dispose();
            ConfigUtil.Save();
            PlayerManager.Instance?.Save();
            Application.Current.Shutdown();
        }
Ejemplo n.º 2
0
    private void UpdateLoadingProgress()
    {
      Dispatcher.InvokeAsync(() =>
      {
        if (EQLogReader != null)
        {
          Busy(true);
          OverlayUtil.CloseOverlay();

          var seconds = Math.Round((DateTime.Now - StartLoadTime).TotalSeconds, 1);
          double filePercent = EQLogReader.FileSize > 0 ? Math.Min(Convert.ToInt32((double)FilePosition / EQLogReader.FileSize * 100), 100) : 100;
          StatusText = (CurrentLogOption == LogOption.ARCHIVE ? "Archiving" : "Reading Log... ") + filePercent + "% in " + seconds + " seconds";
          StatusBrush = LOADING_BRUSH;

          if (EQLogReader.FileLoadComplete)
          {
            if ((filePercent >= 100 && CurrentLogOption != LogOption.ARCHIVE) || CurrentLogOption == LogOption.MONITOR)
            {
              StatusBrush = GOOD_BRUSH;
              StatusText = "Monitoring Active";
            }
            else if (filePercent >= 100 && CurrentLogOption == LogOption.ARCHIVE)
            {
              StatusBrush = GOOD_BRUSH;
              StatusText = "Archiving Complete";
            }
          }

          if (((filePercent >= 100 && CastProcessor.GetPercentComplete() >= 100 && DamageProcessor.GetPercentComplete() >= 100
            && HealingProcessor.GetPercentComplete() >= 100 && MiscProcessor.GetPercentComplete() >= 100) ||
            CurrentLogOption == LogOption.MONITOR || CurrentLogOption == LogOption.ARCHIVE) && EQLogReader.FileLoadComplete)
          {
            OverlayUtil.OpenIfEnabled(Dispatcher);
            LOG.Info("Finished Loading Log File in " + seconds + " seconds.");
            EventsLogLoadingComplete?.Invoke(this, true);
          }
          else
          {
            _ = Task.Delay(500).ContinueWith(task => UpdateLoadingProgress(), TaskScheduler.Default);
          }

          Busy(false);
        }
      });
    }
Ejemplo n.º 3
0
        private void SaveClick(object sender, RoutedEventArgs e)
        {
            if (!double.IsNaN(overlayCanvas.ActualHeight) && overlayCanvas.ActualHeight > 0)
            {
                ConfigUtil.SetSetting("OverlayHeight", overlayCanvas.ActualHeight.ToString(CultureInfo.CurrentCulture));
            }

            if (!double.IsNaN(overlayCanvas.ActualWidth) && overlayCanvas.ActualWidth > 0)
            {
                ConfigUtil.SetSetting("OverlayWidth", overlayCanvas.ActualWidth.ToString(CultureInfo.CurrentCulture));
            }

            var margin = SystemParameters.WindowNonClientFrameThickness;

            if (Top + margin.Top >= SystemParameters.VirtualScreenTop && (Left + margin.Left) >= SystemParameters.VirtualScreenLeft)
            {
                ConfigUtil.SetSetting("OverlayTop", (Top + margin.Top).ToString(CultureInfo.CurrentCulture));
                ConfigUtil.SetSetting("OverlayLeft", (Left + margin.Left).ToString(CultureInfo.CurrentCulture));
            }

            if (TitleBlock != null)
            {
                if (int.TryParse((fontSizeSelection.SelectedValue as ComboBoxItem).Tag as string, out int size))
                {
                    ConfigUtil.SetSetting("OverlayFontSize", size.ToString(CultureInfo.CurrentCulture));
                }

                ConfigUtil.SetSetting("OverlayDamageMode", (string)(damageModeSelection.SelectedItem as ComboBoxItem).Tag);
                ConfigUtil.SetSetting("HideOverlayOtherPlayers", IsHideOverlayOtherPlayersEnabled.ToString(CultureInfo.CurrentCulture));
                ConfigUtil.SetSetting("ShowOverlayCritRate", IsShowOverlayCritRateEnabled.ToString(CultureInfo.CurrentCulture));
                ConfigUtil.SetSetting("SelectedOverlayClass", SelectedClass);

                ColorComboBoxList.ForEach(colorChoice =>
                {
                    ConfigUtil.SetSetting(colorChoice.Tag as string, (colorChoice.SelectedValue as ColorItem).Name);
                });
            }

            OverlayUtil.OpenOverlay(Dispatcher, false, true);
        }
Ejemplo n.º 4
0
        private void UpdateLoadingProgress()
        {
            Dispatcher.InvokeAsync(() =>
            {
                if (EQLogReader != null)
                {
                    OverlayUtil.CloseOverlay();

                    var seconds           = Math.Round((DateTime.Now - StartLoadTime).TotalSeconds);
                    double filePercent    = EQLogReader.FileSize > 0 ? Math.Min(Convert.ToInt32((double)FilePosition / EQLogReader.FileSize * 100), 100) : 100;
                    statusText.Text       = string.Format(CultureInfo.CurrentCulture, "Reading Log... {0}% in {1} seconds", filePercent, seconds);
                    statusText.Foreground = LOADING_BRUSH;

                    if (EQLogReader.FileLoadComplete)
                    {
                        if (filePercent >= 100 || CurrentLogOption == LogOption.MONITOR)
                        {
                            statusText.Foreground = GOOD_BRUSH;
                            statusText.Text       = "Monitoring Active";
                        }

                        ConfigUtil.SetSetting("LastOpenedFile", CurrentLogFile);
                    }

                    if (((filePercent >= 100 && CastProcessor.GetPercentComplete() >= 100 && DamageProcessor.GetPercentComplete() >= 100 &&
                          HealingProcessor.GetPercentComplete() >= 100 && MiscProcessor.GetPercentComplete() >= 100) ||
                         CurrentLogOption == LogOption.MONITOR) && EQLogReader.FileLoadComplete)
                    {
                        OverlayUtil.OpenIfEnabled(Dispatcher);
                        LOG.Info("Finished Loading Log File in " + seconds.ToString(CultureInfo.CurrentCulture) + " seconds.");
                        EventsLogLoadingComplete?.Invoke(this, true);
                    }
                    else
                    {
                        _ = Task.Delay(500).ContinueWith(task => UpdateLoadingProgress(), TaskScheduler.Default);
                    }
                }
            });
        }
Ejemplo n.º 5
0
 private void CloseOverlay_MouseClick(object sender, RoutedEventArgs e) => OverlayUtil.ResetOverlay(Dispatcher);
Ejemplo n.º 6
0
        public OverlayWindow(bool configure = false)
        {
            InitializeComponent();
            LoadColorSettings();

            string width  = ConfigUtil.GetSetting("OverlayWidth");
            string height = ConfigUtil.GetSetting("OverlayHeight");
            string top    = ConfigUtil.GetSetting("OverlayTop");
            string left   = ConfigUtil.GetSetting("OverlayLeft");

            // Hide other player names on overlay
            IsHideOverlayOtherPlayersEnabled = ConfigUtil.IfSet("HideOverlayOtherPlayers");
            showNameSelection.SelectedIndex  = IsHideOverlayOtherPlayersEnabled ? 1 : 0;

            // Hide/Show crit rate
            IsShowOverlayCritRateEnabled        = ConfigUtil.IfSet("ShowOverlayCritRate");
            showCritRateSelection.SelectedIndex = IsShowOverlayCritRateEnabled ? 1 : 0;

            var  margin     = SystemParameters.WindowNonClientFrameThickness;
            bool offsetSize = configure || width == null || height == null || top == null || left == null;

            if (!offsetSize)
            {
                CreateRows();
                Title       = "Overlay";
                MinHeight   = 0;
                UpdateTimer = new DispatcherTimer {
                    Interval = new TimeSpan(0, 0, 0, 0, 1000)
                };
                UpdateTimer.Tick  += UpdateTimerTick;
                AllowsTransparency = true;
                Style       = null;
                WindowStyle = WindowStyle.None;
                SetVisible(false);
                ShowActivated = false;
            }
            else
            {
                overlayCanvas.Background = new SolidColorBrush(Color.FromRgb(45, 45, 48));
                CreateRows(true);
                MinHeight          = 130;
                AllowsTransparency = false;
                WindowStyle        = WindowStyle.SingleBorderWindow;
                SetVisible(true);
                LoadTestData();
            }

            if (width != null && double.TryParse(width, out double dvalue) && !double.IsNaN(dvalue))
            {
                Width = offsetSize ? dvalue + margin.Left + margin.Right : dvalue;
            }

            if (height != null && double.TryParse(height, out dvalue) && !double.IsNaN(dvalue))
            {
                Height = offsetSize ? dvalue + margin.Top + margin.Bottom : 0;
                if (!offsetSize)
                {
                    CalculatedRowHeight = dvalue / (MAX_ROWS + 1);
                }
            }

            if (top != null && double.TryParse(top, out dvalue) && !double.IsNaN(dvalue))
            {
                var test = offsetSize ? dvalue - margin.Top : dvalue;
                if (test >= SystemParameters.VirtualScreenTop && test < SystemParameters.VirtualScreenHeight)
                {
                    Top = test;
                }
            }

            if (left != null && double.TryParse(left, out dvalue) && !double.IsNaN(dvalue))
            {
                var test = offsetSize ? dvalue - margin.Left : dvalue;
                if (test >= SystemParameters.VirtualScreenLeft && test < SystemParameters.VirtualScreenWidth)
                {
                    Left = test;
                }
            }

            int damageMode = ConfigUtil.GetSettingAsInteger("OverlayDamageMode");

            foreach (var item in damageModeSelection.Items.Cast <ComboBoxItem>())
            {
                if ((string)item.Tag == damageMode.ToString(CultureInfo.CurrentCulture))
                {
                    damageModeSelection.SelectedItem = item;
                    CurrentDamageSelectionMode       = damageMode;
                }
            }

            string fontSize        = ConfigUtil.GetSetting("OverlayFontSize");
            bool   fontHasBeenSet  = false;
            int    currentFontSize = DEFAULT_TEXT_FONT_SIZE;

            if (fontSize != null && int.TryParse(fontSize, out currentFontSize) && currentFontSize >= 0 && currentFontSize <= 64)
            {
                foreach (var item in fontSizeSelection.Items)
                {
                    if ((item as ComboBoxItem).Tag as string == fontSize)
                    {
                        fontSizeSelection.SelectedItem = item;
                        SetFont(currentFontSize);
                        fontHasBeenSet = true;
                    }
                }
            }

            if (!fontHasBeenSet)
            {
                SetFont(currentFontSize);
            }

            if (!offsetSize)
            {
                NpcDamageManager.EventsPlayerAttackProcessed += NpcDamageManager_EventsPlayerAttackProcessed;
                DataManager.Instance.EventsNewInactiveFight  += Instance_EventsNewInactiveFight;
                Active = true;
            }
            else
            {
                // remove when configuring
                NpcDamageManager.EventsPlayerAttackProcessed -= NpcDamageManager_EventsPlayerAttackProcessed;
                DataManager.Instance.EventsNewInactiveFight  -= Instance_EventsNewInactiveFight;
            }

            if (!configure)
            {
                var settingsButton = CreateButton("Change Settings", "\xE713", currentFontSize - 1);
                settingsButton.Click += (object sender, RoutedEventArgs e) => OverlayUtil.OpenOverlay(Dispatcher, true, false);
                settingsButton.Margin = new Thickness(4, 0, 0, 0);

                var copyButton = CreateButton("Copy Parse", "\xE8C8", currentFontSize - 1);
                copyButton.Click += (object sender, RoutedEventArgs e) =>
                {
                    lock (Stats)
                    {
                        (Application.Current.MainWindow as MainWindow)?.AddAndCopyDamageParse(Stats, Stats.StatsList);
                    }
                };

                var refreshButton = CreateButton("Cancel Current Parse", "\xE8BB", currentFontSize - 1);
                refreshButton.Click += (object sender, RoutedEventArgs e) => OverlayUtil.ResetOverlay(Dispatcher);

                ButtonPopup  = new Popup();
                ButtonsPanel = CreateNameStackPanel();
                ButtonsPanel.Children.Add(settingsButton);
                ButtonsPanel.Children.Add(copyButton);
                ButtonsPanel.Children.Add(refreshButton);
                ButtonPopup.Child = ButtonsPanel;
                ButtonPopup.AllowsTransparency = true;
                ButtonPopup.Opacity            = 0.3;
                ButtonPopup.Placement          = PlacementMode.Relative;
                ButtonPopup.PlacementTarget    = this;
                ButtonPopup.VerticalOffset     = -1;

                ButtonsPanel.SizeChanged += (object sender, SizeChangedEventArgs e) =>
                {
                    if (TitlePanel.Margin.Left != e.NewSize.Width + 2)
                    {
                        TitlePanel.Margin = new Thickness(e.NewSize.Width + 2, TitlePanel.Margin.Top, 0, TitlePanel.Margin.Bottom);
                    }

                    if (ButtonsPanel != null && ButtonsPanel.ActualHeight != TitlePanel.ActualHeight)
                    {
                        ButtonsPanel.Height = TitlePanel.ActualHeight;
                    }
                };
            }
        }
Ejemplo n.º 7
0
        public MainWindow()
        {
            try
            {
                InitializeComponent();

                // update titles
#pragma warning disable CA1303 // Do not pass literals as localized parameters
                versionText.Text = VERSION;
#pragma warning restore CA1303 // Do not pass literals as localized parameters

                // used for setting menu icons based on open windows
                IconToWindow = new Dictionary <string, DockingWindow>()
                {
                    { npcIcon.Name, npcWindow }, { verifiedPlayersIcon.Name, verifiedPlayersWindow },
                    { verifiedPetsIcon.Name, verifiedPetsWindow }, { petMappingIcon.Name, petMappingWindow },
                    { playerParseIcon.Name, playerParseTextWindow }
                };

                // Clear/Reset
                DataManager.Instance.EventsClearedActiveData += Instance_EventsClearedActiveData;

                // verified pets table
                verifiedPetsGrid.ItemsSource = VerifiedPetsView;
                PlayerManager.Instance.EventsNewVerifiedPet += (sender, name) => Dispatcher.InvokeAsync(() =>
                {
                    Helpers.InsertNameIntoSortedList(name, VerifiedPetsView);
                    verifiedPetsWindow.Title = string.Format(CultureInfo.CurrentCulture, PETS_LIST_TITLE, VerifiedPetsView.Count);
                });

                // pet -> players
                petMappingGrid.ItemsSource = PetPlayersView;
                PlayerManager.Instance.EventsNewPetMapping += (sender, mapping) =>
                {
                    Dispatcher.InvokeAsync(() =>
                    {
                        var existing = PetPlayersView.FirstOrDefault(item => item.Pet.Equals(mapping.Pet, StringComparison.OrdinalIgnoreCase));
                        if (existing != null && existing.Owner != mapping.Owner)
                        {
                            existing.Owner = mapping.Owner;
                        }
                        else
                        {
                            PetPlayersView.Add(mapping);
                        }

                        petMappingWindow.Title = "Pet Owners (" + PetPlayersView.Count + ")";
                    });
                    CheckComputeStats();
                };

                PlayerManager.Instance.EventsRemoveVerifiedPet += (sender, name) => Dispatcher.InvokeAsync(() =>
                {
                    var found = VerifiedPetsView.FirstOrDefault(item => item.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
                    if (found != null)
                    {
                        VerifiedPetsView.Remove(found);
                        verifiedPetsWindow.Title = string.Format(CultureInfo.CurrentCulture, PETS_LIST_TITLE, VerifiedPetsView.Count);

                        var existing = PetPlayersView.FirstOrDefault(item => item.Pet.Equals(name, StringComparison.OrdinalIgnoreCase));
                        if (existing != null)
                        {
                            PetPlayersView.Remove(existing);
                            petMappingWindow.Title = "Pet Owners (" + PetPlayersView.Count + ")";
                        }
                        CheckComputeStats();
                    }
                });

                // verified player table
                verifiedPlayersGrid.ItemsSource = VerifiedPlayersProperty;
                PlayerManager.Instance.EventsNewVerifiedPlayer += (sender, name) => Dispatcher.InvokeAsync(() =>
                {
                    Helpers.InsertNameIntoSortedList(name, VerifiedPlayersProperty);
                    verifiedPlayersWindow.Title = string.Format(CultureInfo.CurrentCulture, PLAYER_LIST_TITLE, VerifiedPlayersProperty.Count);
                });

                PlayerManager.Instance.EventsRemoveVerifiedPlayer += (sender, name) => Dispatcher.InvokeAsync(() =>
                {
                    var found = VerifiedPlayersProperty.FirstOrDefault(item => item.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
                    if (found != null)
                    {
                        VerifiedPlayersProperty.Remove(found);
                        verifiedPlayersWindow.Title = string.Format(CultureInfo.CurrentCulture, PLAYER_LIST_TITLE, VerifiedPlayersProperty.Count);

                        var existing = PetPlayersView.FirstOrDefault(item => item.Owner.Equals(name, StringComparison.OrdinalIgnoreCase));
                        if (existing != null)
                        {
                            PetPlayersView.Remove(existing);
                            petMappingWindow.Title = "Pet Owners (" + PetPlayersView.Count + ")";
                        }
                        CheckComputeStats();
                    }
                });

                (npcWindow.Content as FightTable).EventsSelectionChange += (sender, data) => ComputeStats();
                DamageStatsManager.Instance.EventsUpdateDataPoint       += (sender, data) => HandleChartUpdateEvent(DamageChartWindow, sender, data);
                HealingStatsManager.Instance.EventsUpdateDataPoint      += (sender, data) => HandleChartUpdateEvent(HealingChartWindow, sender, data);
                TankingStatsManager.Instance.EventsUpdateDataPoint      += (sender, data) => HandleChartUpdateEvent(TankingChartWindow, sender, data);

                // Setup themes
                ThemeManager.BeginUpdate();
                ThemeManager.AreNativeThemesEnabled = true;
                SystemThemeCatalogRegistrar.Register();
                ThemeManager.CurrentTheme = ThemeNames.Dark;

                UpdateDeleteChatMenu();

                // Bane Damage
                IsBaneDamageEnabled             = ConfigUtil.IfSet("IncludeBaneDamage");
                enableBaneDamageIcon.Visibility = IsBaneDamageEnabled ? Visibility.Visible : Visibility.Hidden;

                // Damage Overlay
                enableDamageOverlayIcon.Visibility = OverlayUtil.LoadSettings() ? Visibility.Visible : Visibility.Hidden;

                // AoE healing
                IsAoEHealingEnabled             = ConfigUtil.IfSet("IncludeAoEHealing");
                enableAoEHealingIcon.Visibility = IsAoEHealingEnabled ? Visibility.Visible : Visibility.Hidden;

                // Hide window when minimized
                IsHideOnMinimizeEnabled             = ConfigUtil.IfSet("HideWindowOnMinimize");
                enableHideOnMinimizeIcon.Visibility = IsHideOnMinimizeEnabled ? Visibility.Visible : Visibility.Hidden;

                // Show Tanking Summary at startup
                ConfigUtil.IfSet("ShowTankingSummaryAtStartup", OpenTankingSummary);
                // Show Healing Summary at startup
                ConfigUtil.IfSet("ShowHealingSummaryAtStartup", OpenHealingSummary);
                // Show Healing Summary at startup
                ConfigUtil.IfSet("ShowDamageSummaryAtStartup", OpenDamageSummary, true);
                // Show Tanking Summary at startup
                ConfigUtil.IfSet("ShowTankingChartAtStartup", OpenTankingChart);
                // Show Healing Summary at startup
                ConfigUtil.IfSet("ShowHealingChartAtStartup", OpenHealingChart);
                // Show Healing Summary at startup
                ConfigUtil.IfSet("ShowDamageChartAtStartup", OpenDamageChart);
                LOG.Info("Initialized Components");

                if (ConfigUtil.IfSet("AutoMonitor"))
                {
                    enableAutoMonitorIcon.Visibility = Visibility.Visible;
                    var previousFile = ConfigUtil.GetSetting("LastOpenedFile");
                    if (File.Exists(previousFile))
                    {
                        OpenLogFile(LogOption.MONITOR, previousFile);
                    }
                }
                else
                {
                    enableAutoMonitorIcon.Visibility = Visibility.Hidden;
                }

                if (ConfigUtil.IfSet("Debug"))
                {
                    LOG.Info("Debug Enabled. Saving Unprocessed Lines to " + ConfigUtil.LogsDir);
                    ConfigUtil.Debug = true;
                }
            }
            catch (Exception e)
            {
                LOG.Error(e);
                throw;
            }
            finally
            {
                ThemeManager.EndUpdate();
            }
        }
Ejemplo n.º 8
0
        private void ToggleDamageOverlayClick(object sender, RoutedEventArgs e)
        {
            var enabled = OverlayUtil.ToggleOverlay(Dispatcher);

            enableDamageOverlayIcon.Visibility = enabled ? Visibility.Visible : Visibility.Hidden;
        }
Ejemplo n.º 9
0
        private void CreateRows(bool configure = false)
        {
            configPanel.SetValue(Panel.ZIndexProperty, 3);
            configPanel.SetValue(Canvas.RightProperty, 4.0);
            savePanel.SetValue(Panel.ZIndexProperty, 3);
            savePanel.SetValue(Canvas.BottomProperty, 1.0);

            TitleRectangle = OverlayUtil.CreateRectangle(TITLECOLOR);
            overlayCanvas.Children.Add(TitleRectangle);

            TitlePanel            = OverlayUtil.CreateNameStackPanel();
            TitleBlock            = OverlayUtil.CreateTextBlock();
            TitleBlock.Foreground = configure ? OverlayUtil.TEXTBRUSH : OverlayUtil.TITLEBRUSH;
            TitlePanel.Children.Add(TitleBlock);
            overlayCanvas.Children.Add(TitlePanel);

            TitleDamagePanel = OverlayUtil.CreateDamageStackPanel();
            TitleDamageBlock = OverlayUtil.CreateTextBlock();
            TitleDamagePanel.Children.Add(TitleDamageBlock);
            overlayCanvas.Children.Add(TitleDamagePanel);

            if (!configure)
            {
                TitlePanel.SizeChanged       += TitleResizing;
                TitleDamagePanel.SizeChanged += TitleResizing;
            }

            for (int i = 0; i < CurrentMaxRows; i++)
            {
                var rectangle = OverlayUtil.CreateRectangle(ColorList[i]);
                RectangleList.Add(rectangle);
                overlayCanvas.Children.Add(rectangle);

                var nameStack = OverlayUtil.CreateNameStackPanel();
                NamePanels.Add(nameStack);

                var classImage = OverlayUtil.CreateImage();
                NameIconList.Add(classImage);
                nameStack.Children.Add(classImage);

                var nameBlock = OverlayUtil.CreateTextBlock();
                NameBlockList.Add(nameBlock);
                nameStack.Children.Add(nameBlock);
                overlayCanvas.Children.Add(nameStack);

                var damageStack = OverlayUtil.CreateDamageStackPanel();
                DamagePanels.Add(damageStack);

                if (configure)
                {
                    var colorChoice = new ColorComboBox(ColorComboBox.Theme.Dark)
                    {
                        Tag = string.Format(CultureInfo.CurrentCulture, "OverlayRankColor{0}", i + 1)
                    };
                    colorChoice.SelectionChanged += (object sender, SelectionChangedEventArgs e) =>
                    {
                        rectangle.Fill = OverlayUtil.CreateBrush((colorChoice.SelectedValue as ColorItem).Brush.Color);
                    };

                    if (colorChoice.ItemsSource is List <ColorItem> colors)
                    {
                        colorChoice.SelectedItem = colors.Find(item => item.Brush.Color == ColorList[i]);
                    }

                    ColorComboBoxList.Add(colorChoice);
                    damageStack.Children.Add(colorChoice);
                }
                else
                {
                    var damageRate = OverlayUtil.CreateImageAwesome();
                    DamageRateList.Add(damageRate);
                    damageStack.Children.Add(damageRate);

                    var damageBlock = OverlayUtil.CreateTextBlock();
                    DamageBlockList.Add(damageBlock);
                    damageStack.Children.Add(damageBlock);
                }

                overlayCanvas.Children.Add(damageStack);
            }
        }