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


            Button BtActionBar = new Button();

            if (PluginDatabase.PluginSettings.EnableIntegrationButtonDetails)
            {
                BtActionBar = new ClButtonAdvanced();
            }
            else
            {
                BtActionBar        = new ClButton();
                BtActionBar.Click += OnBtActionBarClick;
            }

            BtActionBar.Name = BtActionBarName;

            try
            {
                ui.AddButtonInGameSelectedActionBarButtonOrToggleButton(BtActionBar);
                PART_BtActionBar = IntegrationUI.SearchElementByName(BtActionBarName);
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "CheckLocalizations");
            }
        }
        private void StatsGraphicAchievements_Loaded(object sender, RoutedEventArgs e)
        {
            IntegrationUI.SetControlSize((FrameworkElement)sender);

            ((FrameworkElement)((FrameworkElement)sender).Parent).Height = ((FrameworkElement)sender).Height;
            ((FrameworkElement)sender).Height = ((FrameworkElement)sender).Height + 18;
        }
Example #3
0
        public override void AddSpInfoBarFS()
        {
            if (PART_SpInfoBarFS != null)
            {
#if DEBUG
                logger.Debug($"HowLongToBeat [Ignored] - PART_BtInfoBar allready insert");
#endif

                ((HLTBInfoBarFS)PART_SpInfoBarFS).SetData(PluginDatabase.Get(HowLongToBeatDatabase.GameSelected));
                return;
            }

            FrameworkElement SpInfoBar;
            SpInfoBar = new HLTBInfoBarFS();

            SpInfoBar.Name   = SpInfoBarFSName;
            SpInfoBar.Margin = new Thickness(50, 0, 0, 0);

            try
            {
                ui.AddStackPanelInGameSelectedInfoBarFS(SpInfoBar);
                PART_SpInfoBarFS = IntegrationUI.SearchElementByName(SpInfoBarFSName);

                if (PART_SpInfoBarFS != null)
                {
                    ((HLTBInfoBarFS)PART_SpInfoBarFS).SetData(PluginDatabase.Get(HowLongToBeatDatabase.GameSelected));
                }
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "HowLongToBeat");
            }
        }
Example #4
0
        public override DispatcherOperation AddElementsFS()
        {
            if (_PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Fullscreen)
            {
                if (IsFirstLoad)
                {
#if DEBUG
                    logger.Debug($"HowLongToBeat [Ignored] - IsFirstLoad");
#endif
                    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new ThreadStart(delegate
                    {
                        System.Threading.SpinWait.SpinUntil(() => IntegrationUI.SearchElementByName("PART_ButtonContext") != null, 5000);
                    })).Wait();
                    IsFirstLoad = false;
                }

                return(Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new ThreadStart(delegate
                {
                    if (PluginDatabase.PluginSettings.EnableIntegrationFS)
                    {
#if DEBUG
                        logger.Debug($"HowLongToBeat [Ignored] - AddBtInfoBarFS()");
#endif
                        AddSpInfoBarFS();
                    }
                })));
            }

            return(null);
        }
Example #5
0
        private void TbThemeConstants_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
            try
            {
                Grid gdParent = (Grid)((FrameworkElement)sender).Parent;

                string Name    = (string)((Label)IntegrationUI.SearchElementByName("PART_ThemeConstantsLabel", gdParent)).Tag;
                string Element = ((TextBox)sender).Text;

                if (SettingsThemeConstants.Find(x => x.Name == Name) != null)
                {
                    SettingsThemeConstants.Find(x => x.Name == Name).Element = Element;
                }
                else
                {
                    SettingsThemeConstants.Add(new ThemeElement {
                        Name = Name, Element = Element
                    });
                }
#if DEBUG
                logger.Debug($"ThemeModifier [Ignored] - SettingsThemeConstants: {JsonConvert.SerializeObject(SettingsThemeConstants)}");
#endif
            }
            catch (Exception ex)
            {
#if DEBUG
                Common.LogError(ex, "ThemeModifier [Ignored]");
#endif
            }
        }
