protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Login);
            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this);

            this.uriText = FindViewById<EditText>(Resource.Id.ServiceUri);
            this.tagsText = FindViewById<EditText>(Resource.Id.ServiceTags);

            this.uriText.Text = prefs.GetString(Keys.MobileServiceUri, null);
            this.tagsText.Text = prefs.GetString(Keys.TagExpression, null);

            FindViewById<Button>(Resource.Id.RunTests).Click += OnClickRunTests;
            FindViewById<Button>(Resource.Id.Login).Click += OnClickLogin;

            string autoStart = ReadSettingFromIntentOrDefault(Keys.AutoStart, "false");
            if (autoStart != null && autoStart.ToLower() == "true")
            {
                TestConfig config = new TestConfig
                {
                    MobileServiceRuntimeUrl = ReadSettingFromIntentOrDefault(Keys.MobileServiceUri),
                    RuntimeVersion = ReadSettingFromIntentOrDefault(Keys.RuntimeVersion),
                    TagExpression = ReadSettingFromIntentOrDefault(Keys.TagExpression)
                };
                App.Harness.SetAutoConfig(config);
                RunTests();
            }
        }
        public static void SetAutoConfig(this TestHarness harness, TestConfig config)
        {
            harness.Settings.ManualMode = true;

            if (config == null)
            {
                harness.Settings.ManualMode = false;
                return;
            }

            harness.Settings.Custom["MobileServiceRuntimeUrl"] = config.MobileServiceRuntimeUrl;
            harness.Settings.Custom["TestFrameworkStorageContainerSasToken"] = config.TestFrameworkStorageContainerSasToken;
            harness.Settings.Custom["TestFrameworkStorageContainerUrl"] = config.TestFrameworkStorageContainerUrl;
            harness.Settings.Custom["RuntimeVersion"] = config.RuntimeVersion;
            harness.Settings.TagExpression = config.TagExpression;
            harness.Settings.ManualMode = false;
        }
        public static void SetAutoConfig(this TestHarness harness, TestConfig config)
        {
            harness.Settings.ManualMode = true;

            if (config == null)
            {
                harness.Settings.ManualMode = false;
                return;
            }

            harness.Settings.Custom["MobileServiceRuntimeUrl"] = config.MobileServiceRuntimeUrl;
            harness.Settings.Custom["MobileServiceRuntimeKey"] = config.MobileServiceRuntimeKey;
            harness.Settings.Custom["MasterRunId"] = config.MasterRunId;
            harness.Settings.Custom["RuntimeVersion"] = config.RuntimeVersion;
            harness.Settings.Custom["CliendId"] = config.CliendId;
            harness.Settings.Custom["ClientSecret"] = config.ClientSecret;
            harness.Settings.Custom["DayLightUrl"] = config.DayLightUrl;
            harness.Settings.Custom["DaylightProject"] = config.DaylightProject;
            harness.Settings.TagExpression = config.TagExpression;
            harness.Settings.ManualMode = false;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Login);
            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this);

            if (!onEmulator)
            {
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);

                if (!GcmClient.IsRegisteredOnServer(this))
                {
                    GcmClient.UnRegister(this);
                }
                GcmClient.Register(this, GcmBroadcastReceiver.SENDER_IDS);
            }

            this.uriText = FindViewById<EditText>(Resource.Id.ServiceUri);
            this.tagsText = FindViewById<EditText>(Resource.Id.ServiceTags);
            this.loginTestResult = FindViewById<TextView>(Resource.Id.LoginTestResult);

            this.uriText.Text = prefs.GetString(Keys.MobileServiceUri, null);
            this.tagsText.Text = prefs.GetString(Keys.TagExpression, null);

            FindViewById<Button>(Resource.Id.RunTests).Click += OnClickRunTests;
            FindViewById<Button>(Resource.Id.MSALogin).Click += OnClickMicrosoftAccountLoginAndRefresh;
            FindViewById<Button>(Resource.Id.AADLogin).Click += OnClickAADLoginAndRefresh;
            FindViewById<Button>(Resource.Id.GoogleLogin).Click += OnClickGoogleLoginAndRefresh;
            FindViewById<Button>(Resource.Id.FacebookLogin).Click += OnClickFacebookLoginAndRefresh;
            FindViewById<Button>(Resource.Id.TwitterLogin).Click += OnClickTwitterLoginAndRefresh;

            string autoStart = ReadSettingFromIntentOrDefault(Keys.AutoStart, "false");
            if (autoStart != null && autoStart.ToLower() == "true")
            {
                TestConfig config = new TestConfig
                {
                    MobileServiceRuntimeUrl = ReadSettingFromIntentOrDefault(Keys.MobileServiceUri),
                    RuntimeVersion = ReadSettingFromIntentOrDefault(Keys.RuntimeVersion),
                    TagExpression = ReadSettingFromIntentOrDefault(Keys.TagExpression),
                    TestFrameworkStorageContainerUrl = ReadSettingFromIntentOrDefault(Keys.StorageUrl),
                    TestFrameworkStorageContainerSasToken = ReadSettingFromIntentOrDefault(Keys.StorageSasToken)
                };
                App.Harness.SetAutoConfig(config);
                RunTests();
            }
        }