Esempio n. 1
0
        public SpeakerCell(UITableViewCellStyle style, NSString ident, Speaker showSpeaker)
            : base(style, ident)
        {
            SelectionStyle = UITableViewCellSelectionStyle.Blue;

            nameLabel = new UILabel () {
                TextAlignment = UITextAlignment.Left,
                Font = bigFont,
                BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
            };
            companyLabel = new UILabel () {
                TextAlignment = UITextAlignment.Left,
                Font = smallFont,
                TextColor = UIColor.DarkGray,
                BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
            };

            image = new UIImageView();

            UpdateCell (showSpeaker);

            ContentView.Add (nameLabel);
            ContentView.Add (companyLabel);
            ContentView.Add (image);
        }
		public void SelectSpeaker(Speaker speaker)
		{
			var sds = new MWC.iOS.Screens.iPhone.Speakers.SpeakerDetailsScreen (speaker.ID);
			sds.ShouldShowSessions = false;
			sds.Title = "Speaker";
			NavigationController.PushViewController(sds, true);
		}
Esempio n. 3
0
 public void Clear()
 {
     showSpeaker = null;
     nameLabel.Text = "";
     titleLabel.Text = "";
     companyLabel.Text = "";
     bioTextView.Text = "";
     image.Image = null;
     LayoutSubviews (); // show the grey 'no speaker' message
 }
		public override void ViewWillAppear (bool animated)
		{
			base.ViewWillAppear (animated);
			speaker = BL.Managers.SpeakerManager.GetSpeaker (speakerId);
			// this shouldn't be null, but it gets that way when the data
			// "shifts" underneath it. need to reload the screen or prevent
			// selection via loading overlay - neither great UIs :-(
			if (speaker != null)  {	
				LayoutSubviews ();
				Update ();
			}
		}
        public void Update(Speaker speaker)
        {
            ID = speaker.ID;
            Key = speaker.Key;
            Name = speaker.Name;
            Title = speaker.Title;
            Company = speaker.Company;
            ImageUrl = speaker.ImageUrl;
            Bio = CleanupPlainTextDocument (speaker.Bio);

            if (string.IsNullOrWhiteSpace (Bio)) {
                Bio = "No biographical information available.";
            }
        }
        public void Update (Speaker speaker, bool summaryOnly)
        {
            ID = speaker.ID;
            Key = speaker.Key;
            Name = speaker.Name;
            Title = speaker.Title;
            Company = speaker.Company;
            ImageUrl = speaker.ImageUrl;
            Bio = CleanupPlainTextDocument (speaker.Bio);
            if (!summaryOnly)
                Sessions = speaker.Sessions.Select(x => new SessionDetailsViewModel(key: x.Key, summaryOnly:"true")).ToList();

            if (string.IsNullOrWhiteSpace (Bio)) {
                Bio = "No biographical information available.";
            }
        }
Esempio n. 7
0
		public void UpdateCell (Speaker speaker)
		{
			nameLabel.Text = speaker.Name;
			string subtitle = "";
			if (String.IsNullOrEmpty (speaker.Title))
				subtitle = String.Format ("{0}", speaker.Company);
			else if (String.IsNullOrEmpty(speaker.Company))
				subtitle = String.Format("{0}", speaker.Title);
			else
				subtitle = String.Format ("{0}, {1}", speaker.Title, speaker.Company);

			companyLabel.Text = subtitle;
			
			if (speaker.ImageUrl != "http://www.mobileworldcongress.com") {
				var u = new Uri(speaker.ImageUrl);
				image.Image = ImageLoader.DefaultRequestImage(u,this);
			}
		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.SpeakerDetailsScreen);

            var id = Intent.GetIntExtra("SpeakerID", -1);

            if (id >= 0) {
                speaker = BL.Managers.SpeakerManager.GetSpeaker(id);
                if (speaker != null) {
                    FindViewById<TextView>(Resource.Id.NameTextView).Text = speaker.Name;
                    FindViewById<TextView>(Resource.Id.PositionTextView).Text = speaker.Title;
                    FindViewById<TextView>(Resource.Id.CompanyTextView).Text = speaker.Company;
                    imageview = FindViewById<ImageView>(Resource.Id.SpeakerImageView);

                    if (!String.IsNullOrEmpty(speaker.Bio)) {
                        FindViewById<TextView>(Resource.Id.Bio).Text = speaker.Bio;
                    } else {
                        var tv = FindViewById<TextView>(Resource.Id.Bio);
                        tv.Text = "no speaker bio available";
                    }
                    if (!string.IsNullOrEmpty (speaker.ImageUrl)) {
                        var uri = new Uri (speaker.ImageUrl);
                        MWCApp.LogDebug ("speaker.ImageUrl " + speaker.ImageUrl);
                        try {
                            var drawable = MonoTouch.Dialog.Utilities.ImageLoader.DefaultRequestImage (uri, this);
                            if (drawable != null) // use it
                                imageview.SetImageDrawable (drawable);
                            else // we're just going to grab it ourselves and not wait for the callback from ImageLoader
                                LoadImageDirectly (uri);

                        } catch (Exception ex) {
                            MWCApp.LogDebug (ex.ToString());
                        }
                    } else
                        imageview.SetImageResource (Resource.Drawable.Icon);

                } else {   // shouldn't happen...
                    FindViewById<TextView>(Resource.Id.TitleTextView).Text = "Speaker not found: " + id;
                }
            }
        }
Esempio n. 9
0
		public static int SaveSpeaker (Speaker item)
		{
			return DL.MwcDatabase.SaveItem<Speaker> (item);
		}
