本文整理汇总了C#中ObservableCollection.Count方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableCollection.Count方法的具体用法?C# ObservableCollection.Count怎么用?C# ObservableCollection.Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObservableCollection
的用法示例。
在下文中一共展示了ObservableCollection.Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadData
private void LoadData()
{
int pageCount = 0;
string filter = "";
ObservableCollection<object> paras = new ObservableCollection<object>();
TextBox txtName = Utility.FindChildControl<TextBox>(expander, "txtName");
TextBox txtCardNumber = Utility.FindChildControl<TextBox>(expander, "txtCardNumber");
if (!string.IsNullOrEmpty(txtName.Text.Trim()))
{
filter += "[email protected]" + paras.Count().ToString();
paras.Add(txtName.Text.Trim());
}
if (!string.IsNullOrEmpty(txtCardNumber.Text.Trim()))
{
if (!string.IsNullOrEmpty(filter))
{
filter += " and ";
}
filter += "[email protected]" + paras.Count().ToString();
paras.Add(txtCardNumber.Text.Trim());
}
client.AssessmentFormMasterPagingAsync(dataPager.PageIndex, dataPager.PageSize, "NAME",
filter, paras, pageCount, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
}
示例2: LoadData
private void LoadData()
{
int pageCount = 0;
string filter = "";
ObservableCollection<string> paras = new ObservableCollection<string>();
TextBox txtName = Utility.FindChildControl<TextBox>(expander, "txtName");
TextBox txtCardNumber = Utility.FindChildControl<TextBox>(expander, "txtCardNumber");
if (txtName != null)
{
if (!string.IsNullOrEmpty(txtName.Text.Trim()))
{
//filter += "[email protected]" + paras.Count().ToString();
filter += " @" + paras.Count().ToString() + ".Contains(NAME)";
paras.Add(txtName.Text.Trim());
}
}
if (txtCardNumber != null)
{
if (!string.IsNullOrEmpty(txtCardNumber.Text.Trim()))
{
if (!string.IsNullOrEmpty(filter))
{
filter += " and ";
}
// filter += "[email protected]" + paras.Count().ToString();
filter += " @" + paras.Count().ToString() + ".Contains(IDCARDNUMBER)";
paras.Add(txtCardNumber.Text.Trim());
}
}
client.GetResumePagingAsync(dataPager.PageIndex, dataPager.PageSize, "NAME", filter, paras, pageCount);
}
示例3: pickRandomSongs
private async Task<List<StorageFile>> pickRandomSongs(ObservableCollection<StorageFile> allSongs)
{
Random random = new Random();
var songsCount = allSongs.Count();
var randomSongs = new List<StorageFile>();
while (randomSongs.Count<10)
{
var randomNum = random.Next(songsCount);
var randomSong = allSongs[randomNum];
//Find random songs BUT:
//1. Don't pick the same song twice!
//2. Don't pick a song from an album that I've already picked
MusicProperties randomSongMusicProperties = await randomSong.Properties.GetMusicPropertiesAsync();
bool isDuplicate = false;
foreach (var song in randomSongs)
{
MusicProperties songMusicProperties = await song.Properties.GetMusicPropertiesAsync();
if (String.IsNullOrEmpty(randomSongMusicProperties.Album) || randomSongMusicProperties.Album == songMusicProperties.Album)
isDuplicate = true;
}
if (!isDuplicate)
randomSongs.Add(randomSong);
}
return randomSongs;
}
示例4: GetRecurrence
public void GetRecurrence(ObservableCollection<NotificacionModel> notifs)
{
NotificationRepository _NotificationRepository = new NotificationRepository();
long fechaSystema = long.Parse(String.Format("{0:yyyy:MM:dd:HH:mm:ss:fff}", DateTime.Now).Replace(":", ""));
if (notifs.Count() !=0)
{
notifs.ToList().ForEach(p =>
{
if (this.GetFUMRecurrencia(p) <= fechaSystema)
{
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
this.GetParetWindows().GetScreenActive();
//actualizar la fecha por la del sistema
_NotificationRepository.UpdateNotificationRecurrencia(
new Model.NotificacionModel()
{
IdNotificacion = p.IdNotificacion,
Recurrencia =p.Recurrencia,
FechaUltimaMuestra = new UNID().getNewUNID()
});
}));
}
});
}
}
示例5: DajKorisnikPrograma
public KorisnikPrograma DajKorisnikPrograma()
{
try
{
LavDataClassesDataContext _baza = new LavDataClassesDataContext(konekcioniString);
if (_baza.DatabaseExists())
{
IQueryable<KorisnikPrograma> _upit = (from p in _baza.KorisnikProgramas
select p).OrderBy(w => w.KorisnikProgramaID).Take(1);
ObservableCollection<KorisnikPrograma> _lista = new ObservableCollection<KorisnikPrograma>(_upit.ToList());
if (_lista.Count().Equals(1))
{
return _lista.First();
}
else
{
return null;
}
}
else
{
throw new Exception("Baza ne postoji.");
}
}
catch (Exception ex)
{
throw ex;
}
}
示例6: CallWebApiAddReunion
public async Task<bool> CallWebApiAddReunion(Reunion reunion, ObservableCollection<Anime> selectedAnime)
{
HttpClient client = new HttpClient();
string json = JsonConvert.SerializeObject(reunion);
HttpContent content = new StringContent(json, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.PostAsync("http://scoutome.azurewebsites.net/api/reunions", content);
if (response.IsSuccessStatusCode)
{
// Pour ajouter les présences
for (int i = 0; i < selectedAnime.Count(); i++)
{
Presences pre = new Presences();
pre.codeReunion = reunion.codeReunion;
pre.useless = 1;
pre.codeAnime = selectedAnime[i].codeAnime;
string jsonPresence = JsonConvert.SerializeObject(pre);
HttpContent contentPresence = new StringContent(jsonPresence, Encoding.UTF8, "application/json");
HttpResponseMessage responsefav = await client.PostAsync("http://scoutome.azurewebsites.net/api/presences", contentPresence);
if (responsefav.IsSuccessStatusCode)
{
}
}
}
return false;
}
示例7: 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();
}
示例8: FrmWorkerCordManagement
public FrmWorkerCordManagement()
{
InitializeComponent();
Utility.DisplayGridToolBarButton(ToolBar, "T_OA_WORKRECORD", true);
ToolBar.btnNew.Click += new RoutedEventHandler(btnNew_Click);
ToolBar.btnEdit.Click += new RoutedEventHandler(btnEdit_Click);
ToolBar.btnDelete.Click += new RoutedEventHandler(btnDelete_Click);
workerCordManager.GetWorkerCordListByUserIdCompleted += new EventHandler<GetWorkerCordListByUserIdCompletedEventArgs>(workerCordManager_GetWorkerCordListByUserIdCompleted);
workerCordManager.DeleteWorkerCordListCompleted += new EventHandler<DeleteWorkerCordListCompletedEventArgs>(workerCordManager_DeleteWorkerCordListCompleted);
ToolBar.btnAudit.Visibility = Visibility.Collapsed;
ToolBar.cbxCheckState.Visibility = Visibility.Collapsed;
ToolBar.txtCheckStateName.Visibility = Visibility.Collapsed;
ToolBar.btnOutExcel.Visibility = Visibility.Visible;
//dataPager.PageSize = 23;
//dataPager.PageIndexChanged += new EventHandler<EventArgs>(dataPager_PageIndexChanged);
PARENT.Children.Add(loadbar);
ToolBar.btnOutExcel.Click += new RoutedEventHandler(btnOutExcel_Click);
ToolBar.btnRefresh.Click += new RoutedEventHandler(btnRefresh_Click);
#region 初始值设置
DateTime dpEnd = DateTime.Now.AddHours(23).AddMinutes(59);
StringBuilder sbFilter = new StringBuilder(); //查询过滤条件
dpDate.Text = DateTime.Now.AddMonths(-1).ToShortDateString();
dpEndDate.Text = DateTime.Now.ToShortDateString();
paras = new ObservableCollection<object>();
if (sbFilter.Length != 0)
{
sbFilter.Append(" and ");
}
sbFilter.Append("PLANTIME >= @" + paras.Count().ToString());
DateTime dpStart = dpEnd.AddMonths(-1);//一个月前开始
paras.Add(dpStart);
sbFilter.Append(" and ");
sbFilter.Append(" PLANTIME <= @" + paras.Count().ToString());
paras.Add(dpEnd);
filterString = sbFilter.ToString();
#endregion
ShowWorkerCordList(dataPager.PageIndex, filterString, paras);
this.Loaded += new RoutedEventHandler(FrmWorkerCordManagement_Loaded);
ToolBar.BtnView.Click += new RoutedEventHandler(BtnView_Click);
}
示例9: RefreshUserList
private void RefreshUserList()
{
_instrumentList = new ObservableCollection<Instrument>(App.WimeaApp.Instruments);
MetarGrid.ItemsSource = null;
MetarGrid.ItemsSource = _instrumentList;
tbProgress.Content = _instrumentList.Count(c => c.Sync == "F" || c.Sync == " ").ToString();
}
示例10: SearchPublishers
private void SearchPublishers()
{
if (SearchText != "") //SearchText Needs something to search
{
List<Publisher> publishers = webDataService.SearchPublishers(SearchText);
Publishers = new ObservableCollection<Publisher>(publishers);
if (Publishers.Count() > 0)
{
NotifyPropertyChanged("Publishers", Publishers[0].id);
}
}
}
示例11: FrmCalendarManagement
public FrmCalendarManagement()
{
InitializeComponent();
Utility.DisplayGridToolBarButton(ToolBar, "T_OA_CALENDAR", true);
calendarManagement.GetCalendarListByUserIDCompleted += new EventHandler<GetCalendarListByUserIDCompletedEventArgs>(calendarManagement_GetCalendarListByUserIDCompleted);
calendarManagement.DelCalendarListCompleted += new EventHandler<DelCalendarListCompletedEventArgs>(calendarManagement_DelCalendarListCompleted);
ToolBar.btnNew.Click += new RoutedEventHandler(btnNew_Click);
ToolBar.btnEdit.Click += new RoutedEventHandler(btnEdit_Click);
ToolBar.btnDelete.Click += new RoutedEventHandler(btnDelete_Click);
ToolBar.btnAudit.Visibility = Visibility.Collapsed;
ToolBar.cbxCheckState.Visibility = Visibility.Collapsed;
ToolBar.txtCheckStateName.Visibility = Visibility.Collapsed;
dataPager.PageSize = 20;
//dataPager.PageIndexChanged += new EventHandler<EventArgs>(dataPager_PageIndexChanged);
PARENT.Children.Add(loadbar);
ToolBar.btnRefresh.Click += new RoutedEventHandler(btnRefresh_Click);
#region 初始值设置
searchParas = new ObservableCollection<object>();
DateTime dpEndDate = DateTime.Now.AddHours(23).AddMinutes(59);
System.Text.StringBuilder sbFilter = new System.Text.StringBuilder(); //查询过滤条件
cndDateCanlendar.Text = DateTime.Now.AddDays(-7).ToShortDateString();//开始时间
EndDate.Text = DateTime.Now.ToShortDateString();//结束时间
DateTime dpStart = dpEndDate.AddDays(-7);//一个星期前开始 开始时间
if (sbFilter.Length != 0)
{
sbFilter.Append(" and ");
}
sbFilter.Append("PLANTIME>[email protected]" + searchParas.Count().ToString());
searchParas.Add(dpStart);
sbFilter.Append(" and ");
sbFilter.Append(" PLANTIME <[email protected]" + searchParas.Count().ToString());
searchParas.Add(dpEndDate);
filterString = sbFilter.ToString();
#endregion
GetCalendarListSelectDate(System.DateTime.Now, dataPager.PageIndex, filterString, searchParas, "CREATEDATE descending");
this.Loaded += new RoutedEventHandler(FrmCalendarManagement_Loaded);
ToolBar.BtnView.Click += new RoutedEventHandler(BtnView_Click);
}
示例12: ProjectSelector
public ProjectSelector()
{
InitializeComponent();
using (DatabaseDataContext Database = MyGlobals.Database)
{
Projects = new ObservableCollection<Project>(Database.Projects.ToList());
}
if (Projects.Count() == 0) this.Close();
cBox.ItemsSource = Projects;
cBox.SelectedItem = Projects[0];
}
示例13: MainWindow
public MainWindow()
{
InitializeComponent();
quoteChanges = new ObservableCollection<Quote>();
openStreams = new ObservableCollection<Task<Stream>>();
quotes.ItemsSource = quoteChanges;
openStreams.CollectionChanged += ((s, e) =>
{
streamCounter.Content = openStreams.Count();
});
startButton.Click += ((s, e) => Start(symbolList.Text, accessToken.Text));
}
示例14: RefreshUserList
private void RefreshUserList()
{
dates.Text = DateTime.Now.Date.ToString("yyyy-MM-dd");
_dailyList = new ObservableCollection<Daily>(App.WimeaApp.Dailys);
MetarGrid.ItemsSource = null;
MetarGrid.ItemsSource = _dailyList.Where(w => Convert.ToDateTime(w.Dates).Month == DateTime.Now.Month && Convert.ToDateTime(w.Dates).Year == DateTime.Now.Year).OrderBy(w => w.Dates);
tbProgress.Content = _dailyList.Count(c => c.Sync == "F" || c.Sync == " ").ToString();
for (int p = 1; p < 13; p++)
{
monthTxtCbx.Items.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(p));
}
yearTxtBx.Text = DateTime.Now.Year.ToString();
}
示例15: setLocations
public void setLocations(ObservableCollection<String> locations, bool isRemovable)
{
Locations.Clear();
if (locations == null) return;
for(int i = locations.Count() - 1; i >= 0; i--)
{
PopupLocationItem location = new PopupLocationItem(locations[i], LocationSelectedCommand,
LocationRemovedCommand);
location.IsRemovable = isRemovable;
Locations.Insert(0, location);
}
}