public void SetSession (SessionEntity session) { this.Session = session; //this.sessionAbstractLabel = abstractLabel; //_sessionAbstractLabel.Text = session.Abstract; this.sessionDifficultyLabel.Text = session.Difficulty; this.sessionRoomLabel.Text = session.Room; this.sessionSpeakerNameLabel.SetTitle (session.SpeakerName, UIControlState.Normal); if (session.Start == DateTime.MinValue) { this.sessionStartLabel.Text = "No date/time - Please Refresh"; } else { this.sessionStartLabel.Text = session.Start.ToString (); } this.sessionTechnologyLabel.Text = session.Technology; SetImageUrl (); //_sessionTechnologyLabel.Text = GetTechnologyName (session.Technology); this.sessionTitleLabel.Text = session.Title; HLabel titleLabel; if (this.View.Subviews.Count () <= 19) { titleLabel = new HLabel (); } else { titleLabel = (HLabel)this.View.Subviews [19]; } titleLabel.VerticalAlignment = HLabel.VerticalAlignments.Top; titleLabel.Lines = 0; titleLabel.LineBreakMode = UILineBreakMode.WordWrap; titleLabel.Text = this.sessionTitleLabel.Text; titleLabel.Font = this.sessionTitleLabel.Font; titleLabel.Frame = this.sessionTitleLabel.Frame; titleLabel.BackgroundColor = UIColor.Clear; var countBeforeTitle = this.View.Subviews.Count (); if (this.View.Subviews.Count () <= 19) { this.View.AddSubview (titleLabel); } else { this.View.Subviews [19] = titleLabel; } this.sessionTitleLabel.Text = string.Empty; HLabel abstractLabel; if (this.View.Subviews.Count () <= 20) { abstractLabel = new HLabel (); //this.View.AddSubview (abstractLabel); } else { abstractLabel = (HLabel)this.View.Subviews [20]; //abstractLabel = (HLabel)this.View.Subviews[20]; } abstractLabel.VerticalAlignment = HLabel.VerticalAlignments.Top; abstractLabel.Lines = 0; abstractLabel.LineBreakMode = UILineBreakMode.WordWrap; abstractLabel.Text = session.Abstract; abstractLabel.Font = UIFont.FromName ("STHeitiTC-Light", 16); abstractLabel.Frame = this.sessionAbstractLabel.Frame; abstractLabel.BackgroundColor = UIColor.Clear; var countBeforeAbstract = this.View.Subviews.Count (); if (this.View.Subviews.Count () <= 20) { this.View.AddSubview (abstractLabel); } else { this.View.Subviews [20] = abstractLabel; } this.sessionAbstractLabel.Text = string.Empty; this.View.SetNeedsLayout (); this.View.LayoutIfNeeded (); //_sessionTrackLabel.Text = session.Track; SetAddToScheduleLabel (); //AddPopoverButton(null, null, toolbar.Items[0], new UIPopoverController(new TabBarController())); // if (this.popoverController != null) { // this.popoverController.Dismiss (true); // } }
private void SetSpeaker (SpeakerEntity speaker) { Console.WriteLine("SpeakerBioLandscapeViewController.SetSpeaker - 1"); this.speakerNameLabel.Text = speaker.Name; this.speakerBioLabel.Text = " " + speaker.Biography; HLabel bioLabel; if (this.View.Subviews.Count () <= 10) { bioLabel = new HLabel (); } else { bioLabel = (HLabel)this.View.Subviews [10]; } bioLabel.VerticalAlignment = HLabel.VerticalAlignments.Top; bioLabel.Lines = 0; bioLabel.LineBreakMode = UILineBreakMode.WordWrap; if (!string.IsNullOrWhiteSpace (this.speakerBioLabel.Text)) { bioLabel.Text = this.speakerBioLabel.Text; } else { bioLabel.Text = " No information provided."; } bioLabel.Font = UIFont.FromName ("STHeitiTC-Light", 14); bioLabel.Frame = this.speakerBioLabel.Frame; bioLabel.BackgroundColor = UIColor.Clear; this.View.AddSubview (bioLabel); this.speakerBioLabel.Text = string.Empty; if (!string.IsNullOrWhiteSpace (speaker.BlogURL)) { this.speakerBlogImage.Hidden = false; this.speakerBlogButton.SetTitle (speaker.BlogURL, UIControlState.Normal); } else { this.speakerBlogImage.Hidden = true; this.speakerBlogButton.SetTitle (string.Empty, UIControlState.Normal); } if (!string.IsNullOrWhiteSpace (speaker.TwitterHandle)) { this.speakerTwitterImage.Hidden = false; this.speakerTwitterHandleButton.SetTitle (speaker.TwitterHandle, UIControlState.Normal); } else { this.speakerTwitterImage.Hidden = true; this.speakerTwitterHandleButton.SetTitle (string.Empty, UIControlState.Normal); } var sessions = GetSessionsForSpeaker (speaker); this.speakerSessionsTable.BackgroundColor = UIColor.Clear; this.speakerSessionsTable.ScrollEnabled = false; this.speakerSessionsTable.Delegate = new SpeakerBioLandscapeDelegate (this, sessions); this.speakerSessionsTable.DataSource = new SpeakerBioLandscapeDataSource (sessions); this.speakerSessionsTable.ReloadData (); if (!string.IsNullOrEmpty (speaker.TwitterHandle)) { var profileImage = "images/Profiles/" + speaker.TwitterHandle.Replace ("@", "") + ".png"; if (File.Exists (profileImage)) { UIImage image = UIImage.FromFile (profileImage); using (this.speakerProfileImage.Image) { image = Extensions.RemoveSharpEdges (image, Convert.ToInt32 (image.Size.Width), 4); this.speakerProfileImage.Image = image; } } } else if (File.Exists ("images/Profiles/" + speaker.Name.Replace (" ", "") + ".png")) { var profileImage = "images/Profiles/" + speaker.Name.Replace (" ", "") + ".png"; UIImage image = UIImage.FromFile (profileImage); using (this.speakerProfileImage.Image) { image = Extensions.RemoveSharpEdges (image, Convert.ToInt32 (image.Size.Width), 4); this.speakerProfileImage.Image = image; } } else { //var profileImage = "images/[email protected]"; var profileImage = "images/Profiles/DefaultUser.png"; UIImage image = UIImage.FromFile (profileImage); using (this.speakerProfileImage.Image) { image = Extensions.RemoveSharpEdges (image, Convert.ToInt32 (image.Size.Width), 4); this.speakerProfileImage.Image = image; } } }