public ProfileImageViewPage(PersonFullWebModel person) { /// ok /// Button buttonOk = new BybButton { Style = (Style)App.Current.Resources["LargeButtonStyle"], Text = "OK" }; buttonOk.Clicked += buttonOk_Clicked; var panelOk = new StackLayout() { Orientation = StackOrientation.Horizontal, //BackgroundColor = Config.ColorDarkGrayBackground, HorizontalOptions = LayoutOptions.Fill, HeightRequest = Config.OkCancelButtonsHeight, Children = { buttonOk, } }; /// Images /// imageLarge = new Image() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; /// content /// Title = person.Name; this.Padding = new Thickness(0); this.BackgroundColor = Config.ColorGrayBackground; var grid = new Grid() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, ColumnSpacing = 0, RowSpacing = 0, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; grid.Children.Add(imageLarge, 0, 0); this.Content = grid; imageLarge.Source = App.ImagesService.GetImageSource(person.Picture, BackgroundEnum.Background1, true); }
public void OpenProfileImageViewPage(PersonFullWebModel person) { if (this.GetOpenedPage(typeof(ProfileImageViewPage)) != null) { return; } ProfileImageViewPage page = new ProfileImageViewPage(person); NavPage.Navigation.PushAsync(page); }
public async Task <PersonFullWebModel> GetPersonByID(int athleteID) { string url = WebApiUrl + "People?athleteID=" + athleteID; try { string json = await this.sendGetRequestAndReceiveResponse(url, true); PersonFullWebModel person = JsonConvert.DeserializeObject <PersonFullWebModel>(json); return(person); } catch (Exception exc) { LastExceptionUrl = url; LastException = exc; return(null); } }
//Switch switchFriendRequest; public SendMessagePage(PersonFullWebModel person) { this.person = person; // ok, cancel Button buttonOk = new BybButton { Style = (Style)App.Current.Resources["LargeButtonStyle"], Text = "Send" }; buttonOk.Clicked += buttonOk_Clicked; Button buttonCancel = new BybButton { Style = (Style)App.Current.Resources["BlackButtonStyle"], Text = "Cancel" }; buttonCancel.Clicked += buttonCancel_Clicked; var panelOkCancel = new StackLayout() { Orientation = StackOrientation.Horizontal, //BackgroundColor = Config.ColorDarkGrayBackground, HorizontalOptions = LayoutOptions.Fill, Padding = new Thickness(0, Config.OkCancelButtonsPadding, 0, Config.OkCancelButtonsPadding), Spacing = 1, HeightRequest = Config.OkCancelButtonsHeight, Children = { buttonCancel, buttonOk, } }; editorNote = new BybEditor() { HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 40 }; switchShareMyEmail = new BybSwitch(); switchShareMyEmail.IsToggled = true; //switchFriendRequest = new Switch(); //switchFriendRequest.IsToggled = person.IsFriend == false && person.IsFriendRequestSent == false; // content Content = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(15), Spacing = 5, Children = { new BybLabel() { Text = "Your message to '" + this.person.Name + "':" }, new Frame { HasShadow = false, BackgroundColor = Config.ColorGrayBackground, Padding = new Thickness(5, 5, 5, 5), Content = editorNote, HeightRequest = 60, HorizontalOptions = LayoutOptions.FillAndExpand, // Padding = new Thickness(0), // HorizontalOptions = LayoutOptions.FillAndExpand, // HeightRequest = 60, // Content = editorNote }, new BybLabel() { Text = "'" + this.person.Name + "' will receive an email with the message and will be able to open your Byb profile from the email.", TextColor = Config.ColorGrayTextOnWhite, }, // new StackLayout // { // Orientation = StackOrientation.Horizontal, // Children = // { // new BybLabel { Text = "Share your email address?", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand }, // this.switchShareMyEmail // } // }, //new BoxView() { VerticalOptions = LayoutOptions.FillAndExpand }, new BoxView() { HeightRequest = 1, VerticalOptions = LayoutOptions.Fill, BackgroundColor = Color.Transparent }, panelOkCancel } }; Padding = new Thickness(0); Title = "Send a Message"; this.BackgroundColor = Config.ColorBackgroundWhite; }
private PersonFullWebModel getFull(int myAthleteID, int athleteID) { var _person = this.getBasic(myAthleteID, db.Athletes.Where(a => a.AthleteID == athleteID)).FirstOrDefault(); if (_person == null) { return(null); } var person = new PersonFullWebModel(); _person.CopyTo(person); var athlete = (from a in db.Athletes.Include("Friendships1").Include("Friendships2").Include("ScoreAs").Include("ScoreBs").Include("Results") where a.AthleteID == athleteID select a).Single(); // added in 01/25/2016: person.IsFriendRequestSentByThisPerson = false; if (person.IsFriend == false) { if (athlete.Friendships1.Where(i => i.Athlete1ID == athleteID && i.FriendshipStatus == (int)FriendshipStatusEnum.Initiated).Count() == 1) { person.IsFriendRequestSentByThisPerson = true; } } // basic stats person.SnookerStats = new SnookerStatsModel(); person.SnookerStats.CountContributions = (from i in athlete.VenueEdits select i.VenueID).Distinct().Count(); person.SnookerStats.CountBests = (from r in athlete.Results where r.OpponentConfirmation != (int)OpponentConfirmationEnum.Declined where r.IsDeleted == false select r).Count(); person.SnookerStats.CountMatches = (from s in athlete.ScoreAs where s.AthleteBConfirmation != (int)OpponentConfirmationEnum.Declined where s.IsDeleted == false select s).Count() + (from s in athlete.ScoreBs where s.AthleteBConfirmation == (int)OpponentConfirmationEnum.Confirmed where s.IsDeleted == false select s).Count(); person.SnookerStats.BestBallCount = (from r in athlete.Results where r.OpponentConfirmation != (int)OpponentConfirmationEnum.Declined where r.IsDeleted == false select r).Max(i => i.Count2) ?? 0; person.SnookerStats.BestPoints = (from r in athlete.Results where r.OpponentConfirmation != (int)OpponentConfirmationEnum.Declined where r.IsDeleted == false select r).Max(i => i.Count) ?? 0; // best frame score //var matchesA = (from i in athlete.ScoreAs // select SnookerMatchScore.FromScore(myAthleteID, i)); //var matchesB = (from i in athlete.ScoreBs // where i.AthleteBConfirmation == (int)OpponentConfirmationEnum.Confirmed // select SnookerMatchScore.FromScore(myAthleteID, i)); List <SnookerMatchScore> matches = new List <SnookerMatchScore>(); matches.AddRange(from i in athlete.ScoreAs where i.IsDeleted == false select SnookerMatchScore.FromScore(myAthleteID, i)); matches.AddRange(from i in athlete.ScoreBs where i.AthleteBConfirmation == (int)OpponentConfirmationEnum.Confirmed where i.IsDeleted == false select SnookerMatchScore.FromScore(myAthleteID, i)); person.SnookerStats.BestFrameScore = (from m in matches from f in m.FrameScores select(int?) f.A).Max() ?? 0; //int maxA = (from m in matchesA // from f in m.FrameScores // select (int?)f.A).Max() ?? 0; //int maxB = (from m in matchesB // from f in m.FrameScores // select (int?)f.B).Max() ?? 0; //person.SnookerStats.BestFrameScore = System.Math.Max(maxA, maxB); // number of venues var venues1 = (from r in athlete.Results where r.OpponentConfirmation != (int)OpponentConfirmationEnum.Declined where r.IsDeleted == false where r.VenueID != null select r.VenueID.Value).Distinct().ToList(); var venues2 = (from s in athlete.ScoreAs where s.AthleteBConfirmation != (int)OpponentConfirmationEnum.Declined where s.IsDeleted == false where s.VenueID != null select s.VenueID.Value).Distinct().ToList(); var venues3 = (from s in athlete.ScoreBs where s.AthleteBConfirmation != (int)OpponentConfirmationEnum.Declined where s.IsDeleted == false where s.VenueID != null select s.VenueID.Value).Distinct().ToList(); List <int> venues = venues1.ToList(); foreach (var i in venues2) { if (venues.Contains(i) == false) { venues.Add(i); } } foreach (var i in venues3) { if (venues.Contains(i) == false) { venues.Add(i); } } person.SnookerStats.CountVenuesPlayed = venues.Count(); // number of opponents var opponents1 = (from r in athlete.Results where r.OpponentAthleteID != null && r.OpponentAthleteID != 0 where r.OpponentConfirmation != (int)OpponentConfirmationEnum.Declined where r.IsDeleted == false select r.OpponentAthleteID.Value).Distinct().ToList(); var opponents2 = (from s in athlete.ScoreAs where s.AthleteBID != 0 where s.AthleteBConfirmation != (int)OpponentConfirmationEnum.Declined where s.IsDeleted == false select s.AthleteBID).Distinct().ToList(); var opponents3 = (from s in athlete.ScoreBs where s.AthleteAID != 0 where s.AthleteBConfirmation != (int)OpponentConfirmationEnum.Declined where s.IsDeleted == false select s.AthleteAID).Distinct().ToList(); List <int> opponents = opponents1.ToList(); foreach (var i in opponents2) { if (opponents.Contains(i) == false) { opponents.Add(i); } } foreach (var i in opponents3) { if (opponents.Contains(i) == false) { opponents.Add(i); } } person.SnookerStats.CountOpponentsPlayed = opponents.Count; return(person); }