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


C# ObservableCollection.Select方法代码示例

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


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

示例1: InitializeParamValues

        private void InitializeParamValues(Y_NORM_NORMATIVE_CELL cellDataContext)
        {
            _parameterValues = new ObservableCollection<Y_NORM_MANAGEMENT_GET_PARAMETER_VALUES_Result>();
            if (cellDataContext.ID_PARAM == 0) return;
            _parameterValues = GenericRepository.GetValues((Int32) cellDataContext.ID_PARAM, cellDataContext.PARAM_VALUE);

            lblParamValues.Content = string.Join(",", _parameterValues.Select(y => y.NAME));
            _ttValue.Content = string.Join(",", _parameterValues.Select(y => y.NAME));
        }
开发者ID:AntonLapshin,项目名称:hcprojects,代码行数:9,代码来源:CellControl.xaml.cs

示例2: mapView1_Loaded

        async void mapView1_Loaded(object sender, RoutedEventArgs e)
        {
            //iterate over all layers
            var taskResults = new List<Task<AllLayersServiceInfo>>();
            foreach (var layer in mapView1.Map.Layers)
            {
                if (layer is ArcGISDynamicMapServiceLayer)
                    taskResults.Add((layer as ArcGISDynamicMapServiceLayer).GetAllDetailsAsync());

                else if (layer is ArcGISTiledMapServiceLayer)
                    taskResults.Add((layer as ArcGISTiledMapServiceLayer).GetAllDetailsAsync());

            }

            var allLayers = await Task.WhenAll(taskResults);

            //show single node for tiledLayers



            //show sub-layer list for Dynamic Layers
            dynamicServiceLayer = mapView1.Map.Layers["DynamicLayerCalifornia"] as ArcGISDynamicMapServiceLayer;
            if (dynamicServiceLayer != null)
            {

                await dynamicServiceLayer.InitializeAsync();
                var dyn = dynamicServiceLayer.CreateDynamicLayerInfosFromLayerInfos();
                dynamicServiceLayer.VisibleLayers = GetDefaultVisibleLayers(dyn);

                DataContext = this;
                Layers = new ObservableCollection<DynamicLayerInfo>(dyn);

                var test = Layers.Select(x => new { Name = x.Name, Visibility = x.DefaultVisibility, Id = x.ID }).ToList();
            }
        }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:35,代码来源:SubLayerList.xaml.cs

示例3: GenerateSecond

        public List<int> GenerateSecond(ObservableCollection<Model> observableCollection)
        {
            HashSet<int> hashSet = new HashSet<int>();

            observableCollection
                .Select(x => x.NUMBER)
                .ToList()
                .ForEach(x => hashSet.Add(x));

            ObservableCollection<int> list = new ObservableCollection<int>();
            using (BCRandomStream randomStream = new BCRandomStream(100))
            {
                //for (int i = 0; i < observableCollection.Count; i++)
                //{
                    var num = randomStream.Read();
                    if (hashSet.Contains(num))
                        hashSet.Add(num);

                    List<int> lista=  Enumerable.Range(0,observableCollection.Count)
                        .Select(i => randomStream.Read())
                        .Where(x => hashSet.Contains(x)).ToList();
            //    }

            return lista;
            }
        }
开发者ID:tomekaq,项目名称:WpfRandomValue,代码行数:26,代码来源:DataAccess.cs

示例4: On_Synchronize_Destination_Has_Corresponding_Items_From_Source

        public void On_Synchronize_Destination_Has_Corresponding_Items_From_Source()
        {
            var source = new ObservableCollection<string>{"1","2","3","4","5"};
            var destination = new ObservableCollection<int>();

            source.SynchronizeWith(destination);
            destination.Should().ContainInOrder(source.Select(int.Parse));
        }
开发者ID:DamianReeves,项目名称:Smore,代码行数:8,代码来源:CollectionSynchronizerTests.cs

示例5: Fetch

        public static void Fetch(ObservableCollection<Quote> quotes)
        {
            string symbolList = String.Join("%2C", quotes.Select(w => "%22" + w.Symbol + "%22").ToArray());
            string url = string.Format(BASE_URL,symbolList);

            XDocument doc = XDocument.Load(url);
            Parse(quotes,doc);
        }
开发者ID:hananbs,项目名称:Stocks,代码行数:8,代码来源:YahooStockEngine.cs

示例6: Init

 private void Init()
 {
     ctx = new BookShopEntities();
     ctx.Books.Load();
     localBooks = ctx.Books.Local;
     cbCountries.DataContext = localBooks.Select(n => n.country).Distinct();
     cbCountries.Visibility = Visibility.Visible;
     view = CollectionViewSource.GetDefaultView(localBooks);
 }
开发者ID:Crowmoore,项目名称:IIO11300,代码行数:9,代码来源:MainWindow.xaml.cs

