コード例 #1
0
        public override void AddCustomElements()
        {
            if (ListCustomElements.Count > 0)
            {
#if DEBUG
                logger.Debug($"SystemChecker - CustomElements allready insert - {ListCustomElements.Count}");
#endif
                return;
            }

            FrameworkElement PART_ScheckButtonWithJustIcon           = null;
            FrameworkElement PART_ScheckButtonWithJustIconAndDetails = null;
            try
            {
                PART_ScheckButtonWithJustIcon           = IntegrationUI.SearchElementByName("PART_ScheckButtonWithJustIcon", false, true);
                PART_ScheckButtonWithJustIconAndDetails = IntegrationUI.SearchElementByName("PART_ScheckButtonWithJustIconAndDetails", false, true);
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "SystemChecker", $"Error on find custom element");
            }

            if (PART_ScheckButtonWithJustIcon != null)
            {
                PART_ScheckButtonWithJustIcon = new SystemCheckerButton();
                ((Button)PART_ScheckButtonWithJustIcon).Click += OnBtActionBarClick;
                try
                {
                    ui.AddElementInCustomTheme(PART_ScheckButtonWithJustIcon, "PART_ScheckButtonWithJustIcon");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_ScheckButtonWithJustIcon", Element = PART_ScheckButtonWithJustIcon
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "SystemChecker", "Error on AddCustomElements()");
                }
            }

            if (PART_ScheckButtonWithJustIconAndDetails != null)
            {
                PART_ScheckButtonWithJustIconAndDetails = new SystemCheckerButtonDetails();
                ((Button)PART_ScheckButtonWithJustIconAndDetails).Click += OnBtActionBarClick;
                try
                {
                    ui.AddElementInCustomTheme(PART_ScheckButtonWithJustIconAndDetails, "PART_ScheckButtonWithJustIconAndDetails");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_ScheckButtonWithJustIconAndDetails", Element = PART_ScheckButtonWithJustIconAndDetails
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "SystemChecker", "Error on AddCustomElements()");
                }
            }
        }
コード例 #2
0
        public override void AddBtActionBar()
        {
            CheckTypeView();

            if (PART_BtActionBar != null)
            {
#if DEBUG
                logger.Debug($"SystemChecker - PART_BtActionBar allready insert");
#endif
                return;
            }

            Button BtActionBar = new Button();

            if (PluginDatabase.PluginSettings.EnableIntegrationButton)
            {
                BtActionBar = new SystemCheckerButton();
            }

            if (PluginDatabase.PluginSettings.EnableIntegrationButtonDetails)
            {
                BtActionBar = new SystemCheckerButtonDetails();
            }

            BtActionBar.Click  += OnBtActionBarClick;
            BtActionBar.Name    = BtActionBarName;
            DefaultBtForeground = BtActionBar.Foreground;

            try
            {
                ui.AddButtonInGameSelectedActionBarButtonOrToggleButton(BtActionBar);
                PART_BtActionBar = IntegrationUI.SearchElementByName(BtActionBarName);
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "SystemChecker", "Error on AddBtActionBar()");
            }
        }