• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MobileServiceCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MobileServiceCollection的典型用法代码示例。如果您正苦于以下问题:C# MobileServiceCollection类的具体用法?C# MobileServiceCollection怎么用?C# MobileServiceCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MobileServiceCollection类属于命名空间,在下文中一共展示了MobileServiceCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: MainScreenMessage

 public MainScreenMessage(bool isNew, TrainingItem trainingItem, MobileServiceCollection<TrainingItem, TrainingItem> items, IMobileServiceTable<TrainingItem> trainingItemsTable)
 {
     _isNewTraining = isNew;
     _trainingItem = trainingItem;
     _items = items;
     _trainingItemsTable = trainingItemsTable;
 }
开发者ID:fxlemire,项目名称:princeton15,代码行数:7,代码来源:MainScreenMessage.cs


示例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));
 }
开发者ID:stephendj,项目名称:evenue,代码行数:11,代码来源:EventController.cs


示例3: MobileServiceCollectionMultipleLoadItemsAsyncShouldThrow

        public async Task MobileServiceCollectionMultipleLoadItemsAsyncShouldThrow()
        {
            // Get the Books table
            MobileServiceTableQueryMock<Book> query = new MobileServiceTableQueryMock<Book>();

            MobileServiceCollection<Book, Book> collection = new MobileServiceCollection<Book, Book>(query);
            CancellationTokenSource tokenSource = new CancellationTokenSource();

            Exception ex = null;

            try
            {
                await TaskEx.WhenAll(collection.LoadMoreItemsAsync(tokenSource.Token), collection.LoadMoreItemsAsync(tokenSource.Token));
            }
            catch (InvalidOperationException e)
            {
                ex = e;
            }

            Assert.IsNotNull(ex);
        } 
开发者ID:nberardi,项目名称:azure-mobile-services,代码行数:21,代码来源:MobileServiceCollection.Test.cs


示例4: MobileServiceCollectionCanClearAndNotifies

        public void MobileServiceCollectionCanClearAndNotifies()
        {
            // Get the Books table
            MobileServiceTableQueryMock<Book> query = new MobileServiceTableQueryMock<Book>();
            query.EnumerableAsyncThrowsException = true;

            MobileServiceCollection<Book, Book> collection = new MobileServiceCollection<Book, Book>(query);

            List<string> properties = new List<string>();
            List<string> expectedProperties = new List<string>() { "Count", "Item[]" };
            List<NotifyCollectionChangedAction> actions = new List<NotifyCollectionChangedAction>();
            List<NotifyCollectionChangedAction> expectedActions = new List<NotifyCollectionChangedAction>() { NotifyCollectionChangedAction.Reset };

            Book book = new Book();
            collection.Add(book);

            ((INotifyPropertyChanged)collection).PropertyChanged += (s, e) => properties.Add(e.PropertyName);
            collection.CollectionChanged += (s, e) => actions.Add(e.Action);
            collection.Clear();

            Assert.AreEqual(0, collection.Count);
            Assert.IsTrue(properties.SequenceEqual(expectedProperties));
            Assert.IsTrue(actions.SequenceEqual(expectedActions));
        }
开发者ID:nberardi,项目名称:azure-mobile-services,代码行数:24,代码来源:MobileServiceCollection.Test.cs


示例5: 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;
			}
	}
开发者ID:jamesqquick,项目名称:Xamarin-MobileServices,代码行数:28,代码来源:ToDoList.cs


示例6: 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));
                }
            }
        }
开发者ID:rashoodkhan,项目名称:attendance-student-client,代码行数:27,代码来源:StartPage.xaml.cs


示例7: 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;

        }
开发者ID:AkshayGupta94,项目名称:MUGDApp,代码行数:33,代码来源:MainPage.xaml.cs


示例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
                    .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;
            }
        }
开发者ID:aeee98,项目名称:blogsamples,代码行数:25,代码来源:MainWindow.xaml.cs


示例9: 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;
        }
开发者ID:Zamerine,项目名称:todomicro,代码行数:34,代码来源:MainPage.cs


示例10: 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;
            }
        }
开发者ID:qweasd7485,项目名称:rfid-final-project,代码行数:31,代码来源:RankPage.xaml.cs


示例11: 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;
            }
        }
