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

C# MobileServices.MobileServiceClient类代码示例

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

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



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

示例1: LoginAsync

        public async Task<MobileServiceUser> LoginAsync(MobileServiceClient client, MobileServiceAuthenticationProvider provider)
        {
            try
            {
                var window = UIKit.UIApplication.SharedApplication.KeyWindow;
                var root = window.RootViewController;
                if(root != null)
                {
                    var current = root;
                    while(current.PresentedViewController != null)
                    {
                        current = current.PresentedViewController;
                    }


                    Settings.LoginAttempts++;

                    var user = await client.LoginAsync(current, provider);

                    Settings.AuthToken = user?.MobileServiceAuthenticationToken ?? string.Empty;
                    Settings.UserId = user?.UserId ?? string.Empty;

                    return user;
                }
            }
            catch(Exception e)
            {
                e.Data["method"] = "LoginAsync";
                Xamarin.Insights.Report(e);
            }

            return null;
        }
开发者ID:RCWade,项目名称:app-coffeecups,代码行数:33,代码来源:Authentication.cs


示例2: MainViewModel

        public MainViewModel(IPopupService popupService, SynchronizationContext synchonizationContext)
        {
            var client = new MobileServiceClient(
                _mobileServiceUrl,
                _mobileServiceKey);

            _liveAuthClient = new LiveAuthClient(_mobileServiceUrl);
            
            // Apply a ServiceFilter to the mobile client to help with our busy indication
            _mobileServiceClient = client.WithFilter(new DotoServiceFilter(
                busy =>
                {
                    IsBusy = busy;
                }));
            _popupService = popupService;
            _synchronizationContext = synchonizationContext;
            _invitesTable = _mobileServiceClient.GetTable<Invite>();
            _itemsTable = _mobileServiceClient.GetTable<Item>();
            _profilesTable = _mobileServiceClient.GetTable<Profile>();
            _listMembersTable = _mobileServiceClient.GetTable<ListMembership>();
            _devicesTable = _mobileServiceClient.GetTable<Device>();
            _settingsTable = _mobileServiceClient.GetTable<Setting>();

            SetupCommands();

            LoadSettings();
        }
开发者ID:TroyBolton,项目名称:azure-mobile-services,代码行数:27,代码来源:MainViewModel.cs


示例3: Construction

        public void Construction()
        {
            string appUrl = "http://www.test.com/";
            string appKey = "secret...";

            MobileServiceClient service = new MobileServiceClient(new Uri(appUrl), appKey);
            Assert.AreEqual(appUrl, service.ApplicationUri.ToString());
            Assert.AreEqual(appKey, service.ApplicationKey);

            service = new MobileServiceClient(appUrl, appKey);
            Assert.AreEqual(appUrl, service.ApplicationUri.ToString());
            Assert.AreEqual(appKey, service.ApplicationKey);

            service = new MobileServiceClient(new Uri(appUrl));
            Assert.AreEqual(appUrl, service.ApplicationUri.ToString());
            Assert.AreEqual(null, service.ApplicationKey);

            service = new MobileServiceClient(appUrl);
            Assert.AreEqual(appUrl, service.ApplicationUri.ToString());
            Assert.AreEqual(null, service.ApplicationKey);

            Uri none = null;
            Throws<ArgumentNullException>(() => new MobileServiceClient(none));
            Throws<FormatException>(() => new MobileServiceClient("not a valid [email protected]#[email protected]#"));
        }
开发者ID:TroyBolton,项目名称:azure-mobile-services,代码行数:25,代码来源:ZumoService.Test.cs


示例4: ViewModelLocator

        /// <summary>
        /// Initializes a new instance of the ViewModelLocator class.
        /// </summary>
        public ViewModelLocator()
        {
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            ToggableNetworkInformation networkInfo = new ToggableNetworkInformation();

            SimpleIoc.Default.Register<INetworkInformation>(() => networkInfo);

            SimpleIoc.Default.Register<IStructuredStorage>(() => new SQLiteStructuredStorage("cache"));
            SimpleIoc.Default.Register<ISynchronizer, TimestampSynchronizer>();
            SimpleIoc.Default.Register<Func<Uri, bool>>(() => (u => true));
            //SimpleIoc.Default.Register<ICacheProvider, DisabledCacheProvider>();
            SimpleIoc.Default.Register<ICacheProvider, TimestampCacheProvider>();

            SimpleIoc.Default.Register<NetworkInformationDelegate>(() =>
            {
                return new NetworkInformationDelegate(() => networkInfo.IsOnline, b => networkInfo.IsOnline = b);
            });

            SimpleIoc.Default.Register<MainViewModel>();

            DelegatingHandler handler = new CacheHandler(SimpleIoc.Default.GetInstance<ICacheProvider>());

            // Configure your mobile service here
            MobileServiceClient MobileService = new MobileServiceClient(
                Constants.MobileServiceUrl,
                Constants.MobileServiceKey,
                handler
            );

            SimpleIoc.Default.Register<IMobileServiceClient>(() => MobileService);
        }