示例7: Source_Gets_Destination_Additions

        public void Source_Gets_Destination_Additions()
        {
            var source = new ObservableCollection<string>();
            var destination = new ObservableCollection<int>();

            source.SynchronizeWith(destination);
            destination.Add(100);
            destination.Add(200);
            source.Should().Contain(destination.Select(x=>x.ToString(CultureInfo.InvariantCulture)));
        }
开发者ID:DamianReeves,项目名称:Smore,代码行数:10,代码来源:CollectionSynchronizerTests.cs

示例8: Destination_Gets_Source_Additions

        public void Destination_Gets_Source_Additions()
        {
            var source = new ObservableCollection<string> { "1", "2", "3", "4", "5" };
            var destination = new ObservableCollection<int>();

            source.SynchronizeWith(destination);
            source.Add("6");
            source.Add("7");
            destination.Should().ContainInOrder(source.Select(int.Parse));
        }
开发者ID:DamianReeves,项目名称:Smore,代码行数:10,代码来源:CollectionSynchronizerTests.cs

示例9: IniMyStuff

 private void IniMyStuff() {
     //tänne kaikki tarvittava alustukset
     ctx = new BookShopEntities();
     ctx.Books.Load();
     localBooks = ctx.Books.Local;
     cbCountries.DataContext = localBooks.Select(n => n.country).Distinct();
     cbCountries.Visibility = Visibility.Visible;
     //view kirjojen filtterointia varte
     view = CollectionViewSource.GetDefaultView(localBooks);
 }
开发者ID:Saukonoja,项目名称:IIO11300,代码行数:10,代码来源:MainWindow.xaml.cs

示例10: OnEdit

		void OnEdit()
		{
			var procedureLayoutsSelectionViewModel = new ProcedureLayoutsSelectionViewModel(ProcedureLayoutCollection);
			if (DialogService.ShowModalWindow(procedureLayoutsSelectionViewModel))
			{
				Layouts = new ObservableCollection<LayoutViewModel>(procedureLayoutsSelectionViewModel.LayoutItems.Where(x => x.IsChecked).Select(x => new LayoutViewModel(x.Layout)));
				ProcedureLayoutCollection.Clear();
				ProcedureLayoutCollection.AddRange(Layouts.Select(x => x.Layout.UID));
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:10,代码来源:ProcedureLayoutCollectionViewModel.cs

示例11: WriteEntries

 public bool WriteEntries(ObservableCollection<TimeEntry> entries)
 {
     CheckDirectory();
     var theFile = GetFileName();
     if (File.Exists(theFile)) File.Delete(theFile);    
     var serializer = new JavaScriptSerializer();
     var strings = entries.Select(serializer.Serialize).ToList();
     File.WriteAllLines(theFile, strings);
     return true;
 }
开发者ID:osumoogle,项目名称:MicroManager,代码行数:10,代码来源:FileHelper.cs

示例12: RefreshUserList

        private void RefreshUserList()
        {


            _StationsList = new ObservableCollection<Station>(App.WimeaApp.Stations);
            stationTxtCbx.ItemsSource = null;
            stationTxtCbx.ItemsSource = _StationsList.Select(c => c.Name);
            yearTxtBx.Text = DateTime.Now.Year.ToString();

        }
开发者ID:WereDouglas,项目名称:wimea,代码行数:10,代码来源:RainReport.xaml.cs

示例13: AddTillViewModel

        public AddTillViewModel(ObservableCollection<TillDivisionModel> tillDivisions)
        {
            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _adminDataUnit = dataUnitLocator.ResolveDataUnit<IAdminDataUnit>();

            TillDivisions = new ObservableCollection<TillDivision>(tillDivisions.Select(tillDivision => tillDivision.TillDivision));
            OkCommand = new RelayCommand(OkCommandExecuted, OkCommandCanExecute);

            AddTill();
        }
开发者ID:syatin003,项目名称:Wpf,代码行数:10,代码来源:AddTillViewModel.cs

示例14: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            ctx = new BookShopEntities();
            ctx.Books.Load();
            localBooks = ctx.Books.Local;
            cbCountries.DataContext = localBooks.Select(n => n.country).Distinct();
            view = CollectionViewSource.GetDefaultView(localBooks);
        }
开发者ID:TeemuTT,项目名称:IIO11300,代码行数:10,代码来源:MainWindow.xaml.cs

示例15: OnImagesChanged

		private static void OnImagesChanged(BindableObject bindable, ObservableCollection<IImageViewModel> oldvalue, ObservableCollection<IImageViewModel> newvalue)
		{
			var control = (MultiImageControl)bindable;

			control.disconnectEvents();
			control._images = new ObservedCollection<IImageViewModel>(newvalue);
			control.clear();
			if (newvalue != null)
				control.ImageControls.InsertRange(0, newvalue.Select(t => control.create(t)));
			control.connectEvents();
		}
开发者ID:fadafido,项目名称:tojeero,代码行数:11,代码来源:MultiImageControl.xaml.cs


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