public override void ViewDidLoad() { base.ViewDidLoad(); var apiTask = new ServiceApi().GetTeamRankings(TeamId); apiTask.HandleError(LoadingScreen); apiTask.OnSucess((response) => { source = new CustomListSource <TeamRanking>(response.Result, GetCell, (arg1, arg2) => 40); source.NoContentText = "No Rankings"; tvRankings.Source = source; tvRankings.ReloadData(); }); btnRankings.TouchUpInside += (sender, e) => { if (profile == null) { return; } var controller = Storyboard.InstantiateViewController <SportProfileViewController>(); controller.SportId = profile.SportId; controller.GoToRankings = true; NavigationController.PushViewController(controller, true); }; }
public void SetData(List <FavoriteItem> favorites) { source = new CustomListSource <FavoriteItem>(favorites, GetCell, (arg1, arg2) => UITableView.AutomaticDimension); source.NoContentText = "No Content"; tvFavorites.Source = source; tvFavorites.ReloadData(); }
void GetData() { Task <GlobalSearch> apiTask; if (UseType) { apiTask = new ServiceApi().SearchByType(txtSearch.Text, Type); } else { apiTask = new ServiceApi().Search(txtSearch.Text); } apiTask.HandleError(); apiTask.OnSucess(response => { if (txtSearch.Text == (response.Result.SearchText ?? "")) { List <GlobalSearchItem> items = response.Result.Results; source = new CustomListSource <GlobalSearchItem>(items, GetCell, (arg1, arg2) => UITableView.AutomaticDimension); tvSearch.Source = source; tvSearch.ReloadData(); } }); }
void GetData() { var apiTask = new ServiceApi().GetTags(PostId); apiTask.HandleError(); apiTask.OnSucess(response => { var source = new CustomListSource <PostTag>(response.Result, GetCell, (arg1, arg2) => 55); source.ItemClick += (sender, e) => { var item = e; if (item.Type == FeedType.User) { Navigator.GoToUserProfile(NavigationController, item.Id); } if (item.Type == FeedType.Team) { Navigator.GoToTeamProfile(NavigationController, item.Id, false); } if (item.Type == FeedType.School) { Navigator.GoToSchoolProfile(NavigationController, item.Id, false); } if (item.Type == FeedType.Sport) { Navigator.GoToSportProfile(NavigationController, item.Id, false); } }; source.NoContentText = "No Tags"; tvTags.Source = source; Count = response.Result.Count; tvTags.ReloadData(); UpdateParent?.Invoke(Name, Count); }); }
void GetData() { var filter = new FollowingFilterModel(); filter.MySchools = mySchools; filter.MySports = mySports; filter.MyTeams = myTeams; filter.SchoolId = SchoolId; var apiTask = new ServiceApi().GetRankings(filter); apiTask.HandleError(); apiTask.OnSucess(response => { if (tvRankings.Source == null) { source = new CustomListSource <Ranking> (response.Result, GetCell, (arg1, arg2) => UITableView.AutomaticDimension); source.NoContentText = "No Rankings"; tvRankings.Source = source; tvRankings.ReloadData(); } else { source.Items = response.Result; tvRankings.ReloadData(); } refreshControl.EndRefreshing(); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.Clear; vwBackground.AddGestureRecognizer(new UITapGestureRecognizer(() => { DismissViewController(true, null); })); var user = CrossSettings.Current.GetValueOrDefaultJson <User>("User"); if (!string.IsNullOrEmpty(user.ProfileUrl)) { ImageService.Instance.LoadUrl(user.ProfileUrl).Retry(3, 300).Transform(new CircleTransformation()).Into(imgProfile); } lblName.Text = user.FirstName + " " + user.LastName; if (string.IsNullOrEmpty(user.ContentSourceId) || !user.ContentSourceApproved) { vwContentSource.Hidden = true; } else { lblContentSource.Text = user.ContentSourceName; ImageService.Instance.LoadUrl(user.ContentSourceUrl).Retry(3, 300).Transform(new CircleTransformation()).Into(imgContentSource); } vwUser.AddGestureRecognizer(new UITapGestureRecognizer(() => { UserPicked?.Invoke(); DismissViewController(true, null); })); vwContentSource.AddGestureRecognizer(new UITapGestureRecognizer(() => { ContentSourcePicked?.Invoke(); DismissViewController(true, null); })); var adminProfiles = user.AdminSchools?.Select(m => new PostAsAdminProfile() { SchoolId = m.Id, Title = m.Name, Url = m.ProfileUrl }).OrderBy(m => Title).ThenBy(m => m.SubTitle).ToList() ?? new List <PostAsAdminProfile>(); adminProfiles.AddRange(user.AdminTeams?.Select(m => new PostAsAdminProfile() { TeamId = m.Id, Title = m.SchoolName, SubTitle = m.SportName, Url = m.ProfileUrl }) ?? new List <PostAsAdminProfile>().OrderBy(m => Title).ThenBy(m => m.SubTitle)); var source = new CustomListSource <PostAsAdminProfile>(adminProfiles, GetCell, (arg1, arg2) => 65); tvAdmins.Source = source; source.NoContentEnabled = false; lcTableHeight.Constant = 65 * adminProfiles.Count; }
public void SetData(List <FavoriteItem> following, List <FavoriteItem> followers) { Following = following; Followers = followers; source = new CustomListSource <FavoriteItem>(Following, GetCell, (arg1, arg2) => UITableView.AutomaticDimension); source.NoContentText = "No Content"; tvFavorites.Source = source; tvFavorites.ReloadData(); }
void GetData() { var apiTask = new ServiceApi().GetAthletesForTeam(TeamId); apiTask.HandleError(LoadingScreen); apiTask.OnSucess(response => { source = new CustomListSource <AthleteItem>(response.Result, GetCell, (tableView, indexPath) => 70); source.NoContentText = "No Athletes"; tvAthletes.Source = source; tvAthletes.ReloadData(); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); var apiTask = new ServiceApi().GetSportRankings(SportId); apiTask.HandleError(LoadingScreen); apiTask.OnSucess(response => { source = new CustomListSource <Ranking>(response.Result, GetCell, (arg1, arg2) => 70); lblDate.Text = response.Result.FirstOrDefault()?.DateUpdatedUtc.ToLocalTime().ToString("D"); tvRankings.Source = source; tvRankings.ReloadData(); }); }
void GetData() { LoadingScreen.Show(); var apiTask = new ServiceApi().GetEventTeams(EventId); apiTask.HandleError(LoadingScreen); apiTask.OnSucess(response => { LoadingScreen.Hide(); var source = new CustomListSource <EventTeam>(response.Result, GetCell, (arg1, arg2) => 70); tvTeams.Source = source; lblCount.Text = response.Result.Count.ToString(); tvTeams.ReloadData(); }); }
void GetData() { var apiTask = new ServiceApi().GetLikes(PostId); apiTask.HandleError(); apiTask.OnSucess(response => { var source = new CustomListSource <PostLike> (response.Result, GetCell, (arg1, arg2) => 55); source.NoContentText = "No Likes"; tvLikes.Source = source; Count = response.Result.Count; tvLikes.ReloadData(); UpdateParent?.Invoke(Name, Count); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); var source = new CustomListSource <object> (values, getCell, (tv, ip) => 50); source.ItemClick += (sender, e) => { if (ItemClick != null) { ItemClick(this, e); } if (ClickShouldHide) { Hide(); } }; tvList.Source = source; var tap = new UITapGestureRecognizer((gesture) => { Hide(); }) { CancelsTouchesInView = false }; tap.ShouldReceiveTouch += (UIGestureRecognizer recognizer, UITouch touch) => { if (touch.View != View && touch.View != tvList && touch.View.Superview.GetType().BaseType != typeof(UITableViewCell)) { return(true); } return(false); }; View.Layer.ShadowColor = UIColor.Black.CGColor; View.Layer.ShadowOpacity = .75f; View.Layer.ShadowRadius = 4; View.Layer.ShadowOffset = new CGSize(0, 5); View.BackgroundColor = UIColor.Clear; tvList.BackgroundColor = UIColor.White; tvList.SeparatorStyle = UITableViewCellSeparatorStyle.None; (UIApplication.SharedApplication.Delegate as AppDelegate).Window.AddGestureRecognizer(tap); // Perform any additional setup after loading the view, typically from a nib. }
void GetData() { if (string.IsNullOrEmpty(txtSearch.Text)) { var source = tvTeams.Source as CustomListSource <AthleteTeam>; source.Items = new List <AthleteTeam>(); source.NoContentEnabled = false; tvTeams.ReloadData(); } else { var apiTask = new ServiceApi().GetAthleteTeams(txtSearch.Text); apiTask.HandleError(LoadingScreen); apiTask.OnSucess(response => { if (response.Result.SearchText == txtSearch.Text) { if (tvTeams.Source == null) { var source = new CustomListSource <AthleteTeam> (response.Result.AthleteTeams, GetCell, (tv, ip) => 60); source.NoContentText = "No Teams Found"; source.ItemClick += (sender, e) => { var controller = Storyboard.InstantiateViewController <OnboardingAthleteSeasonViewController> (); controller.IsEdit = IsEdit; controller.AthleteTeam = e; controller.ImageFilePath = ImageFilePath; NavigationController.PushViewController(controller, true); }; tvTeams.Source = source; tvTeams.ReloadData(); } else { var source = tvTeams.Source as CustomListSource <AthleteTeam>; source.Items = response.Result.AthleteTeams; source.NoContentEnabled = true; tvTeams.ReloadData(); } } }); } }
void GetData() { LoadingScreen.Show(); var apiTask = new ServiceApi().Followers(Id, Type); apiTask.HandleError(LoadingScreen); apiTask.OnSucess((response) => { LoadingScreen.Hide(); lblCount.Text = response.Result.Count.ToString(); source = new CustomListSource <Follower>(response.Result, GetCell, (arg1, arg2) => 60); source.ItemClick += (sender, e) => { Fanword.iOS.Shared.Navigator.GoToUserProfile(NavigationController, e.Id); }; tvFollowers.Source = source; tvFollowers.ReloadData(); }); }
void SharedInitialize() { user = CrossSettings.Current.GetValueOrDefaultJson <User>("User"); var model = new List <FeedItem> (); if (view != null) { model.Add(new FeedItem()); } source = new CustomListSource <FeedItem> (model, GetCell, (tv, ip) => AutomaticDimension); //source.NoContentEnabled = false; source.NoContentText = "No content yet. Try following some profiles."; Source = source; ReloadData(); EstimatedRowHeight = 231; RowHeight = AutomaticDimension; source.OnScroll += (sender, e) => OnScroll(e); GetNewsFeedData(true); }
void GetData() { var apiTask = new ServiceApi().GetNotifcations(); apiTask.HandleError(); apiTask.OnSucess((response) => { source = new CustomListSource <UserNotification>(response.Result, GetCell, (arg1, arg2) => UITableView.AutomaticDimension); source.ItemClick += (sender, e) => { Navigator.HandleNotificationTap(NavigationController, e.MetaData, e.Title, e.Message); }; tvNotifications.Source = source; tvNotifications.ReloadData(); refreshControl.EndRefreshing(); var apiTask2 = new ServiceApi().MarkNotificationsAsRead(); apiTask2.HandleError(); }); }
void GetData() { var apiTask = new ServiceApi().GetAthletesForSchool(SchoolId); apiTask.HandleError(LoadingScreen); apiTask.OnSucess(response => { source = new CustomListSource <AthleteItem>(response.Result, GetCell, (tableView, indexPath) => 70); source.NoContentText = "No Athletes"; }); var apiTask2 = new ServiceApi().GetTeamsForSchool(SchoolId); apiTask2.HandleError(LoadingScreen); apiTask2.OnSucess(response => { teamProfileSource = new CustomListSource <TeamProfile>(response.Result, GetCell, (tableView, indexPath) => 70); teamProfileSource.NoContentText = "No Teams"; tvTable.Source = teamProfileSource; tvTable.ReloadData(); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); tvMenu.EstimatedRowHeight = 50; var source = new CustomListSource <MenuItem>(MenuItem.GetMenuItems(), GetCell, (arg1, arg2) => UITableView.AutomaticDimension); tvMenu.Source = source; source.ItemClick += (sender, args) => { if (!string.IsNullOrEmpty(args.Id)) { MenuItemClick?.Invoke(args.Id); } }; UpdateProfile(); lblFollowers.Superview.AddGestureRecognizer(new UITapGestureRecognizer(() => { var controller = Storyboard.InstantiateViewController <FavoritesViewController>(); controller.Page = "Users"; controller.SubPage = "Followers"; NavigationController.PushViewController(controller, true); })); lblFollowing.Superview.AddGestureRecognizer(new UITapGestureRecognizer(() => { var controller = Storyboard.InstantiateViewController <FavoritesViewController>(); //controller.Page = "Users"; NavigationController.PushViewController(controller, true); })); lblPosts.Superview.AddGestureRecognizer(new UITapGestureRecognizer(() => { var controller = Storyboard.InstantiateViewController <MyProfileViewController>(); NavigationController.PushViewController(controller, true); })); }
void GetData() { var apiTask = new ServiceApi().GetComments(PostId); apiTask.HandleError(); apiTask.OnSucess(response => { source = new CustomListSource <Comment> (response.Result, GetCell, (arg1, arg2) => UITableView.AutomaticDimension); source.Items = CommentsHelper.GetCommentsWithReply(source.AllItems, expandedCommentId); source.NoContentText = "No Comments"; tvComments.Source = source; Count = response.Result.Count; LoadingScreen.Hide(); UpdateParent?.Invoke(Name, Count); tvComments.ReloadData(); if (response.Result.Any()) { tvComments.ScrollToRow(NSIndexPath.FromRowSection(source.Items.Count - 1, 0), UITableViewScrollPosition.Bottom, false); } }); }
public void GetData() { if (aiActivity == null) { return; } var filter = new ScoresFilterModel(); filter.FollowFilter = new FollowingFilterModel(); filter.FollowFilter.MySchools = mySchools; filter.FollowFilter.MySports = mySports; filter.FollowFilter.MyTeams = myTeams; filter.DateFilter = dateFilter; filter.SchoolId = SchoolId; filter.TeamId = TeamId; filter.SportId = SportId; filter.Today = DateTime.Now; aiActivity.Hidden = false; aiActivity.StartAnimating(); var apiTask = new ServiceApi().GetScores(filter); apiTask.HandleError(); apiTask.OnSucess(response => { if (tvScores.Source == null) { List <ScoreModel> items = ScoresMethod(response.Result); source = new CustomListSource <ScoreModel>(items, GetCell, (arg1, arg2) => UITableView.AutomaticDimension); source.NoContentText = "No Scores"; source.ItemClick += (sender, e) => { if (!string.IsNullOrEmpty(e.EventId)) { Navigator.GoToEventProfile(NavigationController, e.EventId); } }; tvScores.Source = source; tvScores.ReloadData(); } else { if (ScoreChanged != null) { ScoreChanged.Invoke(response.Result); } //source.Items = response.Result; //tvScores.ReloadData (); } aiActivity.Hidden = true; }); ScoresViewController.ScoreChanged += (List <ScoreModel> obj) => { List <ScoreModel> TempList = new List <ScoreModel>(); TempList.Clear(); foreach (var item in obj) { DateTime eventDate = ConvertToUTC(item.EventDate, item.TimezoneId); TempList.Add(new ScoreModel() { EventDate = eventDate, EventId = item.EventId, EventName = item.EventName, IsTbd = item.IsTbd, PostCount = item.PostCount, ShowTicketUrl = item.ShowTicketUrl, SportName = item.SportName, SportProfileUrl = item.SportProfileUrl, Team1Name = item.Team1Name, Team1Score = item.Team1Score, Team1Url = item.Team1Url, Team2Name = item.Team2Name, Team2Score = item.Team2Score, Team2Url = item.Team2Url, TeamCount = item.TeamCount, TicketUrl = item.TicketUrl, TimezoneId = item.TimezoneId }); } var grouped = TempList.GroupBy(m => m.EventDate.ToString("D")); var items = new List <ScoreModel>(); foreach (var group in grouped) { items.Add(new ScoreModel() { EventDate = Convert.ToDateTime(group.Key), TeamCount = group.Count() }); items.AddRange(group); } source.Items = items; tvScores.ReloadData(); }; }
public override void ViewDidLoad() { base.ViewDidLoad(); btnBack.TouchUpInside += (sender, e) => { NavigationController.PopViewController(true); }; source = new CustomListSource <Profile>(new List <Profile>(), GetCell, (arg1, arg2) => 70); source.ItemClick += (sender, e) => { if (result.TeamProfiles.Any(m => m.Id == e.Id)) { if (Post.Teams.Contains((e.Id))) { Post.Teams.Remove(e.Id); } else { Post.Teams.Add(e.Id); } } else if (result.SchoolProfiles.Any(m => m.Id == e.Id)) { if (Post.Schools.Contains((e.Id))) { Post.Schools.Remove(e.Id); } else { Post.Schools.Add(e.Id); } } else if (result.SportProfile.Any(m => m.Id == e.Id)) { if (Post.Sports.Contains((e.Id))) { Post.Sports.Remove(e.Id); } else { Post.Sports.Add(e.Id); } } tvProfiles.ReloadData(); }; tvProfiles.Source = source; txtSearch.EditingChanged += (sender, e) => { GetData(); }; btnNext.TouchUpInside += (sender, e) => { var controller = Storyboard.InstantiateViewController <TagEventsViewController>(); controller.Post = Post; NavigationController.PushViewController(controller, true); }; LoadingScreen.Show(); GetData(); }
public override void ViewDidLoad() { base.ViewDidLoad(); btnBack.TouchUpInside += (sender, e) => NavigationController.PopViewController(true); lblSportName.Text = AthleteTeam.SportName; lblSchoolName.Text = AthleteTeam.SchoolName; ImageService.Instance.LoadUrl(AthleteTeam.ProfilePublicUrl).Into(imgProfile); btnDone.Enabled = false; List <int> years = Enumerable.Range(DateTime.Now.Year - 65, 66).OrderByDescending(m => m).ToList(); List <int> years2 = years.ToList(); years2.Insert(0, -1); var fromSource = new CustomListSource <int> (years, GetCell, (arg1, arg2) => 40); fromSource.ItemClick += (sender, e) => { tvFrom.Hidden = true; if (tvUntil.Hidden) { vwDivider.Hidden = true; } btnFrom.SetTitle(e.ToString(), UIControlState.Normal); FromDate = new DateTime((int)e, 1, 1); CheckIfDone(); }; tvFrom.Source = fromSource; var untilSource = new CustomListSource <int> (years2, GetCell, (arg1, arg2) => 40); untilSource.ItemClick += (sender, e) => { tvUntil.Hidden = true; if (tvFrom.Hidden) { vwDivider.Hidden = true; } UntilDateChosen = true; if ((int)e == -1) { UntilDate = null; btnUntil.SetTitle("Still competing", UIControlState.Normal); } else { btnUntil.SetTitle(e.ToString(), UIControlState.Normal); UntilDate = new DateTime((int)e, 1, 1); } CheckIfDone(); }; tvUntil.Source = untilSource; tvFrom.Hidden = true; vwDivider.Hidden = true; tvUntil.Hidden = true; btnUntil.TouchUpInside += (sender, e) => { tvUntil.Hidden = false; vwDivider.Hidden = false; }; btnFrom.TouchUpInside += (sender, e) => { tvFrom.Hidden = false; vwDivider.Hidden = false; }; btnDone.TouchUpInside += async(sender, e) => { LoadingScreen.Show(); var error = await new ServiceApi().SaveAthleteUser(ImageFilePath, FromDate.Value, UntilDate, AthleteTeam.Id); LoadingScreen.Hide(); if (error.DisplayErrorMessage()) { return; } if (IsEdit) { NavigationController.PopToViewController(NavigationController.ViewControllers.FirstOrDefault(m => m is StudentAthleteInfoViewController), true); } else { var controller = Storyboard.InstantiateViewController <MainViewController>(); NavigationController.PushViewController(controller, true); } }; btnTrash.TouchUpInside += (sender, e) => NavigationController.PopViewController(true); }
public override void ViewDidLoad() { base.ViewDidLoad(); ShowHelpIfNecessary(TutorialHelper.TagEvents); btnBack.TouchUpInside += (sender, e) => NavigationController.PopViewController(true); var times = new List <DateTime>(); currentTime = DateTime.Now.Date.ToUniversalTime(); var startTime = DateTime.Now.Date.ToUniversalTime().AddDays(-2); for (int i = 0; i < 5; i++) { times.Add(startTime.AddDays(i)); } var layout = cvDates.CollectionViewLayout as UICollectionViewFlowLayout; layout.ItemSize = new CoreGraphics.CGSize(UIScreen.MainScreen.Bounds.Width / 5, cvDates.Frame.Height); daysSource = new CustomCollectionSource <DateTime>(times, GetCollectionCell); daysSource.ItemClick += (sender, e) => { currentTime = e; cvDates.ReloadData(); GetData(); }; cvDates.Source = daysSource; tvEvents.EstimatedRowHeight = 100; tvEvents.RowHeight = UITableView.AutomaticDimension; eventsSource = new CustomListSource <EventProfile>(new List <EventProfile>(), GetCell, (arg1, arg2) => UITableView.AutomaticDimension); eventsSource.NoContentText = "No Events"; eventsSource.ItemClick += (sender, e) => { if (Post.Events.Contains((e.Id))) { Post.Events.Remove(e.Id); } else { Post.Events.Add(e.Id); } tvEvents.ReloadData(); }; tvEvents.Source = eventsSource; GetData(); btnPost.TouchUpInside += (sender, e) => { if (Post.Videos.Any(m => string.IsNullOrEmpty(m.Id))) { var controller = UIAlertController.Create("Video Upload", "You video will be uploaded in the background and the post will be made visible once the upload is complete", UIAlertControllerStyle.Alert); controller.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, (obj) => { SavePost(); })); PresentViewController(controller, true, null); } else { SavePost(); } }; if (!string.IsNullOrEmpty(Post.Id)) { btnShare.Hidden = true; } btnShare.TouchUpInside += (sender, e) => { UIActionSheet sheet = new UIActionSheet("Share On"); if (Post.Images.Any() || Post.Links.Any() || Post.Videos.Any()) { sheet.AddButton("Facebook"); } sheet.AddButton("Other"); sheet.AddButton("Cancel"); sheet.Clicked += async(sender2, e2) => { nint index = e2.ButtonIndex; if (!Post.Images.Any() && !Post.Links.Any() && !Post.Videos.Any()) { index++; } if (index == 0) { await Sharer.ShareFacebook(this, Post); Post.IsShared = true; } else if (index == 1) { await Sharer.ShareOther(this, Post, () => { Post.IsShared = true; }); } }; sheet.ShowInView(View); }; }