本文整理汇总了C#中System.Collections.ObjectModel.ObservableCollection.Where方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.ObjectModel.ObservableCollection.Where方法的具体用法?C# System.Collections.ObjectModel.ObservableCollection.Where怎么用?C# System.Collections.ObjectModel.ObservableCollection.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ObjectModel.ObservableCollection
的用法示例。
在下文中一共展示了System.Collections.ObjectModel.ObservableCollection.Where方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: client_GetDepartmentDictionaryAllCompleted
void client_GetDepartmentDictionaryAllCompleted(object sender, GetDepartmentDictionaryAllCompletedEventArgs e)
{
if (Department.T_HR_COMPANY != null || Department != null)
{
//判断状态是否为修改
T_HR_COMPANY ent = Department.T_HR_COMPANY;
tempList = e.Result;
var entity = tempList.Where(s => s.DEPARTMENTTYPE == "-1" || s.DEPARTMENTTYPE == ent.COMPANYTYPE);
entity = entity.Count() > 0 ? entity.ToList() : null;
List<SMT.Saas.Tools.PermissionWS.T_SYS_DICTIONARY> dicts = Application.Current.Resources["SYS_DICTIONARY"] as List<SMT.Saas.Tools.PermissionWS.T_SYS_DICTIONARY>;
dicts = dicts.Where(s => s.DICTIONCATEGORY == "COMPANYTYPE").OrderBy(s => s.DICTIONARYVALUE).ToList();
foreach (T_HR_DEPARTMENTDICTIONARY diction in entity)
{
decimal dptype = Convert.ToDecimal(diction.DEPARTMENTTYPE);
var tmp = dicts.Where(s => s.DICTIONARYVALUE == dptype).FirstOrDefault();
if (tmp != null)
{
diction.OWNERPOSTID = diction.DEPARTMENTNAME;//暂存部门名称
diction.DEPARTMENTNAME = diction.DEPARTMENTNAME + "(" + tmp.DICTIONARYNAME + ")";
}
}
//cbxDepartMent.ItemsSource = entity;
//cbxDepartMent.DisplayMemberPath = "DEPARTMENTNAME";
acbDepName.ItemsSource = entity;
acbDepName.ValueMemberPath = "DEPARTMENTNAME";
string deptName = string.Empty;
if (Department.T_HR_DEPARTMENTDICTIONARY != null)
{
foreach (var item in acbDepName.ItemsSource)
{
T_HR_DEPARTMENTDICTIONARY dict = item as T_HR_DEPARTMENTDICTIONARY;
if (dict != null)
{
if (dict.DEPARTMENTDICTIONARYID == Department.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTDICTIONARYID)
{
//cbxDepartMent.SelectedItem = item;
acbDepName.SelectedItem = item;
deptName = dict.DEPARTMENTNAME;
break;
}
}
}
}
acbDepName.IsEnabled = true;
//acbDepName.ToggleButton.IsEnabled = false;
//acbDepName.TxtLookUp.IsReadOnly = true;
ToolTipService.SetToolTip(this.acbDepName.TxtLookUp, deptName);
}
}
示例2: OnNavigatedTo
// 使用者巡覽至這個頁面時執行。
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
db = new slSecure.Web.SecureDBContext();
var q = from n in db.GetTblEngineRoomConfigQuery() select n;
var res=await db.LoadAsync<slSecure.Web.tblEngineRoomConfig>(q );
roomInfos = (from n in res
select new ControlRoomInfo()
{
ERID=n.ERID,
Type = "C",
AlarmStatus = 0,
Name = n.ERName,
X = n.GPSX,
Y = n.GPSY
}).ToArray();
foreach (ControlRoomInfo info in roomInfos)
{
mapctl.AddControllRoomPin(info);
}
//var q1 = from n in db.GetTblERPlaneQuery() select n;
//var res1= await db.LoadAsync<tblERPlane>(q1);
//planeInfos = (from n in res1
// select new PlaneInfo()
// {
// ERID=n.ERID,
// AlarmStatus=0,
// Name=n.PlaneName,
// PlaneID=n.PlaneID,
// Type="EP"
// }).ToArray();
client = new MyClient("CustomBinding_ISecureService", false);
client.SecureService.GetAllPlaneInfoCompleted += (s, a) =>
{
if (a.Error != null)
return;
lstMenu.ItemsSource = PlaneDegreeInfos=a.Result;
if (roomInfos != null)
foreach (ControlRoomInfo info in roomInfos)
{
try
{
info.AlarmStatus = PlaneDegreeInfos.Where(n => n.ERID == info.ERID).Max(n => n.AlarmStatus);
}
catch { ;}
}
};
if (!IsExit)
{
client.SecureService.GetAllPlaneInfoAsync();
tmr.Interval = TimeSpan.FromSeconds(10);
tmr.Tick += tmr_Tick;
tmr.Start();
}
// client.OnItemValueChangedEvent += client_OnItemValueChangedEvent;
}