public Leagues() { try { InitializeComponent(); LoggerMobile.Instance.logMessage("Opening Leagues", Portable.Util.Log.Enums.LoggerEnum.message); _viewModel = (LeaguesViewModel)Resources["viewModel"]; resultListBox.ItemRealized += resultListBox_ItemRealized; this.Loaded += new RoutedEventHandler(MainPage_Loaded); initialArray = new LeaguesJson(); ApplicationBar = new ApplicationBar(); ApplicationBar.Mode = ApplicationBarMode.Default; ApplicationBar.Opacity = 1.0; ApplicationBar.IsVisible = true; ApplicationBar.IsMenuEnabled = true; ApplicationBarIconButton searchBtn = new ApplicationBarIconButton(); searchBtn.IconUri = new Uri("/Assets/Icons/feature.search.png", UriKind.Relative); searchBtn.Text = "Search"; searchBtn.Click += searchBtn_Click; ApplicationBar.Buttons.Add(searchBtn); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
private void UpdateAdapter(LeaguesJson obj) { Deployment.Current.Dispatcher.BeginInvoke(() => { for (int i = 0; i < obj.Leagues.Count; i++) this.LeaguesCollection.Add(obj.Leagues[i]); IsLoading = false; }); }
protected override void OnCreate(Bundle bundle) { try { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(bundle); LoggerMobile.Instance.logMessage("Opening LeaguesActibity", LoggerEnum.message); SetContentView(Resource.Layout.PublicLeagues); LegacyBar = FindViewById<LegacyBar.Library.Bar.LegacyBar>(Resource.Id.actionbar); LegacyBar.SetHomeLogo(Resource.Drawable.icon); LegacyBar.SeparatorColor = Color.Purple; LegacyBarAction azAction = new MenuAction(this, null, Resource.Drawable.a_z); LegacyBar.AddAction(azAction); LegacyBar = FindViewById<LegacyBar.Library.Bar.LegacyBar>(Resource.Id.actionbar); AddHomeAction(typeof(Main), Resource.Drawable.icon); // Get our button from the layout resource, // and attach an event to it Action<LeaguesJson> leagues = new Action<LeaguesJson>(UpdateAdapter); LegacyBar.ProgressBarVisibility = ViewStates.Visible; League.PullLeagues(lastPagePulled, PAGE_COUNT, "", (Context)this, leagues); skaterList = FindViewById<ListView>(Resource.Id.leagueList); initialArray = new LeaguesJson(); Action pullMore= new Action(PullMore); ListAdapter = new LeagueAdapter(this, initialArray.Leagues, pullMore); skaterList.Adapter = ListAdapter; skaterList.FastScrollEnabled = true; skaterList.ItemClick += skaterList_ItemClick; var myString = new SpannableStringBuilder("lol"); Selection.SelectAll(myString); // needs selection or Index Out of bounds _dialog = new MyCharacterPickerDialog(this, new View(this), myString, options, false); _dialog.Clicked += (sender, args) => { lastPagePulled = 0; lastLetterPulled = args.Text; LegacyBar.ProgressBarVisibility = ViewStates.Visible; League.PullLeagues(0, PAGE_COUNT, lastLetterPulled, (Context)this, leagues); initialArray.Leagues.Clear(); }; search_leagues = FindViewById<EditText>(Resource.Id.search_leagues); search_leagues.TextChanged += search_skaters_TextChanged; var searchMenuItemAction = new SearchAction(this, null, Resource.Drawable.ic_action_search, search_leagues); LegacyBar.AddAction(searchMenuItemAction); LegacyBarAction infoAction = new DefaultLegacyBarAction(this, CreateInfoIntent(), Resource.Drawable.action_about); LegacyBar.AddAction(infoAction); m_AdView = FindViewById(Resource.Id.adView); if (SettingsMobile.Instance.User != null && SettingsMobile.Instance.User.IsValidSub) { } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.Android, (Context)this); } }
void UpdateAdapter(LeaguesJson skaters) { initialArray.Leagues.AddRange(skaters.Leagues); RunOnUiThread(() => { try { int firstPosition = skaterList.ScrollY; ListAdapter.NotifyDataSetChanged(); LegacyBar.ProgressBarVisibility = ViewStates.Gone; skaterList.ScrollTo(0, firstPosition); _dialog.Dismiss(); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.Android, (Context)this); } }); }
public JsonpResult GetAllLeaguesJsonP(int p, int c, string s, string sw) { List<LeagueJsonDataTable> names = new List<LeagueJsonDataTable>(); LeaguesJson leagues = new LeaguesJson(); try { if (!String.IsNullOrEmpty(s)) names = SiteCache.SearchAllPublicLeagues(p, c, s); else names = SiteCache.GetAllPublicLeagues(p, c, sw); leagues.Count = names.Count; leagues.Page = p; leagues.StartsWith = s; for (int i = 0; i < names.Count; i++) { leagues.Leagues.Add(names[i]); } } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return new JsonpResult(leagues); }
public LeaguesViewController() { initialArray = new LeaguesJson(); }
void UpdateAdapter(LeaguesJson skaters) { if (IsSearching) initialArray.Leagues.Clear(); initialArray.Leagues.AddRange(skaters.Leagues); InvokeOnMainThread(() => { try { //table.InsertRows(indexPaths.ToArray(), UITableViewRowAnimation.Fade); table.ReloadData(); loading.Hide(); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.iPhone); } }); }