Example #6
0
        private void CbThemeConstants_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                Grid gdParent = (Grid)((FrameworkElement)sender).Parent;

                string  Name    = (string)((Label)IntegrationUI.SearchElementByName("PART_ThemeConstantsLabel", gdParent)).Tag;
                dynamic Element = ((ComboBoxItem)((ComboBox)sender).SelectedItem).Tag;

                if (SettingsThemeConstants.Find(x => x.Name == Name) != null)
                {
                    SettingsThemeConstants.Find(x => x.Name == Name).Element = Element;
                }
                else
                {
                    SettingsThemeConstants.Add(new ThemeElement {
                        Name = Name, Element = Element
                    });
                }
#if DEBUG
                logger.Debug($"ThemeModifier [Ignored] - SettingsThemeConstants: {JsonConvert.SerializeObject(SettingsThemeConstants)}");
#endif
            }
            catch (Exception ex)
            {
#if DEBUG
                Common.LogError(ex, "ThemeModifier [Ignored]");
#endif
            }
        }
        public override void AddBtActionBar()
        {
            if (PART_BtActionBar != null)
            {
#if DEBUG
                logger.Debug($"HowLongToBeat - PART_BtActionBar allready insert");
#endif
                return;
            }

            HltbButton BtActionBar = new HltbButton();
            BtActionBar.Click += OnBtActionBarClick;
            BtActionBar.Name   = BtActionBarName;
            BtActionBar.Margin = new Thickness(10, 0, 0, 0);

            try
            {
                ui.AddButtonInGameSelectedActionBarButtonOrToggleButton(BtActionBar);
                PART_BtActionBar = IntegrationUI.SearchElementByName(BtActionBarName);
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "HowLongToBeat", "Error on AddBtActionBar()");
            }
        }
        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                // Define height & width
                var parent = ((FrameworkElement)((FrameworkElement)(((UserControl)IntegrationUI.GetAncestorOfType <UserControl>((FrameworkElement)sender))).Parent).Parent);

                if (!double.IsNaN(parent.Height) && parent.Height > 0)
                {
                    ((FrameworkElement)sender).Height = parent.Height;
                }

                if (!double.IsNaN(parent.Width) && parent.Width > 0)
                {
                    ((FrameworkElement)sender).Width = parent.Width;
                }
#if DEBUG
                logger.Debug($"HowLongToBeat - Parent({parent.Height}, {parent.Width}, {parent.Name}) -  Height: {((FrameworkElement)sender).Height} - Width: {((FrameworkElement)sender).Width = parent.Width}");
#endif
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "HowLongToBeat", "Error on Grid_Loaded()");
            }
        }
Example #9
0
        private void PART_ListViewLanguages_Loaded(object sender, RoutedEventArgs e)
        {
            IntegrationUI.SetControlSize(PART_GridContener);

            if (_WithColNotes)
            {
#if DEBUG
                logger.Debug($"CheckLocalizations [Ignored] - PART_ListViewLanguages.ActualWidth: {PART_ListViewLanguages.ActualWidth}");
#endif
                if (!double.IsNaN(PART_ListViewLanguages.ActualWidth))
                {
                    double Width = PART_ListViewLanguages.ActualWidth - 150 - 70 - 70 - 70 - 30 - 25;

                    if (Width > 0)
                    {
                        PART_ColNotes.Width = Width;
                    }
                }
                else
                {
                    PART_ColNotes.Width = 100;
                }
            }
            else
            {
                PART_ColNotes.Width = 0;
            }
        }
