本文整理汇总了C#中MobileServiceCollection.Any方法的典型用法代码示例。如果您正苦于以下问题:C# MobileServiceCollection.Any方法的具体用法?C# MobileServiceCollection.Any怎么用?C# MobileServiceCollection.Any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MobileServiceCollection
的用法示例。
在下文中一共展示了MobileServiceCollection.Any方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: searchbtnclicked
private async void searchbtnclicked(object sender, RoutedEventArgs e)
{
String location = ((ComboBoxItem)locationcomboBox.SelectedItem).Content.ToString();
String category = ((ComboBoxItem)categorycomboBox.SelectedItem).Content.ToString();
var parameters = new Dictionary<String, String> { {"Location",location}, { "Category",category} };
// parameters.Add("Location",location);
// parameters.Add("Category",category);
try
{
restaurants = await restaurantTable.WithParameters(parameters).ToCollectionAsync();
}
catch (MobileServiceInvalidOperationException ex)
{
await new MessageDialog(ex.Message, "Could not connect to server.").ShowAsync();
}
Boolean containsvalue = restaurants.Any<Restaurant>();
if (!containsvalue)
{
await new MessageDialog("No restaurants matching!").ShowAsync();
}
ListItems.ItemsSource = restaurants;
// Restaurant res1 = restaurants.First<Restaurant>();
// Restaurant res2 = restaurants.Last<Restaurant>();
// System.Diagnostics.Debug.WriteLine("first element returned:" + res1.Name);
// System.Diagnostics.Debug.WriteLine("last element returned:" + res2.Name);
}
示例2: button_Click
private async void button_Click(object sender, RoutedEventArgs e)
{
String userName = userNameText.Text;
String password = passwordBox.Password;
try
{
guests = await guestTable.Where(guests => guests.name == userName && guests.password == password).ToCollectionAsync();
}
catch (MobileServiceInvalidOperationException ex)
{
await new MessageDialog(ex.Message, "Could not connect to server.").ShowAsync();
System.Diagnostics.Debug.WriteLine("This is user name and password :" + guests.Any<Guest>());
}
if (guests.Any<Guest>() == true)
{
var localuserSettings = ApplicationData.Current.LocalSettings;
localuserSettings.Values["username"] = userName;
this.Frame.Navigate(typeof(Home), null);
var channel = await Windows.Networking.PushNotifications.PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
string deviceId = GetDeviceId();
string uri = channel.Uri;
System.Diagnostics.Debug.WriteLine("uri is :" + uri);
try
{
await App.azure_rendezvous_mobile_service_3Client.GetPush().RegisterNativeAsync(channel.Uri);
await App.azure_rendezvous_mobile_service_3Client.InvokeApiAsync("modifychanneluri", new JObject(new JProperty("channeluri", uri), new JProperty("username", userName)));
}
catch (MobileServiceInvalidOperationException ex)
{
System.Diagnostics.Debug.WriteLine("exception is :" + ex.Message);
}
}
else
{
MessageDialog msgBox = new MessageDialog("Invalid username or password");
await msgBox.ShowAsync();
}
}