本文整理汇总了C#中MobileServiceCollection类的典型用法代码示例。如果您正苦于以下问题:C# MobileServiceCollection类的具体用法?C# MobileServiceCollection怎么用?C# MobileServiceCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MobileServiceCollection类属于命名空间,在下文中一共展示了MobileServiceCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainScreenMessage
public MainScreenMessage(bool isNew, TrainingItem trainingItem, MobileServiceCollection<TrainingItem, TrainingItem> items, IMobileServiceTable<TrainingItem> trainingItemsTable)
{
_isNewTraining = isNew;
_trainingItem = trainingItem;
_items = items;
_trainingItemsTable = trainingItemsTable;
}
示例2: GetMatchingEvents
// returns an ordered list of location that matches the search query
public static IEnumerable<Event> GetMatchingEvents(MobileServiceCollection<Event, Event> eventlist, string query)
{
return eventlist
.Where(c => c.Title.IndexOf(query, StringComparison.CurrentCultureIgnoreCase) > -1 ||
c.Location.IndexOf(query, StringComparison.CurrentCultureIgnoreCase) > -1 ||
c.Category.IndexOf(query, StringComparison.CurrentCultureIgnoreCase) > -1)
.OrderByDescending(c => c.Title.StartsWith(query, StringComparison.CurrentCultureIgnoreCase))
.ThenByDescending(c => c.Location.StartsWith(query, StringComparison.CurrentCultureIgnoreCase))
.ThenByDescending(c => c.Category.StartsWith(query, StringComparison.CurrentCultureIgnoreCase));
}
示例3: RefreshAsync
private async void RefreshAsync()
{
MobileServiceInvalidOperationException exception = null;
try
{
// This code refreshes the entries in the list view by querying the TodoItems table.
// The query excludes completed TodoItems
items = await SitesTable.ToCollectionAsync();
myList = new List<string>();
foreach (ToDoItem item in items)
{
myList.Add(item.Text);
}
}
catch (MobileServiceInvalidOperationException e)
{
exception = e;
}
if (exception != null)
{
}
else
{
list.ItemsSource = myList;
}
}
示例4: GetData
private async void GetData()
{
username = USERNAME.Text;
password = PASSWORD.Password;
if(username.Equals("") || password.Equals("")){
MessageBox.Show("Username or Password cannot be empty","Error",MessageBoxButton.OK);
}
else{
try
{
credentials = await credentialTable.
Where(userCredentials => userCredentials.username == username && userCredentials.password == password).
ToCollectionAsync();
}
catch(MobileServiceInvalidOperationException e)
{
MessageBox.Show(e.Message,"Database Error",MessageBoxButton.OK);
}
int count = credentials.Count();
if (count == 1)
{
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
}
}
}
示例5: MainPage_Loaded
async void MainPage_Loaded(object sender, RoutedEventArgs e)
{
Start.channel.PushNotificationReceived += channel_PushNotificationReceived;
test = new ObservableCollection<ChatPubList>();
items = await Table.OrderByDescending(ChatPublic => ChatPublic.__CreatedAt).ToCollectionAsync();
var networkProfiles = Windows.Networking.Connectivity.NetworkInformation.GetConnectionProfiles();
var adapter = networkProfiles.First<Windows.Networking.Connectivity.ConnectionProfile>().NetworkAdapter;//takes the first network adapter
string networkAdapterId = adapter.NetworkAdapterId.ToString();
foreach (ChatPublic k in items)
{
ChatPubList a = new ChatPubList();
a.date = k.__CreatedAt.Date.ToString();
a.time = k.__CreatedAt.TimeOfDay.ToString();
a.time=a.time.Remove(5);
a.date=a.date.Remove(10);
a.Name = k.Name;
a.Message = k.Message;
if (a.Name == networkAdapterId)
{
a.col = "#FF9B0E00";
}
else
{
a.col = "#FF5D340C";
}
test.Add(a);
}
lol.ItemsSource = test;
test.CollectionChanged += test_CollectionChanged;
}
示例6: RefreshTodoItems
private async void RefreshTodoItems()
{
MobileServiceInvalidOperationException exception = null;
try
{
// This code refreshes the entries in the list view by querying the TodoItems table.
// The query excludes completed TodoItems
items = await todoTable
.Where(todoItem => todoItem.Complete == false)
.ToCollectionAsync();
}
catch (MobileServiceInvalidOperationException e)
{
exception = e;
}
if (exception != null)
{
MessageBox.Show(exception.Message, "Error loading items");
}
else
{
ListItems.ItemsSource = items;
}
}
示例7: RefreshTodoItems
private async void RefreshTodoItems()
{
// TODO: Mark this method as "async" and uncomment the following block of code.
MobileServiceInvalidOperationException exception = null;
try
{
// TODO #1: uncomment the following statment
// that defines a simple query for all items.
items = await todoTable.ToCollectionAsync();
// // TODO #2: More advanced query that filters out completed items.
// items = await todoTable
// .Where(todoItem => todoItem.Complete == false)
// .ToCollectionAsync();
}
catch (MobileServiceInvalidOperationException e)
{
exception = e;
}
if (exception != null)
{
await new MessageDialog(exception.Message, "Error loading items").ShowAsync();
}
else
{
ListItems.ItemsSource = items;
this.ButtonSave.IsEnabled = true;
}
// Comment-out or delete the following lines of code.
//this.ButtonSave.IsEnabled = true;
//ListItems.ItemsSource = items;
}
示例8: RefreshTodoItems
private async void RefreshTodoItems()
{
MobileServiceInvalidOperationException exception = null;
try
{
// This code refreshes the entries in the list view by querying the TodoItems table.
// The query excludes completed TodoItems
items = await todoTable.OrderByDescending(items2=>items2.Score)
.ToCollectionAsync();
for (int i = 0; i <= items.Count-1; i++)
{
items[i].Id = i + 1;
}
}
catch (MobileServiceInvalidOperationException e)
{
exception = e;
}
if (exception != null)
{
await new MessageDialog(exception.Message, "Error loading items").ShowAsync();
}
else
{
listPoints.ItemsSource = items;
}
}
示例9: RefreshTodoItems
private async Task RefreshTodoItems()
{
MobileServiceInvalidOperationException exception = null;
try
{
// This code refreshes the entries in the list view by querying the TodoItems table.
// The query excludes completed TodoItems.
items = await todoTable
.Where(todoItem => todoItem.Complete == false)
.ToCollectionAsync();
}
catch (MobileServiceInvalidOperationException e)
{
exception = e;
}
if (exception != null)
{
await new MessageDialog(exception.Message, "Error loading items").ShowAsync();
}
else
{
ListItems.ItemsSource = items;
this.ButtonSave.IsEnabled = true;
}
}
示例10: ReadItemsTable
private async void ReadItemsTable()
{
try
{
itemsCollection = await itemsTable.ToCollectionAsync();
Content.ItemsSource = itemsCollection;
}
catch (InvalidOperationException) { }
}
示例11: LoadChartContents
private async void LoadChartContents(DateTime date)
{
MobileServiceInvalidOperationException exception = null;
string idDeshidratadora;
object selectedItem = comboBox.SelectedValue.ToString();
idDeshidratadora = selectedItem.ToString();
try
{
ProgressBarBefore();
temperaturas = await TempDeshTable
.Where(Tempe => Tempe.Fecha == date.ToString("yyyy-MM-dd") && Tempe.idDeshidratadora == idDeshidratadora)
.ToCollectionAsync();
if (temperaturas.Count >= 1)
{
foreach (var c in temperaturas)
{
string[] hora = c.Hora.Split(' ');
c.Hora = hora[1];
}
CategoryAxis categoryAxis = new CategoryAxis() { Orientation = AxisOrientation.X, Location = AxisLocation.Bottom, AxisLabelStyle = App.Current.Resources["VerticalAxisStyle"] as Style };
(LineSeries.Series[0] as LineSeries).IndependentAxis = categoryAxis;
(LineSeries.Series[0] as LineSeries).ItemsSource = temperaturas;
LineSeries.Visibility = Visibility.Visible;
ProgressBarAfter();
}
else
{
LineSeries.Visibility = Visibility.Collapsed;
MessageDialog mensaje = new MessageDialog("No existe registro para esta fecha.", "No existe registro");
await mensaje.ShowAsync();
ProgressBarAfter();
}
}
catch (MobileServiceInvalidOperationException ex)
{
exception = ex;
}
if (exception != null)
{
await new MessageDialog(exception.Message, "Error!").ShowAsync();
}
// (LineSeries.Series[0] as LineSeries).ItemsSource = financialStuffList;
}
示例12: RefreshTodoItems
private async void RefreshTodoItems()
{
try
{
items = await todoTable
.Where(todoItem => todoItem.Complete == false).ToCollectionAsync();
ListItems.ItemsSource = items;
}
catch (HttpRequestException)
{
ShowError();
}
}
示例13: GetTimeAsync
public async Task<PodcastEpisode> GetTimeAsync(int shownum)
{
try
{
//retrieve postcast based off show number
podcasts = await podcastTable.Where(p=>p.ShowNumber == shownum).ToCollectionAsync();
return podcasts.Count > 0 ? podcasts[0] : null;
}
catch (Exception ex)
{
}
return new PodcastEpisode { ShowNumber = shownum, CurrentTime = 0 };
}
示例14: RefreshTodoItems
private async void RefreshTodoItems()
{
try
{
items = await todoTable
.Where(todoItem => todoItem.Complete == false)
.ToCollectionAsync();
}
catch (MobileServiceInvalidOperationException e)
{
MessageBox.Show(e.Message, "Error loading items", MessageBoxButton.OK);
}
//ListItems.ItemsSource = items;
}
示例15: RefreshTodoItems
private async Task RefreshTodoItems() {
MobileServiceInvalidOperationException exception = null;
try {
// This code refreshes the entries in the list view by querying the TodoItems table.
// The query excludes completed TodoItems
_items = await _trainingItemsTable.ToCollectionAsync();
} catch (MobileServiceInvalidOperationException e) {
exception = e;
}
if (exception != null) {
await new MessageDialog(exception.Message, "Error loading items").ShowAsync();
} else {
fetchedTrainingsList.ItemsSource = _items;
}
}