Esempio n. 10
0
		/// <summary>for iPad (SplitViewController)</summary>
		public SpeakerElement (Speaker showSpeaker, MWC.iOS.Screens.iPad.Speakers.SpeakerSplitView speakerSplitView) : base (showSpeaker.Name)
		{
			speaker = showSpeaker;
			splitView = speakerSplitView;
		}
Esempio n. 11
0
		/// <summary>for iPhone</summary>
		public SpeakerElement (Speaker showSpeaker) : base (showSpeaker.Name)
		{
			speaker = showSpeaker;
		}
Esempio n. 12
0
		private static List<Session> GetExtendedSessions(List<Session> sessions)
		{
			foreach(var session in sessions)
			{
				string url = baseUrl + session.DetailUrl;
				string html = WebHelper.HttpGet(url);

				HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
				doc.LoadHtml(html);

				string text = string.Empty;

				var node = doc.DocumentNode.SelectSingleNode("//*[@id=\"page_content_Content4_oModuleEventSessions_5_ctl00_ctl01_divDescription\"]");
				if(node != null)
				{
					var nodes = node.SelectNodes("p");
					if(nodes != null)
					{
						bool wasEmpty = false;
						foreach(var n in nodes)
						{
							string part = HttpUtility.HtmlDecode(n.InnerText.Trim().Replace("\n\t", "\r\n"));
							if(part == "Jointly developed with") { part = ""; }

							if(part.Trim() == string.Empty)
							{
								if(!wasEmpty)
								{
									text += "\r\n";
									wasEmpty = true;
								}
							}
							else
							{
								text += part.Trim() + "\r\n";
								wasEmpty = false;
							}

							//foreach(var item in n.SelectNodes("text()"))
							//{
							//    string part = HttpUtility.HtmlDecode(item.InnerText.Trim().Replace("\n\t", "\r\n"));
							//    text += part + "\r\n";
							//}
						}
					}
				}
				session.Overview = text.Trim();
				session.Overview = session.Overview.Replace("Click here", "Visit the MWC website");

				var speakers = doc.DocumentNode.SelectNodes("//*[@id=\"page_content_Content4_oModuleEventSessions_5_ctl00_ctl02_pnlSpeakers\"]/ul/li");
				if(speakers != null)
				{
					foreach(var s in speakers)
					{
						if(s.InnerText != "No speakers")
						{
							Speaker speaker = new Speaker();
							speaker.Name = HtmlDocHelper.GetInnerText(s, "div[@class='event-list-name']/a");
							speaker.DetailUrl = HtmlDocHelper.GetAttribute(s, "div[@class='event-list-name']/a", "href");
							speaker.Company = HtmlDocHelper.GetInnerText(s, "div[@class='event-list-company']");
							speaker.Title = HtmlDocHelper.GetInnerText(s, "div[@class='event-list-position']");
							session.SpeakerList.Add(speaker);
							session.SpeakerKeys.Add(speaker.Key);
						}
					}
				}
			}
			return sessions;
		}
Esempio n. 13
0
        private static List<Session> GetExtendedSessions(List<Session> sessions)
        {
            foreach(var session in sessions)
            {
                string url = baseUrl + session.DetailUrl;
                string html = WebHelper.HttpGet(url);

                HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
                doc.LoadHtml(html);

                string text = string.Empty;

                var node = doc.DocumentNode.SelectSingleNode("//*[@id=\"page_content_Content4_oModuleEventSessions_5_ctl00_ctl01_divDescription\"]");
                if(node != null)
                {
                    var nodes = node.SelectNodes("p");
                    if(nodes != null)
                    {
                        foreach(var n in nodes)
                        {
                            foreach(var item in n.SelectNodes("text()"))
                            {
                                text += HttpUtility.HtmlDecode(item.InnerText.Trim().Replace("\n", "").Replace("\t", "")) + "\r\n\r\n";
                            }
                        }
                    }
                }
                session.Overview = text.Trim();

                var speakers = doc.DocumentNode.SelectNodes("//*[@id=\"page_content_Content4_oModuleEventSessions_5_ctl00_ctl02_pnlSpeakers\"]/ul/li");
                if(speakers != null)
                {
                    foreach(var s in speakers)
                    {
                        if(s.InnerText != "No speakers")
                        {
                            Speaker speaker = new Speaker();
                            speaker.Name = HtmlDocHelper.GetInnerText(s, "div[@class='event-list-name']/a");
                            speaker.DetailUrl = HtmlDocHelper.GetAttribute(s, "div[@class='event-list-name']/a", "href");
                            speaker.Company = HtmlDocHelper.GetInnerText(s, "div[@class='event-list-company']");
                            speaker.Title = HtmlDocHelper.GetInnerText(s, "div[@class='event-list-position']");
                            session.SpeakerList.Add(speaker);
                            session.SpeakerKeys.Add(speaker.Key);
                        }
                    }
                }
            }
            return sessions;
        }
Esempio n. 14
0
		/// <summary>
		/// When a speaker is selected, show their details (either in splitview or push on NavCtrl)
		/// </summary>
		public void SelectSpeaker(Speaker speaker) 
		{

            throw new NotImplementedException();
		}
Esempio n. 15
0
 // for masterdetail
 public void Update(int speakerID)
 {
     speakerId = speakerID;
     showSpeaker = BL.Managers.SpeakerManager.GetSpeaker (speakerId);
     Update ();
     LayoutSubviews ();
 }
Esempio n. 16
0
		/// <summary>
		/// When a speaker is selected, show their details (either in splitview or push on NavCtrl)
		/// </summary>
		public void SelectSpeaker(Speaker speaker) 
		{
			hostScreen.SelectSpeaker(speaker);
		}