public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); ViewActive = true; Carousel.Hidden = false; // this will prevent double requests in the case that we leave and return to the prayer // page before the initial request completes if (RequestingPrayers == false) { TimeSpan deltaTime = DateTime.Now - LastDownload; if (deltaTime.TotalHours > PrivatePrayerConfig.PrayerDownloadFrequency.TotalHours) { BlockerView.BringToFront( ); Rock.Mobile.Util.Debug.WriteLine("Grabbing Prayers"); RetrievePrayerRequests( ); } else { Rock.Mobile.Util.Debug.WriteLine("Not getting prayers."); // add a read analytic PrayerAnalytic.Instance.Trigger(PrayerAnalytic.Read); } } }
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); }); } }); }); } }
protected void SetUIState(LoginState state) { // reset the result label LoginResult.Field.Text = ""; switch (state) { case LoginState.Out: { UserNameField.Field.Enabled = true; PasswordField.Field.Enabled = true; LoginButton.Enabled = true; CancelButton.Enabled = true; RegisterButton.Hidden = false; RegisterButton.Enabled = true; LoginButton.SetTitle(LoginStrings.LoginButton, UIControlState.Normal); break; } case LoginState.Trying: { FadeLoginResult(false); BlockerView.Show(null); BlockerView.BringToFront( ); UserNameField.Field.Enabled = false; PasswordField.Field.Enabled = false; LoginButton.Enabled = false; CancelButton.Enabled = false; RegisterButton.Enabled = false; LoginButton.SetTitle(LoginStrings.LoginButton, UIControlState.Normal); break; } // Deprecated state case LoginState.In: { UserNameField.Field.Enabled = false; PasswordField.Field.Enabled = false; LoginButton.Enabled = true; CancelButton.Enabled = true; RegisterButton.Hidden = true; RegisterButton.Enabled = false; LoginButton.SetTitle("Logout", UIControlState.Normal); break; } } State = state; }
public override void OnResume() { base.OnResume(); // logged in sanity check. if (RockMobileUser.Instance.LoggedIn == false) { throw new Exception("A user must be logged in before viewing a profile. How did you do this?"); } SpringboardParent.ModalFragmentOpened(this); ResultView.Hide( ); BlockerView.BringToFront( ); BlockerView.Show( delegate { RockMobileUser.Instance.GetPersonData(delegate(System.Net.HttpStatusCode statusCode, string statusDescription) { if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true) { ScrollView.ScrollEnabled = true; // show the latest profile info ModelToUI( ); } else { // show failure prompt ResultView.Show(ProfileStrings.ProfileErrorTitle, PrivateControlStylingConfig.Result_Symbol_Failed, ProfileStrings.ProfileErrorDesc, GeneralStrings.Ok); // if the result is "Not Found", then that means their login is no longer valid. Force a logout. if (statusCode == System.Net.HttpStatusCode.NotFound) { // then log them out. RockMobileUser.Instance.LogoutAndUnbind( ); } } BlockerView.Hide(null); }); }); }
void RefreshProfile( ) { // don't allow a double refresh, obviously. if (RefreshingProfile == false) { RefreshingProfile = true; ResultView.Hide( ); BlockerView.BringToFront( ); BlockerView.Show( delegate { RockMobileUser.Instance.GetPersonData(delegate(System.Net.HttpStatusCode statusCode, string statusDescription) { RefreshingProfile = false; if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true) { // show the latest profile info ModelToUI( ); } else { // show failure prompt ResultView.Show(ProfileStrings.ProfileErrorTitle, PrivateControlStylingConfig.Result_Symbol_Failed, ProfileStrings.ProfileErrorDesc, GeneralStrings.Ok); // if the result is "Not Found", then that means their login is no longer valid. Force a logout. if (statusCode == System.Net.HttpStatusCode.NotFound) { // then log them out. RockMobileUser.Instance.LogoutAndUnbind( ); } } BlockerView.Hide(null); }); }); } }
public void PerformSearch( ) { if (SearchField.GetCurrentValue( ).Length > Settings.General_MinSearchLength) { // put the list at the top, so that when we refresh it, it correctly resizes each row TableView.SetContentOffset(CGPoint.Empty, true); SearchField.ResignFirstResponder( ); BlockerView.BringToFront( ); BlockerView.Show( delegate { // search for the family RockApi.Get_Groups_FamiliesByPersonNameSearch(SearchField.GetCurrentValue( ), delegate(System.Net.HttpStatusCode statusCode, string statusDescription, List <Rock.Client.Family> model) { if (Rock.Mobile.Network.Util.StatusInSuccessRange(statusCode) == true && model != null && model.Count > 0) { Families = model; } else { // error (or no results) Families = new List <Rock.Client.Family>( ); DidSearchFail = true; } // reload data ((TableSource)TableView.Source).FamiliesUpdated(TableView); TableView.ReloadData( ); BlockerView.Hide( ); }); }); } }