void RestoreFromBackground( ) { // check to see if we should re-run the Start() process TimeSpan delta = DateTime.Now - LockTimer; if (delta.TotalMinutes > Settings.General_AutoLockTime) { // if they're not on the firstRun controller, we need to first verify Rock // is still where it should be, and second, force them to log back in. if (FirstRunViewController.Visible == false) { // see if Rock is present ApplicationApi.IsRockAtURL(Config.Instance.RockURL, delegate(System.Net.HttpStatusCode statusCode, string statusDescription) { // if it IS, show the login controller (if we're not already) if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode)) { DisplayLoginScreen(false); } // Rock wasn't found, so display the first run VC again else { DisplayFirstRun( ); } }); } } }
void PerformSearch( ) { // only let them submit if they have something beyond "http://" (or some other short crap) if (RockUrlField.Text.IsValidURL( )) { // hide the keyboard RockUrlField.ResignFirstResponder( ); // disable until we're done Submit.Enabled = false; BlockerView.BringToFront( ); BlockerView.Show(delegate { // see if Rock exists at this endpoint ApplicationApi.IsRockAtURL(RockUrlField.Text, delegate(HttpStatusCode statusCode, string statusDesc) { if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode)) { // attempt to contact Rock and get all the required information. Config.Instance.TryBindToRockServer(RockUrlField.Text, RockAuthKeyField.Text, delegate(bool result) { // it worked, so Rock is valid. if (result == true) { // take these as our values. Config.Instance.CommitRockSync( ); Config.Instance.SetConfigurationDefinedValue(Config.Instance.ConfigurationTemplates[0], delegate(bool configResult) { if (configResult == true) { HandlePerformSearchResult(true, Strings.General_RockBindSuccess); } else { // ROCK DATA ERROR HandlePerformSearchResult(false, Strings.General_RockBindError_Data); } }); } else { // ROCK DATA ERROR HandlePerformSearchResult(false, Strings.General_RockBindError_Data); } }); } else { // Rock NOT FOUND HandlePerformSearchResult(false, Strings.General_RockBindError_NotFound); } }); }); } }
void DownloadRockValues( ) { // only let them submit if they have something beyond "http://" (or some other short crap) if (RockUrlField.Text.IsValidURL( ) == true) { // hide the keyboard RockUrlField.ResignFirstResponder( ); // disable until we're done Sync.Enabled = false; ToggleSaveButton(false); BlockerView.BringToFront( ); BlockerView.Show(delegate { // see if Rock is AT this server. ApplicationApi.IsRockAtURL(RockUrlField.Text, delegate(System.Net.HttpStatusCode statusCode, string statusDescription) { if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode)) { // attempt to contact Rock and get all the required information. Config.Instance.TryBindToRockServer(RockUrlField.Text, RockAuthKeyField.Text, delegate(bool result) { // it worked, so Rock is valid. if (result == true) { ConfigurationTemplates = Config.Instance.TempConfigurationTemplates; Campuses = Config.Instance.TempCampuses; HandleDownloadResult(Strings.General_RockBindSuccess); } else { // error - clear the lists ClearLists( ); HandleDownloadResult(Strings.General_RockBindError_Data); } }); } else { BlockerView.Hide( delegate { // error - clear the lists ClearLists( ); HandleDownloadResult(Strings.General_RockBindError_NotFound); }); } }); }); } }