开发者ID:jlaanstra,项目名称:azure-mobile-services,代码行数:35,代码来源:ViewModelLocator.cs


示例5: RegisterForRemotePushNotifications

 public void RegisterForRemotePushNotifications(MobileServiceClient client, string channelName)
 {
     // Register for push with Mobile Services
     IEnumerable<string> tag = new List<string>() { channelName };
     var push = client.GetPush();
     push.RegisterNativeAsync(DeviceToken, tag);
 }
开发者ID:pedroccrl,项目名称:Xamarin.Plugins-1,代码行数:7,代码来源:AzureNotifier.cs


示例6: AzureDB

		static AzureDB ()
		{
			CurrentPlatform.Init ();
			MobileService = new MobileServiceClient (ApplicationURL, ApplicationKey);
			GetScoreTable ();
			GetUserAuthenticationTable ();
		}
开发者ID:jaehwan-jung,项目名称:RPS-Arcade,代码行数:7,代码来源:AzureDB.cs


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


示例8: PerformUserLogin

        private async void PerformUserLogin(object sender, System.Windows.Input.GestureEventArgs e)
        {
            username = userName.Text;
            phoneNo = userPhone.Text;

            if (MainPage.online == true)
            {
                Users user = new Users();
                user.Name = username;
                user.Phone_no = phoneNo;
                user.uri = "uri here";
                MobileService = new MobileServiceClient(
                     "https://shopappdata.azure-mobile.net/",
                       "dkwwuiuHYYQwbozjKaWRJYYpEiTjFt73"
                );
                userTable = MobileService.GetTable<Users>();

                await userTable.InsertAsync(user);
                user_id = user.Id;

                MainPage.settings.Add("id", user_id);
                MainPage.settings.Add("Pnumber", phoneNo);
                MainPage.settings.Add("name", username);
            }
            else
            {
                // Prompt
            }

            // TODO: send this username and phoneno. to be added into the database


            NavigationService.GoBack();
        }
开发者ID:VishrutMehta,项目名称:ShopperSoft,代码行数:34,代码来源:Login.xaml.cs


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


示例10: ImagesListViewModel

        public ImagesListViewModel(MobileServiceClient client)
        {
            _client = client;

            //_UserName = "Demo User";
            //_AlbumName = "Demo Album";
        }
开发者ID:cephalin,项目名称:ContosoMoments,代码行数:7,代码来源:ImagesListViewModel.cs


示例11: AuthenticateSilent

        /// <summary>
        /// Versucht Login, ohne einen entsprechenden Dialog zu zu zeigen.
        /// </summary>
        /// <returns>Ein MobileServiceUser, der awaited werden kann oder null bei Misserfolg.</returns>
        internal static async Task<MobileServiceUser> AuthenticateSilent(MobileServiceClient mobileService)
        {
            LiveAuthClient liveAuthClient = new LiveAuthClient(APIKeys.LiveClientId);
            session = (await liveAuthClient.InitializeAsync()).Session;
            return await mobileService.LoginWithMicrosoftAccountAsync(session.AuthenticationToken);

        }
开发者ID:JulianMH,项目名称:DoIt,代码行数:11,代码来源:LiveAuthenticator.cs


示例12: App

        public App()
        {

            TelemetryConfiguration.Active.InstrumentationKey = "5afcb70e-e5b7-41c5-9e57-aa6fb9f08c2a";
            Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
                Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
                Microsoft.ApplicationInsights.WindowsCollectors.Session |
                Microsoft.ApplicationInsights.WindowsCollectors.PageView |
                Microsoft.ApplicationInsights.WindowsCollectors.UnhandledException
        );
            InitializeComponent();
            SplashFactory = (e) => new Views.Splash(e);
            #region TelemetryClient Init
            Telemetry = new TelemetryClient();
            #endregion
           MobileService =
new MobileServiceClient(
    "https://petrolheadappuwp.azurewebsites.net"
);
            #region App settings

            var _settings = SettingsService.Instance;
            RequestedTheme = _settings.AppTheme;
            CacheMaxDuration = _settings.CacheMaxDuration;
            ShowShellBackButton = _settings.UseShellBackButton;

            #endregion
        }
开发者ID:SupernovaApps,项目名称:PetrolheadUWP,代码行数:28,代码来源:App.xaml.cs


