コード例 #1
0
        private void PerformServiceStackAuth(JsonServiceClient client)
        {
            var ssAuth = new ServiceStackAuthenticator(
                MainActivity.BaseUrl,
                "twitter", jsonServiceClient =>
            {
                var userDetails          = jsonServiceClient.Get(new GetUserDetails());
                ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this);
                prefs.Edit().PutString("TwitterUserName", userDetails.UserName).Commit();
                return(new Account(userDetails.UserName, jsonServiceClient.CookieContainer));
            });

            ssAuth.Title = "Twitter / Authorize Chat";
            ssAuth.ServiceClientFactory = baseUrl => client;
            StartActivity(ssAuth.GetUI(this));
            ssAuth.Completed += (authSender, authArgs) =>
            {
                if (authArgs.IsAuthenticated)
                {
                    AccountStore.Create(this).Save(authArgs.Account, "Twitter");
                    StartAuthChatActivity(client, authArgs.Account);
                }
            };
        }
コード例 #2
0
 private void PerformServiceStackAuth(JsonServiceClient client)
 {
     var ssAuth = new ServiceStackAuthenticator(
         MainActivity.BaseUrl,
         "twitter", jsonServiceClient =>
         {
             var userDetails = jsonServiceClient.Get(new GetUserDetails());
             ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this);
             prefs.Edit().PutString("TwitterUserName", userDetails.UserName).Commit();
             return new Account(userDetails.UserName, jsonServiceClient.CookieContainer);
         });
     ssAuth.Title = "Twitter / Authorize Chat";
     ssAuth.ServiceClientFactory = baseUrl => client;
     StartActivity(ssAuth.GetUI(this));
     ssAuth.Completed += (authSender, authArgs) =>
     {
         if (authArgs.IsAuthenticated)
         {
             AccountStore.Create(this).Save(authArgs.Account, "Twitter");
             StartAuthChatActivity(client, authArgs.Account);
         }
     };
 }