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


C# MobileServiceClient.GetSyncTable方法代码示例

本文整理汇总了C#中Microsoft.WindowsAzure.MobileServices.MobileServiceClient.GetSyncTable方法的典型用法代码示例。如果您正苦于以下问题:C# MobileServiceClient.GetSyncTable方法的具体用法?C# MobileServiceClient.GetSyncTable怎么用?C# MobileServiceClient.GetSyncTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.WindowsAzure.MobileServices.MobileServiceClient的用法示例。


在下文中一共展示了MobileServiceClient.GetSyncTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ServicesRepository

		public ServicesRepository()
		{
			_mobileService = new MobileServiceClient("YOUR URL HERE", "YOUR APP SECRET HERE");
			_categoryTable = _mobileService.GetSyncTable<Category>();
			_serviceTypeTable = _mobileService.GetSyncTable<ServiceType>();
			_productTable = _mobileService.GetSyncTable<Product>();
			_productInfoTable = _mobileService.GetSyncTable<ProductInformation>();
			InitLocalStore();
		}
开发者ID:ivpadim,项目名称:AzurePocketGuide,代码行数:9,代码来源:ServicesRepository.cs

示例2: Initialize

        public async Task Initialize()
        {
            if (isInitialized)
                return;

            var time = Xamarin.Insights.TrackTime("InitializeTime");
            time.Start();
            

            var handler = new AuthHandler();
            //Create our client
            MobileService = new MobileServiceClient("https://mycoffeeapp.azurewebsites.net", handler);
            handler.Client = MobileService;

            if (!string.IsNullOrWhiteSpace (Settings.AuthToken) && !string.IsNullOrWhiteSpace (Settings.UserId)) {
                MobileService.CurrentUser = new MobileServiceUser (Settings.UserId);
                MobileService.CurrentUser.MobileServiceAuthenticationToken = Settings.AuthToken;
            }
            
            const string path = "syncstore.db";
            //setup our local sqlite store and intialize our table
            var store = new MobileServiceSQLiteStore(path);

            store.DefineTable<CupOfCoffee>();

            await MobileService.SyncContext.InitializeAsync(store, new MobileServiceSyncHandler());

            //Get our sync table that will call out to azure
            coffeeTable = MobileService.GetSyncTable<CupOfCoffee>();

            isInitialized = true;
            time.Stop();
        }
开发者ID:RCWade,项目名称:app-coffeecups,代码行数:33,代码来源:AzureService.cs

示例3: OnCreate

        protected override async void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Activity_To_Do);

            CurrentPlatform.Init ();

            // Create the Mobile Service Client instance, using the provided
            // Mobile Service URL and key
            client = new MobileServiceClient (applicationURL, applicationKey);
            await InitLocalStoreAsync();

            // Get the Mobile Service sync table instance to use
            toDoTable = client.GetSyncTable <ToDoItem> ();

            textNewToDo = FindViewById<EditText> (Resource.Id.textNewToDo);

            // Create an adapter to bind the items with the view
            adapter = new ToDoItemAdapter (this, Resource.Layout.Row_List_To_Do);
            var listViewToDo = FindViewById<ListView> (Resource.Id.listViewToDo);
            listViewToDo.Adapter = adapter;

            // Load the items from the Mobile Service
            OnRefreshItemsSelected ();
        }
开发者ID:ploegert,项目名称:ganshani,代码行数:27,代码来源:ToDoActivity.cs

示例4: Initialize

        public async Task Initialize()
        {
            if (isInitialized)
                return;

            var time = Xamarin.Insights.TrackTime("InitializeTime");
            time.Start();
            
            //Create our client
            MobileService = new MobileServiceClient("https://mycoffeeapp.azurewebsites.net");

            const string path = "syncstore.db";
            //setup our local sqlite store and intialize our table
            var store = new MobileServiceSQLiteStore(path);

            store.DefineTable<CupOfCoffee>();

            await MobileService.SyncContext.InitializeAsync(store, new MobileServiceSyncHandler());

            //Get our sync table that will call out to azure
            coffeeTable = MobileService.GetSyncTable<CupOfCoffee>();

            isInitialized = true;
            time.Stop();
        }