开发者ID:TomMurphyDev,项目名称:WeAreLive-,代码行数:26,代码来源:MainPage.cs


示例12: ReadItemsTable

 private async void ReadItemsTable()
 {
     try
     {
         itemsCollection = await itemsTable.ToCollectionAsync();
         Content.ItemsSource = itemsCollection;
     }
     catch (InvalidOperationException) { }
 }
开发者ID:violabazanye,项目名称:ListViewapp,代码行数:9,代码来源:MainPage.xaml.cs


示例13: 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;




        }
开发者ID:carlosmhw,项目名称:Centauro,代码行数:57,代码来源:TemperaturaDeshidratadora.xaml.cs


示例14: RefreshTodoItems

 private async void RefreshTodoItems()
 {
     try
     {
         items = await todoTable
            .Where(todoItem => todoItem.Complete == false).ToCollectionAsync();
         ListItems.ItemsSource = items;
     }
     catch (HttpRequestException)
     {
         ShowError();
     }
 }
开发者ID:oldnewthing,项目名称:old-Windows8-samples,代码行数:13,代码来源:MainPage.xaml.cs


示例15: 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 };
    }
开发者ID:rampyodm,项目名称:XamarinDNR,代码行数:14,代码来源:AzureWebService.cs


示例16: 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;
        }
开发者ID:radu-ungureanu,项目名称:DisasterHelp,代码行数:15,代码来源:MainPage.xaml.cs


示例17: 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;
			}
		}
开发者ID:fxlemire,项目名称:princeton15,代码行数:16,代码来源:MainPage.xaml.cs


示例18: RefreshTodoItems

        private async void RefreshTodoItems()
        {
            // This code refreshes the entries in the list view be querying the TodoItems table.
            // The query excludes completed TodoItems
            try
            {
                items = await Common.GetIncompleteItems()                    
                    .ToCollectionAsync();
            }
            catch (MobileServiceInvalidOperationException e)
            {
                MessageBox.Show(e.Message, "Error loading items", MessageBoxButton.OK);
            }

            ListItems.ItemsSource = items;
        }
开发者ID:qroosje,项目名称:mobile-services-xamarin-pcl,代码行数:16,代码来源:MainPage.xaml.cs


示例19: button_Click

        private async void button_Click(object sender, RoutedEventArgs e)
        {
            
            

            try
            {
                ProgressBarBefore();
                usuarios = await UsuarioTable
                    .Select(Usuarios => Usuarios)
                    .Where(Usuarios => Usuarios.id == textBoxUser.Text && Usuarios.contrasena == passwordBox.Password.ToString())
                    .ToCollectionAsync();
                ProgressBarAfter();                
                if(usuarios.Count >= 1)
                {
                    var rsUsuario = usuarios.First();
                    
                    if(rsUsuario.Tipo == "Tecnico")
                    {
                        Frame.Navigate(typeof(Administrador), "Tecnico");
                    }
                    else
                    {
                        Frame.Navigate(typeof(Administrador), "Administrador");
                    }
                }
                else
                {
                    MessageDialog mensaje = new MessageDialog("Usuario o contraseña incorrectos.", "Credenciales invalidas");
                    await mensaje.ShowAsync();
                }



            }
            catch (MobileServiceInvalidOperationException ex)
            {
                exception = ex;
            }

            if (exception != null)
            {
                await new MessageDialog(exception.Message, "Error!").ShowAsync();
            }


        }
开发者ID:carlosmhw,项目名称:Centauro,代码行数:47,代码来源:MainPage.xaml.cs


示例20: MainPage_Loaded

        async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {

            //PushNotificationChannel channel;
            //channel = await Windows.Networking.PushNotifications.PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
            //try
            //{
            //    await App.Mugd_appClient.GetPush().RegisterNativeAsync(channel.Uri);
            //    //await App.Mugd_appClient.InvokeApiAsync("notifyAllUsers",
            //    //    new JObject(new JProperty("toast", "Sample Toast")));
            //}
            //catch (Exception exception)
            //{
            //    HandleRegisterException(exception);
            //}
            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;
            

        }
开发者ID:medhasharma,项目名称:MUGDApp,代码行数:47,代码来源:MainPage.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Mock类代码示例发布时间:2022-05-24
下一篇:
C# MobileServiceClient类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap