本文整理汇总了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);
}
示例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());
}
示例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());
}
示例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();
}
}
示例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;
}
示例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");
}
示例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();
}
示例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();
}