protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.ExhibitorDetailsScreen);

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

            if (id >= 0) {
                exhibitor = BL.Managers.ExhibitorManager.GetExhibitor(id);
                if (exhibitor != null) {
                    FindViewById<TextView>(Resource.Id.NameTextView).Text = exhibitor.Name;
                    FindViewById<TextView>(Resource.Id.CountryTextView).Text = exhibitor.FormattedCityCountry;
                    FindViewById<TextView>(Resource.Id.LocationTextView).Text = exhibitor.Locations;
                    if (!String.IsNullOrEmpty(exhibitor.Overview))
                        FindViewById<TextView>(Resource.Id.DescriptionTextView).Text = exhibitor.Overview;
                    else
                        FindViewById<TextView>(Resource.Id.DescriptionTextView).Text = "No background information available.";
                    // now do the image
                    imageview = FindViewById<ImageView>(Resource.Id.ExhibitorImageView);
                    var uri = new Uri(exhibitor.ImageUrl);
                    Console.WriteLine("speaker.ImageUrl " + exhibitor.ImageUrl);
                    try {
                        var drawable = MonoTouch.Dialog.Utilities.ImageLoader.DefaultRequestImage(uri, this);
                        if (drawable != null)
                            imageview.SetImageDrawable(drawable);
                    } catch (Exception ex) {
                        Console.WriteLine(ex.ToString());
                    }
                } else {   // shouldn't happen...
                    FindViewById<TextView>(Resource.Id.NameTextView).Text = "Exhibitor not found: " + id;
                }
            }
        }
		public override void ViewWillAppear (bool animated)
		{
			base.ViewWillAppear (animated);
			exhibitor = BL.Managers.ExhibitorManager.GetExhibitor (exhibitorId);
			// 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 :-(
			LayoutSubviews();
			if (exhibitor != null) {
				Update ();
			}
		}
        public void Update (Exhibitor exhibitor)
        {
            ID = exhibitor.ID;
            Name = exhibitor.Name;
            City = exhibitor.City;
            Country = exhibitor.Country;
            Locations = exhibitor.Locations;
            IsFeatured = exhibitor.IsFeatured;
            Overview = CleanupPlainTextDocument (exhibitor.Overview);
            Tags = exhibitor.Tags;
            Email = exhibitor.Email;
            Address = exhibitor.Address;
            Phone = exhibitor.Phone;
            Fax = exhibitor.Fax;
            ImageUrl = exhibitor.ImageUrl;

            if (string.IsNullOrWhiteSpace (Overview)) {
                Overview = "No background information available.";
            }
        }
Exemple #4
0
		public static int SaveExhibitor (Exhibitor item)
		{
			return DL.MwcDatabase.SaveItem<Exhibitor> (item);
		}
		private static List<Exhibitor> ParseExhibitors(HtmlAgilityPack.HtmlNodeCollection nodes, bool isFeatured)
		{
			List<Exhibitor> exhibitors = new List<Exhibitor>();
			foreach(HtmlAgilityPack.HtmlNode node in nodes)
			{
				Exhibitor exhibitor = new Exhibitor();
				exhibitor.DetailUrl = node.SelectSingleNode("div[2]/h3/a").Attributes["href"].Value;
				exhibitor.Name = node.SelectSingleNode("div[2]/h3/a").InnerText.Trim();
				exhibitor.IsFeatured = isFeatured;

				string[] cityCountry = node.SelectSingleNode("div[2]/div/h4").InnerText.Split(',');
				if(cityCountry.Length >= 2)
				{
					exhibitor.City = cityCountry[0].Trim();
					exhibitor.Country = cityCountry[1].Trim();
				}

				var locationNodes = node.SelectNodes("div[3]/ul/li");
				if(locationNodes != null)
				{
					List<string> locations = new List<string>();

					foreach(var l in locationNodes)
					{ locations.Add(string.Concat("Hall ", l.InnerText)); }

					exhibitor.Locations = string.Join(", ", locations.ToArray());
				}
				exhibitors.Add(exhibitor);
			}
			return exhibitors;
		}