示例13: FinishedLaunching

		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			Forms.Init ();
			// create a new window instance based on the screen size
			window = new UIWindow (UIScreen.MainScreen.Bounds);


			#region Azure stuff
			CurrentPlatform.Init ();
			Client = new MobileServiceClient (
				Constants.Url, 
				Constants.Key);	
			todoTable = Client.GetTable<TodoItem>(); 
			todoItemManager = new TodoItemManager(todoTable);

			App.SetTodoItemManager (todoItemManager);
			#endregion region

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

			// If you have defined a view, add it here:
			// window.RootViewController  = navigationController;
			window.RootViewController = App.GetMainPage ().CreateViewController ();

			// make the window visible
			window.MakeKeyAndVisible ();

			return true;
		}
开发者ID:JeffHarms,项目名称:xamarin-forms-samples-1,代码行数:31,代码来源:AppDelegate.cs


示例14: App

        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            mobileServiceClient = new MobileServiceClient("AZURE_URL_GOES_HERE", "AZURE_API_KEY_GOES_HERE");
        }
开发者ID:pbgodwin,项目名称:Speed-Trap-Demo-App,代码行数:11,代码来源:App.xaml.cs


示例15: ServicioDatosImpl

 public ServicioDatosImpl()
 {
     
     client=new MobileServiceClient(Cadenas.UrlServicio,
         Cadenas.TokenServicio);
     
 }
开发者ID:luisgiltajamar,项目名称:BlocNotasCursoXamarin,代码行数:7,代码来源:ServicioDatosImpl.cs


示例16: AzureDataStore

		public AzureDataStore()
		{
			// This is a sample read-only azure site for demo
			// Follow the readme.md in the GitHub repo on how to setup your own.
			MobileService =  new MobileServiceClient(
            "http://myshoppe-demo.azurewebsites.net");
		}
开发者ID:jamesmontemagno,项目名称:MyShoppe,代码行数:7,代码来源:AzureDataStore.cs


示例17: Button_Click

        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            ClearTextbox();
            
            try
            {
                SelLoginIDDupeCheck selLoginIDDupeCheck = new SelLoginIDDupeCheck();
                //selLoginIDDupeCheck.memberID = crypto
                
                var client = new MobileServiceClient(serverURL.Text, serverKey.Password);
                string j = @"{""memberID"": ""aaa"" }";

                //토큰 = body 텍스트 - 으로 바로 로드
                inputTextbox.Text = j;
                JToken token = JObject.Parse(j);

                var orderResult = await client.InvokeApiAsync("CBSelLoginIDDupeCheck", token);
                outputTextbox.Text = orderResult.ToString();

            }
                catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
开发者ID:netscout,项目名称:CloudBread,代码行数:25,代码来源:MainPage.xaml.cs


示例18: MainPage

      public MainPage()
      {
         this.InitializeComponent();

         _mobileService = new MobileServiceClient( PixelPrinterPlugin.GetServiceUrl( _environment ) );
         _mobileService.AlternateLoginHost = new Uri( PixelPrinterPlugin.GetServiceUrl( PixelPrinterPlugin.TargetEnvironment.Live ) );
      }
开发者ID:BLesnau,项目名称:PixelPrinter,代码行数:7,代码来源:MainPage.xaml.cs


示例19: AddClientSecrets

partial         void AddClientSecrets(ref MobileServiceClient client)
        {
            client = new MobileServiceClient(
                "{ Mobile Service URL }",
                "{ Mobile Service key }"
            );
        }
开发者ID:yeenfei,项目名称:samples,代码行数:7,代码来源:Secrets.example.cs


示例20: ExecuteTest

        /// <summary>
        /// Utility method that can be used to execute a test.  It will capture any exceptions throw
        /// during the execution of the test and return a message with details of the exception thrown.
        /// </summary>
        /// <param name="testName">The name of the test being executed.
        /// </param>
        /// <param name="test">A test to execute.
        /// </param>
        /// <returns>
        /// Either the result of the test if the test passed, or a message with the exception
        /// that was thrown.
        /// </returns>
        public static async Task<string> ExecuteTest(string testName, Func<Task<string>> test)
        {
            string resultText = null;
            bool didPass = false;

            if (client == null)
            {
                string appUrl = null;
                App.Harness.Settings.Custom.TryGetValue("MobileServiceRuntimeUrl", out appUrl);

                client = new MobileServiceClient(appUrl);
            }

            try
            {
                resultText = await test();
                didPass = true;
            }
            catch (Exception exception)
            {
                resultText = string.Format("ExceptionType: {0} Message: {1} StackTrace: {2}",
                                               exception.GetType().ToString(),
                                               exception.Message,
                                               exception.StackTrace);
            }

            return string.Format("Test '{0}' {1}.\n{2}",
                                 testName,
                                 didPass ? "PASSED" : "FAILED",
                                 resultText);
        }
开发者ID:brettsam,项目名称:azure-mobile-apps-net-client,代码行数:43,代码来源:LoginTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# MobileServices.MobileServiceUser类代码示例发布时间:2022-05-26
下一篇:
C# Client.CloudMediaContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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