当前位置: 首页>>代码示例>>C#>>正文


C# Model.containsId方法代码示例

本文整理汇总了C#中System.ComponentModel.Model.containsId方法的典型用法代码示例。如果您正苦于以下问题:C# Model.containsId方法的具体用法?C# Model.containsId怎么用?C# Model.containsId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ComponentModel.Model的用法示例。


在下文中一共展示了Model.containsId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: updateArchiveList

        protected void updateArchiveList()
        {
            int selected_count = Games.SelectedItems.Count;

            TranslationHelpers.translate(BackupSelectedGames, "BackupGames", selected_count.ToString());

            if (selected_count > 0) {
                BackupSelectedGames.IsEnabled = true;
                PurgeButton.IsEnabled = true;
                if (selected_count == 1) {
                    CustomBackup.IsEnabled = true;
                } else {
                    CustomBackup.IsEnabled = false;
                }
            } else {
                PurgeButton.IsEnabled = false;
                CustomBackup.IsEnabled = false;
                BackupSelectedGames.IsEnabled = false;
                RestoreSelected.IsEnabled = false;
                deleteGame.IsEnabled = false;
            }

            Model<ArchiveID, Archive> archives = new Model<ArchiveID, Archive>();
            deleteGame.IsEnabled = Games.OnlyCustomGamesSelected;
            archives.AddRange(Games.SelectedGamesArchives);

            if (ArchiveList.DataContext != null) {
                lock (ArchiveList.DataContext) {
                    foreach (Archive archive in (Model<ArchiveID, Archive>)ArchiveList.DataContext) {
                        if (!archives.containsId(archive.id))
                            archive.IsSelected = false;
                    }
                }
            }

            ArchiveList.DataContext = archives;
            ArchiveList.Model = archives;

            if (archives.Count > 0) {
                ArchiveColumn.MinWidth = 300;
                ArchiveColumn.Width = new GridLength(2, GridUnitType.Star);
                ArchiveGrid.Visibility = System.Windows.Visibility.Visible;
                SelectGameLabel.Visibility = System.Windows.Visibility.Collapsed;
                TranslationHelpers.translate(ArchiveCount, "NumberOfArchives", archives.Count.ToString(), gamesLst.SelectedItems.Count.ToString());
            } else {
                ArchiveColumn.MinWidth = 0;
                ArchiveColumn.Width = new GridLength(0, GridUnitType.Pixel);
                ArchiveGrid.Visibility = System.Windows.Visibility.Collapsed;
                SelectGameLabel.Visibility = System.Windows.Visibility.Visible;
            }

            ListSplitter.Visibility = ArchiveGrid.Visibility;
            updateRestoreButton();
        }
开发者ID:raven-ie,项目名称:MASGAU,代码行数:54,代码来源:MainWindowGameList.cs

示例2: updateArchiveList

        protected void updateArchiveList()
        {
            int selected_count = gamesLst.SelectedItems.Count;
            TranslationHelpers.translate(BackupSelectedGames, "BackupGames", selected_count.ToString());

            if (selected_count > 0) {
                BackupSelectedGames.IsEnabled = true;
                PurgeButton.IsEnabled = true;
                if (selected_count == 1) {
                    CustomBackup.IsEnabled = true;
                } else {
                    CustomBackup.IsEnabled = false;
                }
            } else {
                PurgeButton.IsEnabled = false;
                CustomBackup.IsEnabled = false;
                BackupSelectedGames.IsEnabled = false;
                RestoreSelected.IsEnabled = false;
                deleteGame.IsEnabled = false;
                return;
            }

            Model<ArchiveID, Archive> archives = new Model<ArchiveID, Archive>();
            deleteGame.IsEnabled = true;
            foreach (GameEntry game in gamesLst.SelectedItems) {
                if (game is CustomGameEntry) {
                    CustomGame custom = game.Game as CustomGame;
                }  else
                    deleteGame.IsEnabled = false;
                archives.AddRange(game.Archives);
            }
            if (ArchiveList.DataContext != null) {
                foreach (Archive archive in (Model<ArchiveID, Archive>)ArchiveList.DataContext) {
                    if (!archives.containsId(archive.id))
                        archive.IsSelected = false;
                }
            }
            ArchiveList.DataContext = archives;
            ArchiveList.ItemsSource = archives;
            if (archives.Count > 0) {
                ArchiveGrid.Visibility = System.Windows.Visibility.Visible;
                TranslationHelpers.translate(ArchiveCount, "NumberOfArchives", archives.Count.ToString(), gamesLst.SelectedItems.Count.ToString());
            } else {
                ArchiveGrid.Visibility = System.Windows.Visibility.Collapsed;
            }
        }
开发者ID:Korn1699,项目名称:MASGAU,代码行数:46,代码来源:MainWindowGameList.cs


注:本文中的System.ComponentModel.Model.containsId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。