Example #10
0
        public override void AddSpInfoBarFS()
        {
            if (PART_SpInfoBarFS != null)
            {
#if DEBUG
                logger.Debug($"ThemeModifier [Ignored] - PART_BtInfoBar allready insert");
#endif

                ((FeaturesListFS)PART_SpInfoBarFS).SetData(ThemeModifier.GameSelected);
                return;
            }

            FrameworkElement SpInfoBar;
            SpInfoBar = new FeaturesListFS();

            SpInfoBar.Name   = SpInfoBarFSName;
            SpInfoBar.Margin = new Thickness(50, 0, 0, 0);

            try
            {
                ui.AddStackPanelInGameSelectedInfoBarFS(SpInfoBar);
                PART_SpInfoBarFS = IntegrationUI.SearchElementByName(SpInfoBarFSName);

                if (PART_SpInfoBarFS != null)
                {
                    ((FeaturesListFS)PART_SpInfoBarFS).SetData(ThemeModifier.GameSelected);
                }
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "ThemeModifier");
            }
        }
Example #11
0
        private void PART_ChartLogActivity_Loaded(object sender, RoutedEventArgs e)
        {
            IntegrationUI.SetControlSize(PART_ChartLogActivity, PluginDatabase.PluginSettings.IntegrationShowGraphicLogHeight, 0);

            if (lGameSeriesLog.Visibility == Visibility.Visible)
            {
                PART_ChartLogActivity.Height = PART_ChartLogActivity.Height - lGameSeriesLog.ActualHeight - 5;
            }
        }
        public override void AddBtActionBar()
        {
            if (PART_BtActionBar != null)
            {
#if DEBUG
                logger.Debug($"SuccessStory - PART_BtActionBar allready insert");
#endif
                return;
            }

            FrameworkElement BtActionBar;

            if (_Settings.EnableIntegrationInDescriptionWithToggle)
            {
                if (_Settings.EnableIntegrationButtonDetails)
                {
                    BtActionBar = new SuccessStoryToggleButtonDetails();
                }
                else
                {
                    BtActionBar = new SuccessStoryToggleButton(_Settings);
                }

                ((ToggleButton)BtActionBar).Click += OnBtActionBarToggleButtonClick;
            }
            else
            {
                if (_Settings.EnableIntegrationButtonDetails)
                {
                    BtActionBar = new SuccessStoryButtonDetails();
                }
                else
                {
                    BtActionBar = new SuccessStoryButton(_Settings.EnableIntegrationInDescriptionOnlyIcon);
                }

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

            if (!_Settings.EnableIntegrationInDescriptionOnlyIcon)
            {
                BtActionBar.Width = 150;
            }

            BtActionBar.Name   = BtActionBarName;
            BtActionBar.Margin = new Thickness(10, 0, 0, 0);

            try
            {
                ui.AddButtonInGameSelectedActionBarButtonOrToggleButton(BtActionBar);
                PART_BtActionBar = IntegrationUI.SearchElementByName(BtActionBarName);
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "SuccessStory", "Error on AddBtActionBar()");
            }
        }
Example #13
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");
            }
        }
        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()");
                }
            }
        }
Example #15
0
        public void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            IntegrationUI.SetControlSize(PART_HltbProgressBar_Contener);

            try
            {
                if (PluginDatabase.PluginSettings.ProgressBarShowTime && !PluginDatabase.PluginSettings.ProgressBarShowTimeInterior)
                {
                    PART_HltbProgressBar_Contener.Height = PART_HltbProgressBar_Contener.Height - spShowTime.Height;
                }
                else
                {
                    spShowTime.Height = 0;
                }

                if (PluginDatabase.PluginSettings.ProgressBarShowTime && PluginDatabase.PluginSettings.ProgressBarShowTimeAbove)
                {
                    Grid.SetRow(spShowTime, 0);
                    Grid.SetRow(PART_HltbProgressBar_Contener, 1);
                }
                if (PluginDatabase.PluginSettings.ProgressBarShowTime && PluginDatabase.PluginSettings.ProgressBarShowTimeInterior)
                {
                    Grid.SetRow(spShowTime, 0);
                    spShowTime.Height = PART_HltbProgressBar_Contener.Height;
                }

                double SliderHeight = PART_HltbProgressBar_Contener.Height / 2;
                PartSliderFirst.Height  = SliderHeight;
                PartSliderSecond.Height = SliderHeight;
                PartSliderThird.Height  = SliderHeight;

                PartSliderFirst.Margin  = SliderPlaytime.Margin;
                PartSliderSecond.Margin = SliderPlaytime.Margin;
                PartSliderThird.Margin  = SliderPlaytime.Margin;

                Point Point1 = new Point(SliderHeight / 2.5, 0);
                Point Point2 = new Point(SliderHeight / 1.25, SliderHeight / 1.25);
                Point Point3 = new Point(0, SliderHeight / 1.25);
                ThumbPoint = new PointCollection();
                ThumbPoint.Add(Point1);
                ThumbPoint.Add(Point2);
                ThumbPoint.Add(Point3);

                this.DataContext = new
                {
                    ThumbFirst  = solidColorBrushFirst,
                    ThumbSecond = solidColorBrushSecond,
                    ThumbThird  = solidColorBrushThird,

                    ThumbPoint = ThumbPoint
                };
            }
            catch
            {
            }
        }