开发者ID:jv9,项目名称:app-coffeecups,代码行数:25,代码来源:AzureService.cs

示例5: TodoItemManager

		/// <summary>
		/// Initializes a new instance of the <see cref="ToDo.TodoItemManager"/> class.
		/// </summary>
		public TodoItemManager ()
		{
			// Create the service client and make sure to use the native network stack via ModernHttpClient's NativeMessageHandler.
			this.client = new MobileServiceClient (Constants.ApplicationURL, Constants.GatewayURL, new CustomMessageHandler ());

			// This is where we want to store our local data.
			this.store = new MobileServiceSQLiteStore (((App)App.Current).databaseFolderAndName);

			// Create the tables.
			this.store.DefineTable<TodoItem> ();

			// Initializes the SyncContext using a specific IMobileServiceSyncHandler which handles sync errors.
			this.client.SyncContext.InitializeAsync (store, new SyncHandler ());

			// The ToDo items should be synced.
			this.todoTable = client.GetSyncTable<TodoItem> ();

			// Uncomment to clear all local data to have a fresh start. Then comment out again.
			//this.todoTable.PurgeAsync();


			// Create a Sqlite-Net connection to the SAME DB that is also used for syncing.
			// Everything that gets inserted via this connection will not be synced.
			// Azure Mobile always syncs everything, so we have to either use an alternative database or use  another API to acces the same DB.
			this.sqliteNetConn = new SQLiteAsyncConnection (((App)App.Current).databaseFolderAndName);
			this.sqliteNetConn.CreateTableAsync<ConfigItem> ();
		}
开发者ID:Krumelur,项目名称:AzureSyncDemo,代码行数:30,代码来源:TodoItemManager.cs

示例6: OnCreate

        protected override async void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Activity_To_Do);

            CurrentPlatform.Init ();

            // Create the Mobile Service Client instance, using the provided
            // Mobile Service URL
            client = new MobileServiceClient(applicationURL);
            await InitLocalStoreAsync();

            // Set the current instance of TodoActivity.
            instance = this;

            // Make sure the GCM client is set up correctly.
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);

            // Get the Mobile Service sync table instance to use
            toDoTable = client.GetSyncTable <ToDoItem> ();

            textNewToDo = FindViewById<EditText> (Resource.Id.textNewToDo);

            // Create an adapter to bind the items with the view
            adapter = new ToDoItemAdapter (this, Resource.Layout.Row_List_To_Do);
            var listViewToDo = FindViewById<ListView> (Resource.Id.listViewToDo);
            listViewToDo.Adapter = adapter;

            //// Load the items from the Mobile App backend.
            //OnRefreshItemsSelected ();
        }
开发者ID:ggailey777,项目名称:app-service-mobile-xamarin-android-quickstart-old,代码行数:34,代码来源:ToDoActivity.cs

