本文整理汇总了C#中System.Collections.ObservableCollection.Any方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableCollection.Any方法的具体用法?C# ObservableCollection.Any怎么用?C# ObservableCollection.Any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ObservableCollection
的用法示例。
在下文中一共展示了ObservableCollection.Any方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadAsync
private void LoadAsync(string txiFile)
{
var doc = XDocument.Load(txiFile);
var shiftCount = doc.Element("Schichten").Descendants().Count();
int verarb = 0;
Schichten = new ObservableCollection<Schicht>();
// Parallel.ForEach(doc.Element("Schichten").Elements("Schicht"), ig =>
foreach (var ig in doc.Element("Schichten").Elements("Schicht"))
{
var i = ig;
var schicht = new Schicht()
{
Index = i.AttValue<int>("Index"),
AbrechnungFertig = i.AttValue<bool>("AbrechnungFertig"),
Abgerechnet = i.AttValue<bool>("IstAbgerechnet"),
Anfang = i.AttValue<DateTime>("Anfang"),
Ende = i.AttValue<DateTime>("Ende"),
GeldVorher = i.AttValue<float>("GeldVorher"),
GeldNachher = i.AttValue<float>("GeldNachher"),
GeliehenesWechselgeld = i.AttValue<float>("GeliehenesWechselgeld")
};
foreach (var j in i.Elements("Sonderausgabe"))
{
schicht.Sonderausgaben.Add(j.AttValue<float>("Wert"));
}
foreach (var j in i.Elements("Privatausgabe"))
{
var priv = new Privatausgabe { Index = j.AttValue<int>("Index"), Bemerkung = j.AttValue<string>("Bemerkung") ?? "n/a", Wert = j.AttValue<double>("Wert") };
schicht.Privatausgaben.Add(priv);
}
foreach (var n in i.Elements("Fahrzeug"))
{
var fzg = new Fahrzeug
{
Index = n.AttValue<int>("Index"),
Nummer = n.AttValue<int>("Nummer"),
TotalAnfang = n.AttValue<Single>("TotalAnfang"),
TotalEnde = n.AttValue<Single>("TotalEnde"),
BesetztAnfang = n.AttValue<Single>("BesetztAnfang"),
BesetztEnde = n.AttValue<Single>("BesetztEnde"),
TourenAnfang = n.AttValue<int>("TourenAnfang"),
TourenEnde = n.AttValue<int>("TourenEnde"),
PreisAnfang = n.AttValue<Single>("EinnahmenAnfang"),
PreisEnde = n.AttValue<Single>("EinnahmenEnde"),
};
schicht.Fahrzeuge.Add(fzg);
foreach (var p in n.Elements("Fahrt"))
{
var _kmV = p.Attribute("km").Value;
var _km = (int?)p.AttValue<int>("km");
var _apesV = p.Attribute("APES").Value;
var _apes = (float?)p.AttValue<Single>("APES");
var _priceV = p.Attribute("Preis").Value;
var _price = (float?)p.AttValue<Single>("Preis");
var ft = new Fahrt
{
Index = p.AttValue<int>("Index"),
Description = p.AttValue<string>("Bemerkung"),
KM = (_kmV == "NULL") ? null : _km,
APES = (_apesV == "NULL") ? null : _apes,
Preis = (_priceV == "NULL") ? null : _price,
Rechnungsfahrt = p.AttValue<bool>("IstRechnungsfahrt")
};
this.OnProgress(ref verarb, shiftCount);
fzg.Fahrten.Add(ft);
}
this.OnProgress(ref verarb, shiftCount);
}
UIDispatcher.Invoke(new Action(() => this.Schichten.Add(schicht)));
this.OnProgress(ref verarb, shiftCount);
}
int uoSIdx = 1;
foreach (var item in Schichten.OrderBy(p => p.Anfang))
{
if (item.Index == 0)
{
while (Schichten.Any(p => p.Index != 0 && p.Index == uoSIdx)) uoSIdx++;
item.Index = uoSIdx;
item.Parent = this;
}
item.ReindexVehicles();
}
}
示例2: UpdateSuggestionList
void UpdateSuggestionList(ListBox suggestionlist,string filter)
{
//suggestionlist.Items.Filter = p =>
//{
// var path = p as ItemViewModel;
// return filter != null && (path != null && (path.Name.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase) &&
// !(String.Equals(path.Name, filter, StringComparison.CurrentCultureIgnoreCase))));
//};
var newFilteredList = new ObservableCollection<ItemViewModel>();
foreach (var itemViewModel in SuggestionList)
{
if (_matchingItemEnumerator == null || !_matchingItemEnumerator.MoveNext())
VerifyMatchingPeopleEnumerator(filter, (ItemViewModel) itemViewModel);
while (_matchingItemEnumerator != null && _matchingItemEnumerator.MoveNext())
{
if (Items == null || Items.Cast<ItemViewModel>().All(item => item.Id != _matchingItemEnumerator.Current.Id))
newFilteredList.Add(_matchingItemEnumerator.Current);
}
}
FilteredSuggestionList = newFilteredList;
//If no items hide the suggestion
if (!newFilteredList.Any())
IsSuggestionOpen = false;
else
suggestionlist.SelectedIndex = 0;
}
开发者ID:minasabb,项目名称:MultipleItemSelectorCustomControl,代码行数:28,代码来源:MultipleItemSelectorAutoComplete.cs