Example #16
0
        public override DispatcherOperation AddElements()
        {
            if (_PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Desktop)
            {
                if (IsFirstLoad)
                {
#if DEBUG
                    logger.Debug($"HowLongToBeat [Ignored] - IsFirstLoad");
#endif
                    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new ThreadStart(delegate
                    {
                        System.Threading.SpinWait.SpinUntil(() => IntegrationUI.SearchElementByName("PART_HtmlDescription") != null, 5000);
                    })).Wait();
                    IsFirstLoad = false;
                }

                return(Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new ThreadStart(delegate
                {
                    CheckTypeView();

                    if (PluginDatabase.PluginSettings.EnableIntegrationButton)
                    {
#if DEBUG
                        logger.Debug($"HowLongToBeat [Ignored] - AddBtActionBar()");
#endif
                        AddBtActionBar();
                    }

                    if (PluginDatabase.PluginSettings.EnableIntegrationInDescription)
                    {
#if DEBUG
                        logger.Debug($"HowLongToBeat [Ignored] - AddSpDescription()");
#endif
                        AddSpDescription();
                    }

                    if (PluginDatabase.PluginSettings.EnableIntegrationInCustomTheme)
                    {
#if DEBUG
                        logger.Debug($"HowLongToBeat [Ignored] - AddCustomElements()");
#endif
                        AddCustomElements();
                    }
                })));
            }

            return(null);
        }
Example #17
0
        public override void AddCustomElements()
        {
            if (ListCustomElements.Count > 0)
            {
#if DEBUG
                logger.Debug($"ThemeModifier [Ignored] - CustomElements allready insert - {ListCustomElements.Count}");
#endif
                return;
            }

            FrameworkElement PART_TmFeaturesList = null;

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

            if (PART_TmFeaturesList != null)
            {
                PART_TmFeaturesList = new FeaturesList();
                try
                {
                    ui.AddElementInCustomTheme(PART_TmFeaturesList, "PART_TmFeaturesList");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_TmFeaturesList", Element = PART_TmFeaturesList
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "ThemeModifier", "Error on AddCustomElements()");
                }
            }
            else
            {
#if DEBUG
                logger.Debug($"ThemeModifier [Ignored] - PART_TmFeaturesList not find");
#endif
            }
        }
Example #18
0
        private void CbThemeConstants_Click(object sender, RoutedEventArgs e)
        {
            Grid gdParent = (Grid)((FrameworkElement)sender).Parent;

            string Name    = (string)((Label)IntegrationUI.SearchElementByName("PART_ThemeConstantsLabel", gdParent)).Tag;
            bool   Element = (bool)((CheckBox)sender).IsChecked;

            if (SettingsThemeConstants.Find(x => x.Name == Name) != null)
            {
                SettingsThemeConstants.Find(x => x.Name == Name).Element = Element;
            }
            else
            {
                SettingsThemeConstants.Add(new ThemeElement {
                    Name = Name, Element = Element
                });
            }
#if DEBUG
            logger.Debug($"ThemeModifier [Ignored] - SettingsThemeConstants: {JsonConvert.SerializeObject(SettingsThemeConstants)}");
#endif
        }
