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


C# ObservableCollection.First方法代码示例

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


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

示例1: PackageDatabaseTreeViewModel

        public PackageDatabaseTreeViewModel(CompositionContainer container, IEventAggregator eventAggregator, IPackageRepository repository)
        {
            this._eventAggregator = eventAggregator;
            this._rootNodes = new ObservableCollection<PackageTreeNodeViewModel>();
            this._container = container;
            this._contextMenuStyleSelector = new ContextMenuItemStyleSelector();
            this._repository = repository;

            this._eventAggregator.GetEvent<CompositePresentationEvent<PackageDatabaseOpenedEvent>>()
                .Subscribe(PackageDatabaseOpened, ThreadOption.UIThread, true);

            eventAggregator.GetEvent<CompositePresentationEvent<PackageCreatedEvent>>().Subscribe(
             x =>
             {
                 _rootNodes.First().AddChild(new PackageNodeViewModel(x.NewPackage, this, container, _repository));
             }, ThreadOption.UIThread, true);

            eventAggregator.GetEvent<CompositePresentationEvent<AssetCreatedEvent>>().Subscribe(
             x =>
             {
                 var packageNode = _rootNodes.First().Children.Where(node => ((Package)node.Model).Id == x.NewAsset.PackageId).Single();
                 packageNode.AddChild(new AssetNodeViewModel(x.NewAsset, this, container));
             }, ThreadOption.UIThread, true);

            eventAggregator.GetEvent<CompositePresentationEvent<PackageDeletedEvent>>().Subscribe(
             x =>
             {
                 var packageNode = _rootNodes.First().Children.Where(node => ((Package)node.Model).Id == x.PackageId).Single();
                 _rootNodes.First().RemoveChild(packageNode);
             }, ThreadOption.UIThread, true);
        }
开发者ID:HaKDMoDz,项目名称:Zazumo,代码行数:31,代码来源:PackageDatabaseTreeViewModel.cs

示例2: InitializeConfig

 public override void InitializeConfig() {
     lstTextFileTypes.ItemsSource = TextFileTypes = new ObservableCollection<FileTypeEntry>(
             WorkingConfig.tips.TextExt.Select(ext => new FileTypeEntry(this, ext)));
     lstMediaFileTypes.ItemsSource = MediaFileTypes = new ObservableCollection<FileTypeEntry>(
             WorkingConfig.tips.ImageExt.Select(ext => new FileTypeEntry(this, ext)));
     lstTextFileTypes.ScrollIntoView(TextFileTypes.First());
     lstMediaFileTypes.ScrollIntoView(MediaFileTypes.First());
 }
开发者ID:Nicologies,项目名称:QTTabBar,代码行数:8,代码来源:Options04_Tooltips.xaml.cs

示例3: btnResetTextFileTypes_Click

 private void btnResetTextFileTypes_Click(object sender, RoutedEventArgs e) {
     lstTextFileTypes.ItemsSource = TextFileTypes = new ObservableCollection<FileTypeEntry>(
             new Config._Tips().TextExt.Select(ext => new FileTypeEntry(this, ext)));
     lstTextFileTypes.ScrollIntoView(TextFileTypes.First());
 }
开发者ID:Nicologies,项目名称:QTTabBar,代码行数:5,代码来源:Options04_Tooltips.xaml.cs

示例4: Init

 public void Init()
 {
     _Window.cbStation.SelectionChanged += new SelectionChangedEventHandler(cbStation_SelectionChanged);
     StationDA _staDA = new StationDA();
     StationORList = _staDA.selectAllStation();
     if (StationORList != null && StationORList.Count> 0)
     {
         SelectStationOR = StationORList.First();
     }
 }
开发者ID:Jitlee,项目名称:WPFMonitor,代码行数:10,代码来源:AlarmPolicyManagementListViewModel.cs

示例5: CreateCategoryButtons

        private ObservableCollection<ScreenCategoryButton> CreateCategoryButtons(ScreenMenu screenMenu)
        {
            if (screenMenu != null)
            {
                if (MenuItems != null) MenuItems.Clear();

                _currentScreenMenu = screenMenu;
                var result = new ObservableCollection<ScreenCategoryButton>();

                foreach (var category in screenMenu.Categories.OrderBy(x => x.Order).Where(x => !x.MostUsedItemsCategory))
                {
                    var sButton = new ScreenCategoryButton(category, CategoryCommand);
                    result.Add(sButton);
                }

                if (result.Count > 0)
                {
                    var c = result.First();
                    if (_selectedCategory != null)
                        c = result.SingleOrDefault(x => x.Category.Name.ToLower() == _selectedCategory.Name.ToLower());
                    if (c == null && result.Count > 0) c = result.ElementAt(0);
                    if (c != null) OnCategoryCommandExecute(c.Category);
                }

                return result;
            }

            if (MenuItems != null) MenuItems.Clear();
            if (Categories != null) Categories.Clear();
            _currentScreenMenu = null;

            return Categories;
        }
开发者ID:hpbaotho,项目名称:sambapos,代码行数:33,代码来源:MenuItemSelectorViewModel.cs

示例6: LoadTracks

        private async Task LoadTracks(CancellationToken token)
        {
            if (SelectedAlbum == null)
                return;

            IsWorking = true;
            OnTaskStarted("audio");

            try
            {
                var response = await DataService.GetUserTracks(0, 0, SelectedAlbum.Id != 0 ? SelectedAlbum.Id : 0);
                if (response.Items != null && response.Items.Count > 0)
                {
                    if (token.IsCancellationRequested)
                    {
                        Debug.WriteLine("Tracks load cancelled");
                        return;
                    }

                    Tracks = new ObservableCollection<Audio>(response.Items);

                    if (AudioService.CurrentAudio == null)
                    {
                        AudioService.SetCurrentPlaylist(Tracks.ToList());
                        AudioService.CurrentAudio = Tracks.First();
                        AudioService.CurrentAudio.IsPlaying = true;
                    }
                }
                else
                {
                    OnTaskError("audio", ErrorResources.LoadAudiosErrorEmpty);
                    Tracks = null;
                }
            }
            catch (Exception ex)
            {
                LoggingService.Log(ex);

                OnTaskError("audio", ErrorResources.LoadAudiosErrorCommon);
            }

            IsWorking = false;
            OnTaskFinished("audio");
        }
开发者ID:kostyatab,项目名称:meridian,代码行数:44,代码来源:MusicViewModel.cs

示例7: LoadKeyTypesList

 private void LoadKeyTypesList()
 {
     keyTypes = new ObservableCollection<string>();
     keyTypes.Add(MergedResources.Common_All);
     keyTypes.Add(KeyType.Standard.ToString());
     keyTypes.Add(KeyType.MBR.ToString());
     keyTypes.Add(KeyType.MAT.ToString());
     selectedKeyType = keyTypes.First();
 }
开发者ID:barbarossia,项目名称:DIS,代码行数:9,代码来源:KeyManagementViewModel.cs

示例8: LoadKeyRetuernState

 private void LoadKeyRetuernState()
 {
     ReturnStates = new ObservableCollection<string>();
     ReturnStates.Add(ResourcesOfR6.Common_AllReturnedKeys);
     ReturnStates.Add(ResourcesOfR6.Common_ReturnedWithCredit);
     ReturnStates.Add(ResourcesOfR6.Common_ReturnedWithNoCredit);
     SelectReturnState = ReturnStates.First();
 }
开发者ID:barbarossia,项目名称:DIS,代码行数:8,代码来源:KeyManagementViewModel.cs


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