コード例 #1
0
    public void RefreshCategorizedVisibility()
    {
        lock (GameCategories)
        {
            try
            {
                // Get the master category
                var master = GameCategories.First(x => x.IsMaster);

                // Set the master category visibility
                master.IsVisible = false;

                // Set the categories visibility
                GameCategories.Where(x => !x.IsMaster).ForEach(x => x.IsVisible = Data.UI_CategorizeGames);

                // Set the selected index
                SelectedCategoryIndex = Data.UI_CategorizeGames ? GameCategories.FindItemIndex(x => !x.IsMaster) : GameCategories.FindItemIndex(x => x == master);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Refreshing game category visibility");

                throw;
            }
        }
    }
コード例 #2
0
        /// <summary>
        /// Refreshes the visibility of the categories based on if the games should be categorized
        /// </summary>
        /// <returns>The task</returns>
        public async Task RefreshCategorizedVisibilityAsync()
        {
            using (await AsyncLock.LockAsync())
            {
                try
                {
                    // Get the master category
                    var master = GameCategories.FindItem(x => x.IsMaster);

                    // Set the master category visibility
                    master.IsVisible = false;

                    // Set the categories visibility
                    GameCategories.Where(x => !x.IsMaster).ForEach(x => x.IsVisible = Data.CategorizeGames);

                    // Set the selected index
                    SelectedCategoryIndex = Data.CategorizeGames ? GameCategories.FindItemIndex(x => !x.IsMaster) : GameCategories.FindItemIndex(x => x == master);
                }
                catch (Exception ex)
                {
                    ex.HandleError("Refreshing game category visibility");

                    throw;
                }
            }
        }