Example #19
0
        private void sThemeConstants_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            try
            {
                Grid gdParent = (Grid)((FrameworkElement)sender).Parent;

                string  Name    = (string)((Label)IntegrationUI.SearchElementByName("PART_ThemeConstantsLabel", gdParent)).Tag;
                string  Type    = (string)gdParent.Tag;
                dynamic Element = null;
                if (Type.ToLower() == "int")
                {
                    Element = (int)((Slider)sender).Value;
                }
                if (Type.ToLower() == "double")
                {
                    Element = (double)Math.Round(((Slider)sender).Value, 1);
                }

                if (SettingsThemeConstants.Find(x => x.Name == Name) != null)
                {
                    SettingsThemeConstants.Find(x => x.Name == Name).Element = Element;
                }
                else
                {
                    SettingsThemeConstants.Add(new ThemeElement {
                        Name = Name, Element = Element
                    });
                }
#if DEBUG
                logger.Debug($"ThemeModifier [Ignored] - SettingsThemeConstants: {JsonConvert.SerializeObject(SettingsThemeConstants)}");
#endif
            }
            catch (Exception ex)
            {
#if DEBUG
                Common.LogError(ex, "ThemeModifier [Ignored]");
#endif
            }
        }
        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()");
            }
        }
Example #21
0
        public override void AddBtActionBar()
        {
            if (PART_BtActionBar != null)
            {
#if DEBUG
                logger.Debug($"ThemeModifier [Ignored] - PART_BtActionBar allready insert");
#endif
                return;
            }

            try
            {
                FeaturesList featuresList = new FeaturesList();
                featuresList.Name = BtActionBarName;

                ui.AddButtonInGameSelectedActionBarButtonOrToggleButton(featuresList);
                PART_BtActionBar = IntegrationUI.SearchElementByName(BtActionBarName);
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "ThemeModifier");
            }
        }
Example #22
0
        public override void AddSpDescription()
        {
            if (PART_SpDescription != null)
            {
#if DEBUG
                logger.Debug($"ThemeModifier [Ignored] - PART_SpDescription allready insert");
#endif
                return;
            }

            try
            {
                FeaturesList SpDescription = new FeaturesList();
                SpDescription.Name = SpDescriptionName;

                ui.AddElementInGameSelectedDescription(SpDescription, true);
                PART_SpDescription = IntegrationUI.SearchElementByName(SpDescriptionName);
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "ThemeModifier");
            }
        }
Example #23
0
        public override void AddSpDescription()
        {
            if (PART_SpDescription != null)
            {
#if DEBUG
                logger.Debug($"HowLongToBeat [Ignored] - PART_SpDescription allready insert");
#endif
                return;
            }

            try
            {
                HltbDescriptionIntegration SpDescription = new HltbDescriptionIntegration();
                SpDescription.Name = SpDescriptionName;

                ui.AddElementInGameSelectedDescription(SpDescription, PluginDatabase.PluginSettings.IntegrationTopGameDetails, PluginDatabase.PluginSettings.IntegrationShowTitle);
                PART_SpDescription = IntegrationUI.SearchElementByName(SpDescriptionName);
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "HowLongToBeat");
            }
        }
Example #24
0
        /// <summary>
        /// Resize ListBox on parent.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LbAchievements_Loaded(object sender, RoutedEventArgs e)
        {
            IntegrationUI.SetControlSize((FrameworkElement)sender);


            int RowDefinied = (int)lbAchievements.Height / 70;

            int ColDefinied = 1;

            if (!_ForceOneCol)
            {
                ColDefinied = PluginDatabase.PluginSettings.IntegrationAchievementsColCount;
            }

            double WidthDefinied = lbAchievements.ActualWidth / ColDefinied;

            this.DataContext = new
            {
                WidthDefinied = WidthDefinied,
                ColDefinied   = ColDefinied,
                RowDefinied   = RowDefinied
            };
        }
