Ejemplo n.º 1
0
        /// <summary>
        /// Used to update everything to do with a Microsoft Account including WNS
        /// </summary>
        private void UpdateLiveNotifications()
        {
            // set this up
            int count = 3;

            if (String.IsNullOrEmpty(MicrosoftAccountClientId))
            {
                count--;
            }
            if (String.IsNullOrEmpty(MicrosoftAccountClientSecret))
            {
                count--;
            }
            if (String.IsNullOrEmpty(MicrosoftAccountPackageSID))
            {
                count--;
            }
            // if we only have a single value we're interested
            // permutations are client id + secret OR client id + package sid
            if (count < 2)
            {
                return;
            }
            var converted = JsonConvert.SerializeObject(new WindowsAuthProvider(MicrosoftAccountPackageSID, MicrosoftAccountClientId, MicrosoftAccountClientSecret));
            // execute the command
            var command = new UpdateMobileServiceSettingsCommand(MobileServiceName, Constants.MobileServicesLiveSettings, converted)
            {
                SubscriptionId = SubscriptionId,
                Certificate    = ManagementCertificate
            };

            command.Execute();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Used to update the authentication for the mobile service
        /// </summary>
        private void UpdateAuth()
        {
            // setup the providers
            var providers        = new List <MobileServicesAuthProvider>();
            var googleProvider   = new MobileServicesAuthProvider(Constants.GoogleProvider, GoogleClientId, GoogleClientSecret);
            var facebookProvider = new MobileServicesAuthProvider(Constants.FacebookProvider, FacebookClientId, FacebookClientSecret);
            var twitterProvider  = new MobileServicesAuthProvider(Constants.TwitterProvider, TwitterClientId, TwitterClientSecret);

            //check whether they are empty or not
            if (!(String.IsNullOrEmpty(GoogleClientId) && String.IsNullOrEmpty(GoogleClientSecret)))
            {
                providers.Add(googleProvider);
            }
            if (!(String.IsNullOrEmpty(TwitterClientId) && String.IsNullOrEmpty(TwitterClientSecret)))
            {
                providers.Add(twitterProvider);
            }
            if (!(String.IsNullOrEmpty(FacebookClientId) && String.IsNullOrEmpty(FacebookClientSecret)))
            {
                providers.Add(facebookProvider);
            }
            // execute the command
            var converted = JsonConvert.SerializeObject(providers);
            var command   = new UpdateMobileServiceSettingsCommand(MobileServiceName, Constants.MobileServicesAuthSettings, converted)
            {
                SubscriptionId = SubscriptionId,
                Certificate    = ManagementCertificate
            };

            command.Execute();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Used to update the service settings currently dynamic schema only
        /// </summary>
        private void UpdateService()
        {
            // we'll always have a value for this
            var dictionary = new Dictionary <string, string>();

            dictionary[Constants.DynamicSchemaEnabled] = DynamicSchemaEnabled.ToString().ToLower();
            var converted = JsonConvert.SerializeObject(dictionary);
            // execute this command
            // TODO: speak to MSFT the current verb is PATCH it would be good to understand where this is going
            var command = new UpdateMobileServiceSettingsCommand(MobileServiceName, Constants.MobileServicesServiceSettings, converted, "PATCH")
            {
                SubscriptionId = SubscriptionId,
                Certificate    = ManagementCertificate
            };

            command.Execute();
        }