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


C# BindableCollection.FirstOrDefault方法代码示例

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


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

示例1: ChooseServerDialogViewModel

 public ChooseServerDialogViewModel(BindableCollection<ServerItemModel> servers)
 {
     this.servers = servers;
     this.DisplayName = "Choose default server:";
     this.SelectedServer = servers.FirstOrDefault(x => x.IsChecked);
     if (this.SelectedServer == null)
     {
         this.SelectedServer = servers.FirstOrDefault();
     }
 }
开发者ID:dEMonaRE,项目名称:HearthstoneTracker,代码行数:10,代码来源:ChooseServerDialogViewModel.cs

示例2: DatabaseModel

		public DatabaseModel(string name, DocumentStore documentStore)
		{
			this.name = name;
			this.documentStore = documentStore;

			Tasks = new BindableCollection<TaskModel>(x => x.Name)
			{
				new ImportTask(),
				new ExportTask(),
				new StartBackupTask(),
				new IndexingTask(),
				new SampleDataTask()
			};

			SelectedTask = new Observable<TaskModel> { Value = Tasks.FirstOrDefault() };
			Statistics = new Observable<DatabaseStatistics>();
			Status = new Observable<string>
			{
				Value = "Offline"
			};

			asyncDatabaseCommands = name.Equals(Constants.SystemDatabase, StringComparison.OrdinalIgnoreCase)
											? documentStore.AsyncDatabaseCommands.ForDefaultDatabase()
											: documentStore.AsyncDatabaseCommands.ForDatabase(name);

		    DocumentChanges.Select(c => Unit.Default).Merge(IndexChanges.Select(c => Unit.Default))
		        .SampleResponsive(TimeSpan.FromSeconds(2))
		        .Subscribe(_ => RefreshStatistics(), exception => ApplicationModel.Current.Server.Value.IsConnected.Value = false);

			RefreshStatistics();
		}
开发者ID:arelee,项目名称:ravendb,代码行数:31,代码来源:DatabaseModel.cs

示例3: EndoscopyViewModel

        public EndoscopyViewModel(IEventAggregator events, int sessionId)
        {
            DisplayName = "Nội soi";
            if (App.Current != null)
            {
                _esClinicContext = App.Current.EsClinicContext;
            }
            _events = events;
            _sessionId = sessionId;
          
            Photos = new BindableCollection<TmpPhoto>();

            IsEnabledScopy = true;
            NotifyOfPropertyChange(() => IsEnabledScopy);

            EsTypes = new BindableCollection<EndoscopyType>();
            var esTypes = _esClinicContext.EndoscopyTypes.ToList();
            
            foreach (var esType in esTypes)
            {
                EsTypes.Add(esType);
            }

            Cameras = new BindableCollection<Camera>();
            foreach (var camera in CameraService.AvailableCameras)
            {
                Cameras.Add(camera);
            }

            _selectedCamera = Cameras.FirstOrDefault();
        }
开发者ID:narukunegu,项目名称:ESClinic,代码行数:31,代码来源:EndoscopyViewModel.cs

示例4: GenericPropertiesViewModel

        public GenericPropertiesViewModel(LayerEditorViewModel editorVm) : base(editorVm)
        {
            LayerAnimations = new BindableCollection<ILayerAnimation>(editorVm.LayerAnimations);
            OpacityProperties = new LayerDynamicPropertiesViewModel("Opacity", editorVm);

            SelectedLayerAnimation =
                LayerAnimations.FirstOrDefault(l => l.Name == editorVm.ProposedLayer.LayerAnimation?.Name) ??
                LayerAnimations.First(l => l.Name == "None");
        }
开发者ID:SpoinkyNL,项目名称:Artemis,代码行数:9,代码来源:GenericPropertiesViewModel.cs

示例5: DatabaseModel

		public DatabaseModel(string name, IAsyncDatabaseCommands asyncDatabaseCommands)
		{
			Name = name;
			this.asyncDatabaseCommands = asyncDatabaseCommands;

			Tasks = new BindableCollection<TaskModel>(x => x.Name)
			{
				new ImportTask(asyncDatabaseCommands),
				new ExportTask(asyncDatabaseCommands)
			};
			SelectedTask = new Observable<TaskModel> {Value = Tasks.FirstOrDefault()};
			Statistics = new Observable<DatabaseStatistics>();
		}
开发者ID:maurodx,项目名称:ravendb,代码行数:13,代码来源:DatabaseModel.cs

示例6: DatabaseModel

		public DatabaseModel(string name, DocumentStore documentStore)
		{
			this.name = name;

			Tasks = new BindableCollection<TaskModel>(x => x.Name)
			{
				new ImportTask(),
				new ExportTask(),
				new StartBackupTask(),
			};
			SelectedTask = new Observable<TaskModel> {Value = Tasks.FirstOrDefault()};
			Statistics = new Observable<DatabaseStatistics>();

			asyncDatabaseCommands = name.Equals(DefaultDatabaseName, StringComparison.OrdinalIgnoreCase)
			                             	? documentStore.AsyncDatabaseCommands.ForDefaultDatabase()
			                             	: documentStore.AsyncDatabaseCommands.ForDatabase(name);
		}
开发者ID:neiz,项目名称:ravendb,代码行数:17,代码来源:DatabaseModel.cs