Example #25
0
        public override void AddSpDescription()
        {
            if (PART_SpDescription != null)
            {
#if DEBUG
                logger.Debug($"SuccessStory [Ignored] - PART_SpDescription allready insert");
#endif
                return;
            }

            try
            {
                ScDescriptionIntegration SpDescription = new ScDescriptionIntegration();
                SpDescription.Name = SpDescriptionName;

                ui.AddElementInGameSelectedDescription(SpDescription, PluginDatabase.PluginSettings.IntegrationTopGameDetails);
                PART_SpDescription = IntegrationUI.SearchElementByName(SpDescriptionName);

                if (PluginDatabase.PluginSettings.EnableIntegrationInDescriptionWithToggle && PART_SpDescription != null)
                {
                    if (PART_BtActionBar != null && PART_BtActionBar is ToggleButton)
                    {
                        ((ToggleButton)PART_BtActionBar).IsChecked = false;
                    }
                    else
                    {
                        logger.Warn($"SuccessStory - PART_BtActionBar is null or not ToggleButton");
                    }

                    PART_SpDescription.Visibility = Visibility.Collapsed;
                }
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "SuccessStory", "Error on AddSpDescription()");
            }
        }
Example #26
0
        private void BtRestoreConstants_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Grid gdParent = (Grid)((FrameworkElement)sender).Parent;

                string           elName    = (string)((Label)IntegrationUI.SearchElementByName("PART_ThemeConstantsLabel", gdParent)).Tag;
                string           elType    = (string)gdParent.Tag;
                FrameworkElement elControl = IntegrationUI.SearchElementByName("PART_ThemeConstantsControl", gdParent);

                dynamic elDefault = ThemeModifier.ThemeDefaultConstants.Find(x => x.Name == elName).Element;

                if (elDefault is bool)
                {
                    gdParent.Tag = "bool";
                    ((CheckBox)elControl).IsChecked = (bool)elDefault;
                    CbThemeConstants_Click(elControl, null);
                }

                if (elDefault is string)
                {
                    gdParent.Tag = "string";
                    ((TextBox)elControl).Text = (string)elDefault;
                    TbThemeConstants_KeyUp(elControl, null);
                }

                if (elDefault is double)
                {
                    gdParent.Tag = "double";
                    ((Slider)elControl).Value = (double)elDefault;
                    sThemeConstants_ValueChanged(elControl, null);
                }

                if (elDefault is int)
                {
                    gdParent.Tag = "int";
                    ((Slider)elControl).Value = (int)elDefault;
                    sThemeConstants_ValueChanged(elControl, null);
                }

                if (elDefault is Color)
                {
                    gdParent.Tag = "color";
                    ((TextBlock)elControl).Background = new SolidColorBrush((Color)elDefault);

                    tbControl    = gdParent.Children.OfType <TextBlock>().FirstOrDefault();
                    lControl     = gdParent.Children.OfType <Label>().FirstOrDefault();
                    colorDefault = (Color)elDefault;
                    PART_TM_ColorOKConstants_Click(elControl, null);
                }

                if (elDefault is SolidColorBrush)
                {
                    gdParent.Tag = "solidcolorbrush";
                    ((TextBlock)elControl).Background = (SolidColorBrush)elDefault;

                    tbControl    = gdParent.Children.OfType <TextBlock>().FirstOrDefault();
                    lControl     = gdParent.Children.OfType <Label>().FirstOrDefault();
                    colorDefault = (SolidColorBrush)elDefault;
                    PART_TM_ColorOKConstants_Click(elControl, null);
                }

                if (elDefault is LinearGradientBrush)
                {
                    gdParent.Tag = "lineargradientbrush";
                    ((TextBlock)elControl).Background = (LinearGradientBrush)elDefault;

                    tbControl    = gdParent.Children.OfType <TextBlock>().FirstOrDefault();
                    lControl     = gdParent.Children.OfType <Label>().FirstOrDefault();
                    colorDefault = (LinearGradientBrush)elDefault;
                    PART_TM_ColorOKConstants_Click(elControl, null);
                }

                if (elDefault is Visibility)
                {
                    gdParent.Tag = "visibility";

                    switch (elDefault)
                    {
                    case Visibility.Collapsed:
                        ((ComboBox)elControl).SelectedIndex = 0;
                        break;

                    case Visibility.Hidden:
                        ((ComboBox)elControl).SelectedIndex = 1;
                        break;

                    case Visibility.Visible:
                        ((ComboBox)elControl).SelectedIndex = 2;
                        break;
                    }

                    CbThemeConstants_SelectionChanged(elControl, null);
                }

                if (elDefault is VerticalAlignment)
                {
                    gdParent.Tag = "verticalalignment";

                    switch (elDefault)
                    {
                    case VerticalAlignment.Bottom:
                        ((ComboBox)elControl).SelectedIndex = 0;
                        break;

                    case VerticalAlignment.Center:
                        ((ComboBox)elControl).SelectedIndex = 1;
                        break;

                    case VerticalAlignment.Stretch:
                        ((ComboBox)elControl).SelectedIndex = 2;
                        break;

                    case VerticalAlignment.Top:
                        ((ComboBox)elControl).SelectedIndex = 2;
                        break;
                    }

                    CbThemeConstants_SelectionChanged(elControl, null);
                }

                if (elDefault is HorizontalAlignment)
                {
                    gdParent.Tag = "horizontalalignment";

                    switch (elDefault)
                    {
                    case HorizontalAlignment.Center:
                        ((ComboBox)elControl).SelectedIndex = 0;
                        break;

                    case HorizontalAlignment.Left:
                        ((ComboBox)elControl).SelectedIndex = 1;
                        break;

                    case HorizontalAlignment.Right:
                        ((ComboBox)elControl).SelectedIndex = 2;
                        break;

                    case HorizontalAlignment.Stretch:
                        ((ComboBox)elControl).SelectedIndex = 2;
                        break;
                    }

                    CbThemeConstants_SelectionChanged(elControl, null);
                }
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "ThemeModifier", "Error on BtRestoreConstants_Click()");
            }
        }
