本文整理汇总了C#中ObservableCollection.Where方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableCollection.Where方法的具体用法?C# ObservableCollection.Where怎么用?C# ObservableCollection.Where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObservableCollection
的用法示例。
在下文中一共展示了ObservableCollection.Where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RefreshUserList
private void RefreshUserList()
{
_metarList = new ObservableCollection<Metar>(App.WimeaApp.Metars);
_StationsList = new ObservableCollection<Station>(App.WimeaApp.Stations);
// List<Metar> metLists = new List<Metar>(metList.Where(c => Convert.ToDateTime(c.Days).Month.ToString() == (monthTxtCbx.SelectedIndex + 1).ToString() && Convert.ToDateTime(c.Days).Day.ToString() == dayTxtCbx.Text && Convert.ToDateTime(c.Days).Year.ToString() == yearTxtBx.Text));
for (int p = 1; p < 32; p++)
{
dayTxtCbx.Items.Add(p);
}
for (int p = 1; p < 13; p++)
{
monthTxtCbx.Items.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(p));
}
yearTxtBx.Text = DateTime.Now.Year.ToString();
stationTxtCbx.Text = Sending.currentstation;
MetarGrid.ItemsSource = null;
MetarGrid.ItemsSource = _metarList.Where(c => Convert.ToDateTime(c.Days).Month.ToString() == (DateTime.Now.Month).ToString() && Convert.ToDateTime(c.Days).Day == DateTime.Now.Day && Convert.ToDateTime(c.Days).Year == DateTime.Now.Year);
stationNumber.Content = _StationsList.Where(c => c.Name == stationTxtCbx.Text.ToString()).Select(p => p.Number).SingleOrDefault().ToString();
codeTxtBx.Text = _StationsList.Where(c => c.Name == stationTxtCbx.Text.ToString()).Select(c => c.Code).SingleOrDefault().ToString();
DatetimeTxtBx.Text = DateTime.Now.Date.Day.ToString() + DateTime.Now.Hour.ToString() + "00Z";
}
示例2: Refresh
private void Refresh()
{
_patientList = new ObservableCollection<Patient>(App.amApp.Patients);
_practitionerList = new ObservableCollection<Practitioner>(App.amApp.Practitioners);
_appointmentList = new ObservableCollection<Appointment>(App.amApp.Appointments.Where(h=>h.Patient==Id));
_queueList = new ObservableCollection<Queue>(App.amApp.Queues);
appointmentcount.Content = "Appointments:" + _appointmentList.Where(k => k.Dated == selectdate.Text).Count().ToString();
AppointmentlistView.ItemsSource = null;
_appointment = new Appointment(null);
ListQueue.Clear();
ListAppoint.Clear();
foreach (Appointment T in _appointmentList.Where(i => i.Dated == selectdate.Text))
{
_appointment = new Appointment(null);
_appointment.Id = T.Id;
_appointment.Org = T.Org;
_appointment.Details = "PATIENT : \t" + _patientList.First(x => x.Id.Equals(T.Patient)).Fname + " " + _patientList.First(x => x.Id.Equals(T.Patient)).Lname + Environment.NewLine + "PRACTITIONER : \t" + _practitionerList.First(x => x.Id.Equals(T.Practitioner)).Name + " " + Environment.NewLine + "HOURS: \t " + T.StartTime + "-END" + T.EndTime + Environment.NewLine + "REASON : \t" + T.Reason + Environment.NewLine + "Notify : \t" + T.Reminder;
_appointment.Practitioner = T.Practitioner;
_appointment.Patient = T.Patient;
_appointment.Dated = T.Dated;
_appointment.StartTime = T.StartTime;
_appointment.EndTime = T.EndTime;
_appointment.Patientimage = _patientList.First(x => x.Id.Equals(T.Patient)).Image;
_appointment.Reason = T.Reason;
ListAppoint.Add(_appointment);
}
AppointmentlistView.ItemsSource = ListAppoint;
}
示例3: SpotTilesViewModel
public SpotTilesViewModel(IReactiveTrader reactiveTrader,
Func<ICurrencyPair, SpotTileSubscriptionMode, ISpotTileViewModel> spotTileFactory,
IConcurrencyService concurrencyService,
ILoggerFactory loggerFactory)
{
_referenceDataRepository = reactiveTrader.ReferenceData;
_spotTileFactory = spotTileFactory;
_concurrencyService = concurrencyService;
_log = loggerFactory.Create(typeof (SpotTilesViewModel));
SpotTiles = new ObservableCollection<ISpotTileViewModel>();
_config = spotTileFactory(null, SpotTileSubscriptionMode.Conflate);
_config.ToConfig();
SpotTiles.Add(_config);
_subscriptions.Add(
_config.Config.ObserveProperty(p => p.SubscriptionMode)
.Subscribe(subscriptionMode => SpotTiles.Where(vm => vm.Pricing != null).ForEach(vm => vm.Pricing.SubscriptionMode = subscriptionMode)));
_subscriptions.Add(
_config.Config.ObserveProperty(p => p.ExecutionMode)
.Subscribe(executionMode => SpotTiles.Where(vm => vm.Pricing != null).ForEach(vm => vm.Pricing.ExecutionMode = executionMode)));
LoadSpotTiles();
}
示例4: JabbrService
public JabbrService()
{
Connections = new ObservableCollection<JabbrConnection> ();
Settings = Mvx.Resolve<ISettingsService> ();
Messenger = Mvx.Resolve<IMvxMessenger> ();
Settings.Accounts.CollectionChanged += (sender, e) => {
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
{
foreach (Account a in e.OldItems)
{
var cons = Connections.Where(c => c.Account.Id == a.Id);
if (cons != null)
foreach (var con in cons)
con.Client.Disconnect();
}
}
else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
{
foreach (Account a in e.NewItems)
{
if (Connections.Where(con => con.Account.Id == a.Id).Count() <= 0)
AddClient(a);
}
}
Messenger.Publish<AccountsChangedMessage>(new AccountsChangedMessage(this));
};
}
示例5: SettingsPage
public SettingsPage()
{
InitializeComponent();
_SerializationService = Template10.Services.SerializationService.SerializationService.Json; var settings = ApplicationData.Current.LocalSettings;
ObservableCollection<Jeedom.Model.Command> GeolocCmd = new ObservableCollection<Jeedom.Model.Command>();
foreach (var Equipement in RequestViewModel.Instance.EqLogicList.Where(w => w.eqType_name.Equals("geoloc")))
{
foreach (var Cmd in Equipement.GetInformationsCmds())
GeolocCmd.Add(Cmd);
}
HomePosition_Cmd.ItemsSource = GeolocCmd;
MobilePosition_Cmd.ItemsSource = GeolocCmd;
if (GeolocCmd.Count() == 0)
Location.IsEnabled = false;
else
Location.IsEnabled = true;
var GeolocObjectId = settings.Values["GeolocObjectId"];
if (GeolocObjectId != null)
{
foreach (var ObjectsSelect in GeolocCmd.Where(w => w.id.Equals(GeolocObjectId)))
{
MobilePosition_Cmd.SelectedItem = ObjectsSelect;
}
}
var HomeObjectId = settings.Values["HomeObjectId"];
if (HomeObjectId != null)
{
foreach (var ObjectsSelect in GeolocCmd.Where(w => w.id.Equals(HomeObjectId)))
{
HomePosition_Cmd.SelectedItem = ObjectsSelect;
}
}
var ObjetctPush = RequestViewModel.Instance.EqLogicList.Where(w => w.eqType_name.Equals("pushNotification"));
MobileNotification.ItemsSource = ObjetctPush;
if (ObjetctPush.Count() == 0)
notify.IsEnabled = false;
else
notify.IsEnabled = true;
var NotificationId = settings.Values["NotificationObjectId"];
if (NotificationId != null)
{
foreach (var ObjectsSelect in RequestViewModel.Instance.EqLogicList.Where(w => w.id.Equals(NotificationId)))
{
MobileNotification.SelectedItem = ObjectsSelect;
}
}
if (settings.Values["Status"] != null)
{
Status.Text = settings.Values["Status"].ToString();
}
// Extract and display location data set by the background task if not null
MobilePosition_Latitude.Text = (settings.Values["Latitude"] == null) ? "No data" : settings.Values["Latitude"].ToString();
MobilePosition_Longitude.Text = (settings.Values["Longitude"] == null) ? "No data" : settings.Values["Longitude"].ToString();
MobilePosition_Accuracy.Text = (settings.Values["Accuracy"] == null) ? "No data" : settings.Values["Accuracy"].ToString();
}
示例6: Refresh
private void Refresh()
{
_patientList = new ObservableCollection<Patient>(App.amApp.Patients);
_practitionerList = new ObservableCollection<Practitioner>(App.amApp.Practitioners);
_appointmentList = new ObservableCollection<Appointment>(App.amApp.Appointments);
_queueList = new ObservableCollection<Queue>(App.amApp.Queues);
appointmentcount.Content = "Appointments:" + _appointmentList.Where(k => k.Dated == selectdate.Text).Count().ToString();
queuecount.Content = "People in queue :" + _queueList.Where(k => Convert.ToDateTime(k.Day).Date == Convert.ToDateTime(selectdate.Text).Date).Count().ToString();
QueuelistView.ItemsSource = null;
AppointmentlistView.ItemsSource = null;
_appointment = new Appointment(null);
ListQueue.Clear();
ListAppoint.Clear();
foreach (Queue Q in _queueList.Where(m => Convert.ToDateTime(m.Day).Date == Convert.ToDateTime(selectdate.Text).Date && m.Seen=="F"))
{
_queue = new Queue(null);
_queue.Id = Q.Id;
_queue.Org = Q.Org;
_queue.Details = "PATIENT : \t" + _patientList.First(x => x.Id.Equals(Q.Patient)).Fname + " " + _patientList.First(x => x.Id.Equals(Q.Patient)).Lname + Environment.NewLine + "PRACTITIONER : \t" + _practitionerList.First(x => x.Id.Equals(Q.Practitioner)).Name + " " + Environment.NewLine + "TIME :" + Q.Checked + Environment.NewLine + "REASON: \t" + Q.Reason + " " + Environment.NewLine + "State:" + Q.Seen + " Amount paid:" + Q.Amount; ;
_queue.Practitioner = Q.Practitioner;
_queue.Patient = Q.Patient;
_queue.Patientimage = _patientList.First(x => x.Id.Equals(Q.Patient)).Image;
_queue.Payment = Q.Payment;
_queue.Amount = Q.Amount;
_queue.Checked = Convert.ToDateTime(Q.Checked).ToString("T");
_queue.Reason = Q.Reason;
ListQueue.Add(_queue);
}
//apointment list view
QueuelistView.ItemsSource = ListQueue;
foreach (Appointment T in _appointmentList.Where(i => i.Dated == selectdate.Text))
{
_appointment = new Appointment(null);
_appointment.Id = T.Id;
_appointment.Org = T.Org;
_appointment.Details = "PATIENT : \t" + _patientList.First(x => x.Id.Equals(T.Patient)).Fname + " " + _patientList.First(x => x.Id.Equals(T.Patient)).Lname + Environment.NewLine + "PRACTITIONER : \t" + _practitionerList.First(x => x.Id.Equals(T.Practitioner)).Name + " " + Environment.NewLine + "PERIOD: \t \t " + T.Meet + "-" + T.EndTime +" "+ Environment.NewLine + " REASON : \t" + T.Reason;
_appointment.Practitioner = T.Practitioner;
_appointment.Patient = T.Patient;
_appointment.Dated = T.Dated;
_appointment.StartTime = T.StartTime;
_appointment.EndTime = T.EndTime;
_appointment.Patientimage = _patientList.First(x => x.Id.Equals(T.Patient)).Image;
_appointment.Reason = T.Reason;
ListAppoint.Add(_appointment);
}
AppointmentlistView.ItemsSource = ListAppoint;
}
示例7: SetResults
public void SetResults(ObservableCollection<CompilationMessage> messages, string windowTitle)
{
Messages = messages;
WindowTitle = windowTitle;
Errors = new ObservableCollection<CompilationMessage>(Messages.Where(m => CompilationMessageHelper.IsLineError(m.Prefix)));
ErrorsHeader = string.Format("Errors ({0})", _errors.Count);
Warnings = new ObservableCollection<CompilationMessage>(Messages.Where(m => CompilationMessageHelper.IsLineWarning(m.Prefix)));
WarningsHeader = string.Format("Warnings ({0})", _warnings.Count);
RawOutput = string.Join("\r\n", Messages.Except(Errors).Except(Warnings).Select(m => m.RawLine));
}
示例8: AddSeries
static void AddSeries(PlotModel IncomePlot,
ObservableCollection<Transaction> transactions)
{
// Income
foreach (var data in transactions.Where(q => q.AccountID >= 400 &&
q.AccountID < 500))
{
SetPlotData(IncomePlot, data, OxyColors.Green, 1);
}
// Expense
foreach (var data in transactions.Where(q => q.AccountID >= 500))
{
SetPlotData(IncomePlot, data, OxyColors.IndianRed, -1);
}
}
示例9: Refresh
private void Refresh()
{
_patientList = new ObservableCollection<Patient>(App.amApp.Patients);
_groupList = new ObservableCollection<Group>(App.amApp.Groups);
foreach (Group gp in _groupList.Where(r => r.Id == Id))
{
name.Text = gp.Name;
string[] filt = gp.Filters.Split('|');
Sex = filt[0];
Age = (filt[1]);
string[] ages = Age.Split('-');
age1 = ages[0];
age2 = ages[1];
}
foreach (Patient pat in _patientList)
{
if ((Validator.IsBetween(Convert.ToInt32(pat.Age), Convert.ToInt32(age1), Convert.ToInt32(age2)) && pat.Gender == Sex))
{
ageList.Add(pat);
}
PatientListView.ItemsSource = ageList;
}
}
示例10: OnNavigatedTo
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached.
/// This parameter is typically used to configure the page.</param>
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
ObservableCollection<Dialogue> dialogues = new ObservableCollection<Dialogue>();
b = e.Parameter as Book;
try
{
dialogues = await Classic.Load(b.FileName);
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine("Error loading book: " + ex.Message);
this.Frame.GoBack();
}
txtTitle.Text = b.Name;
Dialogues.DataContext = dialogues;
//Dialogues.UpdateLayout();
string bookmark = Classic.GetBookmark(b.FileName);
if(!string.IsNullOrEmpty(bookmark))
{
Dialogue d = dialogues.Where(x => x.Line == bookmark).SingleOrDefault();
if(d != null)
Dialogues.ScrollIntoView(d);
}
}
示例11: RemoveClassCommand
public RemoveClassCommand(ObservableCollection<ShapeViewModel> _shapes, ObservableCollection<LineViewModel> _lines, ShapeViewModel _shapeToRemove)
{
shapes = _shapes;
lines = _lines;
shapeToRemove = _shapeToRemove;
linesToRemove = _lines.Where(x => _shapeToRemove.getNumber() == x.From.Number || _shapeToRemove.getNumber() == x.To.Number).ToList();
}
示例12: ContactViewModel
public ContactViewModel(BusinessCoreService businessCoreService, ConversationViewModel conversation)
{
_businessCoreService = businessCoreService;
_conversation = conversation;
IsSelected = false;
CvsStaff = new CollectionViewSource { Source = _businessCoreService.GetContacts() };
GroupDescription gp = new PropertyGroupDescription("OrganizationId");
SortDescription sp = new SortDescription("OrganizationId", ListSortDirection.Ascending);
CvsStaff.GroupDescriptions.Add(gp);
CvsStaff.SortDescriptions.Add(sp);
CvsStaff.Filter += ApplyFilter;
var treeSource = _businessCoreService.GetOrganizationTreeNoChildren();
var data = new ObservableCollection<OrganizationTreeInfoViewModel>();
foreach (var item in treeSource)
{
data.Add(new OrganizationTreeInfoViewModel(item, _businessCoreService));
}
var result = GetOrganizationTree(data.Where(x => x.Info.ParentId == null).ToList(), data);
_organizationTreeSource = new ObservableCollection<OrganizationTreeInfoViewModel>(result);
OrganizationTreeCvsStaff = new CollectionViewSource { Source = _organizationTreeSource };
Subscription.DoSelectedTree(SelectedUsersCallback);
}
示例13: CreateContent
private void CreateContent(XmlWriter xmlWriter, ObservableCollection<CloudDataInfo> datas)
{
xmlWriter.WriteStartElement(Type);
xmlWriter.WriteStartElement("Modify");
var updates = datas.Where(v =>
v.DataType == CloudInfoEnum.Update || v.DataType == CloudInfoEnum.Add);
foreach (var update in updates)
{
WriteXmlItem(xmlWriter, update);
update.DataType = CloudInfoEnum.Normal;
}
xmlWriter.WriteEndElement();
xmlWriter.WriteStartElement("Delete");
foreach (var delete in _needDeletes)
{
xmlWriter.WriteStartElement("Item");
xmlWriter.WriteAttributeString("UUID", delete.UUID);
xmlWriter.WriteEndElement();
}
_needDeletes.Clear();
xmlWriter.WriteEndElement();
xmlWriter.WriteEndElement();
}
示例14: DirectionDeviceSelectationViewModel
public DirectionDeviceSelectationViewModel()
{
Title = "Выбор устройства";
var devices = new HashSet<XDevice>();
foreach (var device in XManager.DeviceConfiguration.Devices)
{
if (device.Driver.IsControlDevice)
{
device.AllParents.ForEach(x => { devices.Add(x); });
devices.Add(device);
}
}
Devices = new ObservableCollection<DeviceViewModel>();
foreach (var device in devices)
{
var deviceViewModel = new DeviceViewModel(device, Devices);
deviceViewModel.IsExpanded = device.Driver.IsControlDevice;
Devices.Add(deviceViewModel);
}
foreach (var device in Devices.Where(x => x.Device.Parent != null))
{
var parent = Devices.FirstOrDefault(x => x.Device.UID == device.Device.Parent.UID);
device.Parent = parent;
parent.Children.Add(device);
}
SelectedDevice = Devices.FirstOrDefault(x => x.HasChildren == false);
}
示例15: LoadBooks
private async void LoadBooks()
{
try
{
books = await BookModel.GetBooksList();
if (App.IsTrial)
{
List<string> trialBooks = new List<string> { "Hamlet", "Julius Caesar", "Othello", "Romeo and Juliet" };
books = new ObservableCollection<Book>(books.Where(x => trialBooks.Contains(x.Name)).ToList());
}
}
catch (Exception)
{
books = null;
}
if (books == null)
{
MessageDialog md = new MessageDialog("Oops. Error getting the books. Please restart the app.");
var x = await md.ShowAsync();
App.Current.Exit();
}
else
{
Books.LayoutUpdated += Books_LayoutUpdated;
Books.ItemsSource = books;
//Books.UpdateLayout();
//Books.ScrollIntoView(books[CurrentBookIndex]);
}
}