示例#1
0
        public override void AddBtActionBar()
        {
            if (PART_BtActionBar != null)
            {
#if DEBUG
                logger.Debug($"GameActivity [Ignored] - PART_BtActionBar allready insert");
#endif
                return;
            }

            FrameworkElement BtActionBar;

            if (PluginDatabase.PluginSettings.EnableIntegrationInDescriptionWithToggle)
            {
                if (PluginDatabase.PluginSettings.EnableIntegrationButtonDetails)
                {
                    BtActionBar = new GameActivityToggleButtonDetails();
                }
                else
                {
                    BtActionBar = new GameActivityToggleButton();
                }

                ((ToggleButton)BtActionBar).Click += OnBtActionBarToggleButtonClick;
            }
            else
            {
                if (PluginDatabase.PluginSettings.EnableIntegrationButtonDetails)
                {
                    BtActionBar = new GameActivityButtonDetails();
                }
                else
                {
                    BtActionBar = new GameActivityButton();
                }

                ((Button)BtActionBar).Click += OnBtActionBarClick;
            }

            if (!PluginDatabase.PluginSettings.EnableIntegrationInDescriptionOnlyIcon)
            {
                BtActionBar.MinWidth = 150;
            }

            BtActionBar.Name = BtActionBarName;

            try
            {
                ui.AddButtonInGameSelectedActionBarButtonOrToggleButton(BtActionBar);
                PART_BtActionBar = IntegrationUI.SearchElementByName(BtActionBarName);
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "GameActivity");
            }
        }
示例#2
0
        public override void AddCustomElements()
        {
            if (ListCustomElements.Count > 0)
            {
#if DEBUG
                logger.Debug($"GameActivity [Ignored] - CustomElements allready insert - {ListCustomElements.Count}");
#endif
                return;
            }

            FrameworkElement PART_GaButtonWithJustIcon        = null;
            FrameworkElement PART_GaButtonWithTitle           = null;
            FrameworkElement PART_GaButtonWithTitleAndDetails = null;

            FrameworkElement PART_GameActivity_Graphic    = null;
            FrameworkElement PART_GameActivity_GraphicLog = null;
            try
            {
                PART_GaButtonWithJustIcon        = IntegrationUI.SearchElementByName("PART_GaButtonWithJustIcon", false, true);
                PART_GaButtonWithTitle           = IntegrationUI.SearchElementByName("PART_GaButtonWithTitle", false, true);
                PART_GaButtonWithTitleAndDetails = IntegrationUI.SearchElementByName("PART_GaButtonWithTitleAndDetails", false, true);

                PART_GameActivity_Graphic    = IntegrationUI.SearchElementByName("PART_GameActivity_Graphic", false, true);
                PART_GameActivity_GraphicLog = IntegrationUI.SearchElementByName("PART_GameActivity_GraphicLog", false, true);
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "GameActivity", $"Error on find custom element");
            }


            if (PART_GaButtonWithJustIcon != null)
            {
                PART_GaButtonWithJustIcon = new GameActivityButton(true);
                ((Button)PART_GaButtonWithJustIcon).Click += OnBtActionBarClick;
                try
                {
                    ui.AddElementInCustomTheme(PART_GaButtonWithJustIcon, "PART_GaButtonWithJustIcon");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_GaButtonWithJustIcon", Element = PART_GaButtonWithJustIcon
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "GameActivity");
                }
            }
            else
            {
#if DEBUG
                logger.Debug($"GameActivity [Ignored] - PART_GaButtonWithJustIcon not find");
#endif
            }

            if (PART_GaButtonWithTitle != null)
            {
                PART_GaButtonWithTitle = new GameActivityButton(false);
                ((Button)PART_GaButtonWithTitle).Click += OnBtActionBarClick;
                try
                {
                    ui.AddElementInCustomTheme(PART_GaButtonWithTitle, "PART_GaButtonWithTitle");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_GaButtonWithTitle", Element = PART_GaButtonWithTitle
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "GameActivity");
                }
            }
            else
            {
#if DEBUG
                logger.Debug($"GameActivity [Ignored] - PART_GaButtonWithTitle not find");
#endif
            }

            if (PART_GaButtonWithTitleAndDetails != null)
            {
                PART_GaButtonWithTitleAndDetails = new GameActivityButtonDetails();
                ((Button)PART_GaButtonWithTitleAndDetails).Click += OnBtActionBarClick;
                try
                {
                    ui.AddElementInCustomTheme(PART_GaButtonWithTitleAndDetails, "PART_GaButtonWithTitleAndDetails");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_GaButtonWithTitleAndDetails", Element = PART_GaButtonWithTitleAndDetails
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "GameActivity");
                }
            }
            else
            {
#if DEBUG
                logger.Debug($"GameActivity [Ignored] - PART_GaButtonWithTitleAndDetails not find");
#endif
            }


            if (PART_GameActivity_Graphic != null && PluginDatabase.PluginSettings.IntegrationShowGraphic)
            {
                PART_GameActivity_Graphic = new GameActivityGameGraphicTime(0, PluginDatabase.PluginSettings.IntegrationGraphicOptionsCountAbscissa);
                ((GameActivityGameGraphicTime)PART_GameActivity_Graphic).DisableAnimations(true);

                PART_GameActivity_Graphic.Name = "GameActivity_Graphic";
                try
                {
                    ui.AddElementInCustomTheme(PART_GameActivity_Graphic, "PART_GameActivity_Graphic");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_GameActivity_Graphic", Element = PART_GameActivity_Graphic
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "GameActivity");
                }
            }
            else
            {
#if DEBUG
                logger.Debug($"GameActivity [Ignored] - PART_GameActivity_Graphic not find");
#endif
            }

            if (PART_GameActivity_GraphicLog != null && PluginDatabase.PluginSettings.IntegrationShowGraphicLog)
            {
                PART_GameActivity_GraphicLog = new GameActivityGameGraphicLog(null, string.Empty, 0, !PluginDatabase.PluginSettings.EnableIntegrationInCustomTheme, PluginDatabase.PluginSettings.IntegrationGraphicLogOptionsCountAbscissa);
                ((GameActivityGameGraphicLog)PART_GameActivity_GraphicLog).DisableAnimations(true);

                PART_GameActivity_GraphicLog.Name = "GameActivity_GraphicLog";
                try
                {
                    ui.AddElementInCustomTheme(PART_GameActivity_GraphicLog, "PART_GameActivity_GraphicLog");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_GameActivity_GraphicLog", Element = PART_GameActivity_GraphicLog
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "GameActivity");
                }
            }
            else
            {
#if DEBUG
                logger.Debug($"GameActivity [Ignored] - PART_GameActivity_GraphicLog not find");
#endif
            }
        }