Example #27
0
        public override void AddCustomElements()
        {
            if (ListCustomElements.Count > 0)
            {
#if DEBUG
                logger.Debug($"HowLongToBeat [Ignored] - CustomElements allready insert - {ListCustomElements.Count}");
#endif
                return;
            }

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

            if (PART_HltbButtonWithJustIcon != null)
            {
                PART_HltbButtonWithJustIcon                  = new HltbButton();
                PART_HltbButtonWithJustIcon.Name             = "HltbButtonWithJustIcon";
                ((Button)PART_HltbButtonWithJustIcon).Click += OnBtActionBarClick;
                try
                {
                    ui.AddElementInCustomTheme(PART_HltbButtonWithJustIcon, "PART_HltbButtonWithJustIcon");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_HltbButtonWithJustIcon", Element = PART_HltbButtonWithJustIcon
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "HowLongToBeat", "Error on AddCustomElements()");
                }
            }
            else
            {
#if DEBUG
                logger.Debug($"HowLongToBeat [Ignored] - PART_HltbButtonWithJustIcon not find");
#endif
            }

            if (PART_hltbProgressBar != null)
            {
                PART_hltbProgressBar      = new HltbProgressBar();
                PART_hltbProgressBar.Name = "hltbProgressBar";
                try
                {
                    ui.AddElementInCustomTheme(PART_hltbProgressBar, "PART_hltbProgressBar");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_hltbProgressBar", Element = PART_hltbProgressBar
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "HowLongToBeat", "Error on AddCustomElements()");
                }
            }
            else
            {
#if DEBUG
                logger.Debug($"HowLongToBeat [Ignored] - PART_HltbButtonWithJustIcon not find");
#endif
            }
        }
        public override void AddCustomElements()
        {
            if (ListCustomElements.Count > 0)
            {
#if DEBUG
                logger.Debug($"CheckLocalizations [Ignored] - CustomElements allready insert - {ListCustomElements.Count}");
#endif
                return;
            }

            FrameworkElement PART_ClButtonWithJustIcon           = null;
            FrameworkElement PART_ClButtonWithTitle              = null;
            FrameworkElement PART_ClButtonWithTitleAndDetails    = null;
            FrameworkElement PART_ClButtonWithJustIconAndDetails = null;

            FrameworkElement PART_ClListLanguages = null;
            try
            {
                PART_ClButtonWithJustIcon           = IntegrationUI.SearchElementByName("PART_ClButtonWithJustIcon", false, true);
                PART_ClButtonWithTitle              = IntegrationUI.SearchElementByName("PART_ClButtonWithTitle", false, true);
                PART_ClButtonWithTitleAndDetails    = IntegrationUI.SearchElementByName("PART_ClButtonWithTitleAndDetails", false, true);
                PART_ClButtonWithJustIconAndDetails = IntegrationUI.SearchElementByName("PART_ClButtonWithJustIconAndDetails", false, true);

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

            if (PART_ClButtonWithJustIcon != null)
            {
                PART_ClButtonWithJustIcon = new ClButton(true);
                ((Button)PART_ClButtonWithJustIcon).Click += OnBtActionBarClick;
                try
                {
                    ui.AddElementInCustomTheme(PART_ClButtonWithJustIcon, "PART_ClButtonWithJustIcon");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_ClButtonWithJustIcon", Element = PART_ClButtonWithJustIcon
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "CheckLocalizations");
                }
            }

            if (PART_ClButtonWithTitle != null)
            {
                PART_ClButtonWithTitle = new ClButton(false);
                ((Button)PART_ClButtonWithTitle).Click += OnBtActionBarClick;
                try
                {
                    ui.AddElementInCustomTheme(PART_ClButtonWithTitle, "PART_ClButtonWithTitle");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_ClButtonWithTitle", Element = PART_ClButtonWithTitle
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "CheckLocalizations");
                }
            }

            if (PART_ClButtonWithTitleAndDetails != null)
            {
                PART_ClButtonWithTitleAndDetails = new ClButtonAdvanced(false);
                try
                {
                    ui.AddElementInCustomTheme(PART_ClButtonWithTitleAndDetails, "PART_ClButtonWithTitleAndDetails");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_ClButtonWithTitleAndDetails", Element = PART_ClButtonWithTitleAndDetails
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "CheckLocalizations");
                }
            }

            if (PART_ClButtonWithJustIconAndDetails != null)
            {
                PART_ClButtonWithJustIconAndDetails = new ClButtonAdvanced(true);
                try
                {
                    ui.AddElementInCustomTheme(PART_ClButtonWithJustIconAndDetails, "PART_ClButtonWithJustIconAndDetails");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_ClButtonWithJustIconAndDetails", Element = PART_ClButtonWithJustIconAndDetails
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "CheckLocalizations");
                }
            }

            if (PART_ClListLanguages != null)
            {
                PART_ClListLanguages = new ClListViewLanguages(true);
                try
                {
                    ui.AddElementInCustomTheme(PART_ClListLanguages, "PART_ClListLanguages");
                    ListCustomElements.Add(new CustomElement {
                        ParentElementName = "PART_ClListLanguages", Element = PART_ClListLanguages
                    });
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "CheckLocalizations");
                }
            }
        }
 private void PART_ChartTimeActivity_Loaded(object sender, RoutedEventArgs e)
 {
     IntegrationUI.SetControlSize(PART_ChartTimeActivity, PluginDatabase.PluginSettings.IntegrationShowGraphicHeight, 0);
 }
 private void PART_ScStatsView_IsLoaded(object sender, RoutedEventArgs e)
 {
     IntegrationUI.SetControlSize((FrameworkElement)sender);
 }