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