示例7: DatabaseModel

		public DatabaseModel(string name, DocumentStore documentStore)
		{
			this.name = name;
			this.documentStore = documentStore;

			Tasks = new BindableCollection<TaskModel>(x => x.Name)
			{
				new ImportTask(),
				new ExportTask(),
				new StartBackupTask(),
				new IndexingTask(),
				new SampleDataTask(),
                new CsvImportTask()
			};

			if (name == null || name == Constants.SystemDatabase)
				Tasks.Insert(3, new StartRestoreTask());

			SelectedTask = new Observable<TaskModel> { Value = Tasks.FirstOrDefault() };
			Statistics = new Observable<DatabaseStatistics>();
			Status = new Observable<string>
			{
				Value = "Offline"
			};
			OnPropertyChanged(() => StatusImage);

			asyncDatabaseCommands = name.Equals(Constants.SystemDatabase, StringComparison.OrdinalIgnoreCase)
			                             	? documentStore.AsyncDatabaseCommands.ForDefaultDatabase()
			                             	: documentStore.AsyncDatabaseCommands.ForDatabase(name);

		    DocumentChanges.Select(c => Unit.Default).Merge(IndexChanges.Select(c => Unit.Default))
		        .SampleResponsive(TimeSpan.FromSeconds(2))
		        .Subscribe(_ => RefreshStatistics());

			databaseChanges.ConnectionStatusChanged += (sender, args) =>
			{
				ApplicationModel.Current.Server.Value.SetConnected(((IDatabaseChanges)sender).Connected);
				UpdateStatus();
			};

			RefreshStatistics();
		}
开发者ID:karlgrz,项目名称:ravendb,代码行数:42,代码来源:DatabaseModel.cs

示例8: AfterUpdate

		private void AfterUpdate(NameAndCount[] collectionDocumentsCount)
		{
            // update documents count

		    var nameToCount = collectionDocumentsCount.OrderByDescending(count => count.Count).ToDictionary(i => i.Name, i => i.Count);
		    var collections = Collections.OrderByDescending(model => model.Count).ToList();
            Collections = new BindableCollection<CollectionModel>(model => model.Name);
		    foreach (var collectionModel in collections)
		    {
		        Collections.Add(collectionModel);
		    }
		    
		    foreach (var collectionModel in Collections)
		    {
		        collectionModel.Count = nameToCount[collectionModel.Name];
		    }

			if (initialSelectedDatabaseName != null &&
				(SelectedCollection.Value == null || SelectedCollection.Value.Name != initialSelectedDatabaseName || Collections.Contains(SelectedCollection.Value) == false))
			{
				SelectedCollection.Value = Collections.FirstOrDefault(x => x.Name == initialSelectedDatabaseName);
			}

			if (SelectedCollection.Value == null)
				SelectedCollection.Value = Collections.FirstOrDefault();

            OnPropertyChanged(() => Collections);
		}
开发者ID:arelee,项目名称:ravendb,代码行数:28,代码来源:CollectionsModel.cs

示例9: SetupControls

        private void SetupControls()
        {
            var dataModelProps = _layerEditorViewModel.DataModelProps;
            Name = _property + ":";

            // Populate target combobox
            Targets = new BindableCollection<GeneralHelpers.PropertyCollection>
            {
                new GeneralHelpers.PropertyCollection {Display = "None"}
            };
            Targets.AddRange(dataModelProps.Where(p => (p.Type == "Int32") || (p.Type == "Single")));

            // Populate sources combobox
            Sources = new BindableCollection<GeneralHelpers.PropertyCollection>();
            Sources.AddRange(dataModelProps.Where(p => (p.Type == "Int32") || (p.Type == "Single")));

            // Preselect according to the model
            SelectedTarget = dataModelProps.FirstOrDefault(p => p.Path == Proposed.GameProperty);
            SelectedSource = dataModelProps.FirstOrDefault(p => p.Path == Proposed.PercentageProperty);
            LayerPropertyType = Proposed.LayerPropertyType;

            // Populate the extra options combobox
            switch (_property)
            {
                case "Width":
                    LayerPropertyOptions = new BindableCollection<LayerPropertyOptions>
                    {
                        Artemis.Profiles.Layers.Models.LayerPropertyOptions.LeftToRight,
                        Artemis.Profiles.Layers.Models.LayerPropertyOptions.RightToLeft
                    };
                    break;
                case "Height":
                    LayerPropertyOptions = new BindableCollection<LayerPropertyOptions>
                    {
                        Artemis.Profiles.Layers.Models.LayerPropertyOptions.Downwards,
                        Artemis.Profiles.Layers.Models.LayerPropertyOptions.Upwards
                    };
                    break;
                case "Opacity":
                    LayerPropertyOptions = new BindableCollection<LayerPropertyOptions>
                    {
                        Artemis.Profiles.Layers.Models.LayerPropertyOptions.Increase,
                        Artemis.Profiles.Layers.Models.LayerPropertyOptions.Decrease
                    };
                    break;
            }

            UserSourceIsVisible = LayerPropertyType == LayerPropertyType.PercentageOf;
            SourcesIsVisible = LayerPropertyType == LayerPropertyType.PercentageOfProperty;

            // Set up a default for SelectedTarget if it was null
            if (SelectedTarget.Display == null)
                SelectedTarget = Targets.FirstOrDefault();
            // Set up a default for the extra option if it fell outside the range
            if (!LayerPropertyOptions.Contains(Proposed.LayerPropertyOptions))
                Proposed.LayerPropertyOptions = LayerPropertyOptions.FirstOrDefault();
        }
开发者ID:SpoinkyNL,项目名称:Artemis,代码行数:57,代码来源:LayerDynamicPropertiesViewModel.cs

示例10: RefreshDevices

 public void RefreshDevices()
 {
     VideoDevices = new BindableCollection<string>(DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice).Select((device) => device.Name));
     InputName = VideoDevices.FirstOrDefault();
 }
开发者ID:vladimirdjurdjevic,项目名称:soft,代码行数:5,代码来源:LiveStreamInputViewModel.cs


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