示例7: OnCreate

        protected override async void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Activity_To_Do);

            progressBar = FindViewById<ProgressBar> (Resource.Id.loadingProgressBar);

            // Initialize the progress bar
            progressBar.Visibility = ViewStates.Gone;

            // Create ProgressFilter to handle busy state
            var progressHandler = new ProgressHandler ();
            progressHandler.BusyStateChange += (busy) => {
                if (progressBar != null) 
                    progressBar.Visibility = busy ? ViewStates.Visible : ViewStates.Gone;
            };

            try {
                CurrentPlatform.Init ();
                // Create the Mobile Service Client instance, using the provided
                // Mobile Service URL and key
                client = new MobileServiceClient (
                    applicationURL,
                    applicationKey, progressHandler);

                string path = 
                    Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "localstore.db");
                
                if (!File.Exists(path))
                {
                    File.Create(path).Dispose();
                }
                var store = new MobileServiceSQLiteStore(path);
                store.DefineTable<ToDoItem>();
                await client.SyncContext.InitializeAsync(store, new SyncHandler(this));

                // Get the Mobile Service Table instance to use
                toDoTable = client.GetSyncTable <ToDoItem> ();

                textNewToDo = FindViewById<EditText> (Resource.Id.textNewToDo);

                // Create an adapter to bind the items with the view
                adapter = new ToDoItemAdapter (this, Resource.Layout.Row_List_To_Do);
                var listViewToDo = FindViewById<ListView> (Resource.Id.listViewToDo);
                listViewToDo.Adapter = adapter;

                // Load the items from the Mobile Service
                await RefreshItemsFromTableAsync ();

            } catch (Java.Net.MalformedURLException) {
                CreateAndShowDialog (new Exception ("There was an error creating the Mobile Service. Verify the URL"), "Error");
            } catch (Exception e) {
                CreateAndShowDialog (e, "Error");
            }
        }
开发者ID:fellipetenorio,项目名称:mobile-services-samples,代码行数:57,代码来源:ToDoActivity.cs

示例8: QSTodoService

        private QSTodoService ()
        {
            CurrentPlatform.Init ();
            SQLitePCL.CurrentPlatform.Init(); 

            // Initialize the Mobile Service client with the Mobile App URL, Gateway URL and key
            client = new MobileServiceClient (applicationURL);

            // Create an MSTable instance to allow us to work with the TodoItem table
            todoTable = client.GetSyncTable <ToDoItem> ();
        }
开发者ID:lindydonna,项目名称:azure-mobile-apps-quickstarts,代码行数:11,代码来源:QSTodoService.cs

示例9: QSTodoService

        private QSTodoService ()
        {
            CurrentPlatform.Init ();
            SQLitePCL.Batteries.Init(); 

            // Initialize the client with the mobile app backend URL.
            client = new MobileServiceClient (applicationURL);

            // Create an MSTable instance to allow us to work with the TodoItem table
            todoTable = client.GetSyncTable <ToDoItem> ();
        }
开发者ID:shrishrirang,项目名称:azure-mobile-apps-quickstarts,代码行数:11,代码来源:QSTodoService.cs

示例10: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            global::Xamarin.Forms.Forms.Init (this, bundle);

            CurrentPlatform.Init();

            MobileService = new MobileServiceClient(
                "https://qutbraingearapp.azure-mobile.net/",
                "dqTWRsEygjexEvHVQYjzrneKfvTKBU73"
            );

            // new code to initialize the SQLite store
            string path = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), localDbFilename);

            if (!File.Exists(path))
            {
                File.Create(path).Dispose();
            }

            var store = new MobileServiceSQLiteStore(path);
            store.DefineTable<Module>();
            store.DefineTable<QA>();
            store.DefineTable<Comment>();
            store.DefineTable<Skills>();

            // Uses the default conflict handler, which fails on conflict
            MobileService.SyncContext.InitializeAsync(store, new MobileServiceSyncHandler ()).Wait ();
            QUTBrainGearDB.MobileService = MobileService;

            QUTBrainGearDB.ModuleTable = MobileService.GetSyncTable <Module> ();
            QUTBrainGearDB.QATable = MobileService.GetSyncTable <QA> ();
            QUTBrainGearDB.CommentTable = MobileService.GetSyncTable <Comment> ();
            QUTBrainGearDB.SkillsTable = MobileService.GetSyncTable <Skills> ();

            QUTBrainGearDB.SyncAsync ();

            LoadApplication (new App());
        }
开发者ID:cthorne,项目名称:TeamBPlus,代码行数:40,代码来源:MainActivity.cs

