当前位置: 首页>>代码示例>>C#>>正文


C# MobileServiceCollection.Any方法代码示例

本文整理汇总了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);



        }
开发者ID:wkk91193,项目名称:rendezvous-mobile-4.0,代码行数:39,代码来源:SearchRestaurant.xaml.cs

示例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();
            }

        }
开发者ID:wkk91193,项目名称:rendezvous-mobile-4.0,代码行数:45,代码来源:loginpage.xaml.cs


注:本文中的MobileServiceCollection.Any方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。