public SuccessStory(IPlayniteAPI api) : base(api)
        {
            settings = new SuccessStorySettings(this);

            // Old database
            oldToNew = new OldToNew(this.GetPluginUserDataPath());

            // Loading plugin database
            PluginDatabase = new SuccessStoryDatabase(this, PlayniteApi, settings, this.GetPluginUserDataPath());
            PluginDatabase.InitializeDatabase();

            // Get plugin's location
            pluginFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            // Add plugin localization in application ressource.
            PluginLocalization.SetPluginLanguage(pluginFolder, api.ApplicationSettings.Language);
            // Add common in application ressource.
            Common.Load(pluginFolder);
            Common.SetEvent(PlayniteApi);

            // Check version
            if (settings.EnableCheckVersion)
            {
                CheckVersion cv = new CheckVersion();
                cv.Check("SuccessStory", pluginFolder, api);
            }

            // Init ui interagration
            successStoryUI = new SuccessStoryUI(this, api, this.GetPluginUserDataPath());

            // Custom theme button
            if (settings.EnableIntegrationInCustomTheme)
            {
                EventManager.RegisterClassHandler(typeof(Button), Button.ClickEvent, new RoutedEventHandler(successStoryUI.OnCustomThemeButtonClick));
            }

            // Add Event for WindowBase for get the "WindowSettings".
            EventManager.RegisterClassHandler(typeof(Window), Window.LoadedEvent, new RoutedEventHandler(WindowBase_LoadedEvent));

            // Add event fullScreen
            if (api.ApplicationInfo.Mode == ApplicationMode.Fullscreen)
            {
                EventManager.RegisterClassHandler(typeof(Button), Button.ClickEvent, new RoutedEventHandler(BtFullScreen_ClickEvent));
            }
        }
        // To add new game menu items override GetGameMenuItems
        public override List <GameMenuItem> GetGameMenuItems(GetGameMenuItemsArgs args)
        {
            Game             GameMenu          = args.Games.First();
            string           SourceName        = PlayniteTools.GetSourceName(PlayniteApi, GameMenu);
            bool             IsAddOrShowManual = SuccessStoryDatabase.IsAddOrShowManual(GameMenu, SourceName);
            GameAchievements gameAchievements  = PluginDatabase.Get(GameMenu, true);

            List <GameMenuItem> gameMenuItems = new List <GameMenuItem>();

            if (!settings.EnableOneGameView || (settings.EnableOneGameView && gameAchievements.HasData))
            {
                // Show list achievements for the selected game
                gameMenuItems.Add(new GameMenuItem
                {
                    MenuSection = resources.GetString("LOCSuccessStory"),
                    Description = resources.GetString("LOCSuccessStoryViewGame"),
                    Action      = (gameMenuItem) =>
                    {
                        dynamic ViewExtension     = null;
                        PluginDatabase.IsViewOpen = true;
                        if (PluginDatabase.PluginSettings.EnableOneGameView)
                        {
                            ViewExtension = new SuccessStoryOneGameView(GameMenu);
                        }
                        else
                        {
                            ViewExtension = new SuccessView(this, PlayniteApi, this.GetPluginUserDataPath(), false, GameMenu);
                        }
                        Window windowExtension = PlayniteUiHelper.CreateExtensionWindow(PlayniteApi, resources.GetString("LOCSuccessStory"), ViewExtension);
                        windowExtension.ShowDialog();
                        PluginDatabase.IsViewOpen = false;
                    }
                });
            }

            if (!IsAddOrShowManual)
            {
                gameMenuItems.Add(new GameMenuItem
                {
                    MenuSection = resources.GetString("LOCSuccessStory"),
                    Description = resources.GetString("LOCCommonRefreshGameData"),
                    Action      = (gameMenuItem) =>
                    {
                        if (settings.EnableIntegrationInCustomTheme || settings.EnableIntegrationInDescription)
                        {
                            PlayniteUiHelper.ResetToggle();
                        }

                        var TaskIntegrationUI = Task.Run(() =>
                        {
                            PluginDatabase.Remove(GameMenu);
                            var dispatcherOp        = successStoryUI.AddElements();
                            dispatcherOp.Completed += (s, e) => { successStoryUI.RefreshElements(GameMenu); };
                        });
                    }
                });
            }

            if (settings.EnableManual && IsAddOrShowManual)
            {
                if (!gameAchievements.HasData)
                {
                    gameMenuItems.Add(new GameMenuItem
                    {
                        MenuSection = resources.GetString("LOCSuccessStory"),
                        Description = resources.GetString("LOCAddTitle"),
                        Action      = (mainMenuItem) =>
                        {
                            var TaskIntegrationUI = Task.Run(() =>
                            {
                                PluginDatabase.Remove(GameMenu);
                                PluginDatabase.GetManual(GameMenu);

                                var dispatcherOp        = successStoryUI.AddElements();
                                dispatcherOp.Completed += (s, e) => { successStoryUI.RefreshElements(GameMenu); };
                            });
                        }
                    });
                }
                else
                {
                    gameMenuItems.Add(new GameMenuItem
                    {
                        MenuSection = resources.GetString("LOCSuccessStory"),
                        Description = resources.GetString("LOCEditGame"),
                        Action      = (mainMenuItem) =>
                        {
                            var ViewExtension      = new SuccessStoryEditManual(GameMenu);
                            Window windowExtension = PlayniteUiHelper.CreateExtensionWindow(PlayniteApi, resources.GetString("LOCSuccessStory"), ViewExtension);
                            windowExtension.ShowDialog();
                        }
                    });

                    gameMenuItems.Add(new GameMenuItem
                    {
                        MenuSection = resources.GetString("LOCSuccessStory"),
                        Description = resources.GetString("LOCRemoveTitle"),
                        Action      = (gameMenuItem) =>
                        {
                            if (settings.EnableIntegrationInCustomTheme || settings.EnableIntegrationInDescription)
                            {
                                PlayniteUiHelper.ResetToggle();
                            }

                            var TaskIntegrationUI = Task.Run(() =>
                            {
                                PluginDatabase.Remove(GameMenu);
                                var dispatcherOp        = successStoryUI.AddElements();
                                dispatcherOp.Completed += (s, e) => { successStoryUI.RefreshElements(GameMenu); };
                            });
                        }
                    });
                }
            }

#if DEBUG
            gameMenuItems.Add(new GameMenuItem
            {
                MenuSection = resources.GetString("LOCSuccessStory"),
                Description = "Test",
                Action      = (mainMenuItem) => { }
            });
#endif
            return(gameMenuItems);
        }