示例11: SensorModel

        public SensorModel()
        {
            // initialize mobile services and SQLLite store
            Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
#if __IOS__
            SQLitePCL.CurrentPlatform.Init();
#endif

            // initialize the client with your app url and key
            client = new MobileServiceClient(applicationURL, applicationKey);
            // create sync table instance
            sensorDataTable = client.GetSyncTable<SensorDataItem>();
        }
开发者ID:garymedina,项目名称:OfflineSyncApp,代码行数:13,代码来源:SensorModel.cs

示例12: GetTableAsync

        private async Task<IMobileServiceSyncTable<DerivedDataEntity>> GetTableAsync(MobileServiceSQLiteStore store)
        {
            store.DefineTable<DerivedDataEntity>();
            MobileServiceClient client = null;
#if WIN_APPS
            client = new MobileServiceClient((string)ApplicationData.Current.LocalSettings.Values["MobileAppUrl"]);
#else
            client = new MobileServiceClient(ConfigurationManager.AppSettings["MobileAppUrl"]);
#endif
            client.InitializeExpressFileSyncContext(store);
            await client.SyncContext.InitializeAsync(store);
            return client.GetSyncTable<DerivedDataEntity>();
        }
开发者ID:Azure,项目名称:azure-mobile-apps-net-files-client,代码行数:13,代码来源:MetadataScenario.cs

示例13: TodoItemManager

        private TodoItemManager()
        {
            this.client = new MobileServiceClient(Constants.ApplicationURL);

            var store = new MobileServiceSQLiteStore("localstore.db");
            store.DefineTable<TodoItem>();

            //Initializes the SyncContext using the default IMobileServiceSyncHandler.
            this.client.SyncContext.InitializeAsync(store);

            this.todoTable = client.GetSyncTable<TodoItem>();

        }
开发者ID:Rajatfeb20,项目名称:dev-days-labs,代码行数:13,代码来源:TodoItemManager.cs

示例14: InitAsync

		/// <summary>
		/// Initializes the backend service and connects with Azure
		/// </summary>
		/// <returns></returns>
		public static async Task InitAsync()
		{
			if (_IsInitialized)
				return;

			// Create the mobile client
			_MobileService = new MobileServiceClient("http://YOUR-MOBILE-SERVICE-URL");

			// Setup the local SQLite database
			var store = new MobileServiceSQLiteStore("mynotestore.db");
			store.DefineTable<Note>();
			await _MobileService.SyncContext.InitializeAsync(store);

			// Get tables for local database
			_NoteTable = _MobileService.GetSyncTable<Note>();		

			// Set initialized flag to avoid double initialisation
			_IsInitialized = true;
		}
开发者ID:MicrosoftDXGermany,项目名称:Cross-Platform,代码行数:23,代码来源:NoteService.cs

示例15: OnCreate

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			Xamarin.Forms.Forms.Init (this, bundle);

			#region Azure stuff
			CurrentPlatform.Init ();

			Client = new MobileServiceClient (
				Constants.Url, 
				Constants.Key);		


			#region Azure Sync stuff
			// http://azure.microsoft.com/en-us/documentation/articles/mobile-services-xamarin-android-get-started-offline-data/
			// new code to initialize the SQLite store
			string path = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "test1.db");

			if (!File.Exists(path))
			{
				File.Create(path).Dispose();
			}

			var store = new MobileServiceSQLiteStore(path);
			store.DefineTable<TodoItem>();

			Client.SyncContext.InitializeAsync(store).Wait();
			#endregion


			todoTable = Client.GetSyncTable<TodoItem>(); 
			todoItemManager = new TodoItemManager(Client, todoTable);

			App.SetTodoItemManager (todoItemManager);
			#endregion region

			#region Text to Speech stuff
			App.SetTextToSpeech (new Speech ());
			#endregion

			SetPage (App.GetMainPage ());
		}
开发者ID:JeffHarms,项目名称:xamarin-forms-samples-1,代码行数:43,代码来源:MainActivity.cs


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