// for index public TableViewSource(SpeakersViewController controller, List<MonkeySpace.Core.Speaker> speakers) { svc = controller; var newSpeakers = from nonempty in speakers where !(String.IsNullOrEmpty (nonempty.Bio) && nonempty.Sessions.Count == 0) select nonempty; speakers = newSpeakers.ToList (); // apologies in advance for this dodgy linq/loop - could do better...[CD] sectionTitles = (from c in speakers select c.Name.Substring (0, 1)).Distinct ().ToList (); // sort the list alphabetically sectionTitles.Sort (); // add each element to the List<Element> according to the letter it starts with // in the SortedDictionary<int, List<Element>> foreach (var element in speakers) { // sectionNum a=1, b=2, c=3, etc int sectionNum = sectionTitles.IndexOf (element.Name.Substring (0, 1)); if (sectionElements.ContainsKey (sectionNum)) { // SortedDictionary already contains a List<Element> for that letter sectionElements[sectionNum].Add (element); } else { // first time that letter has appeared, create new List<Element> in the SortedDictionary sectionElements.Add (sectionNum, new List<MonkeySpace.Core.Speaker> { element }); } } }
// for index public TableViewSource(SpeakersViewController controller, List <MonkeySpace.Core.Speaker> speakers) { svc = controller; var newSpeakers = from nonempty in speakers where !(String.IsNullOrEmpty(nonempty.Bio) && nonempty.Sessions.Count == 0) select nonempty; speakers = newSpeakers.ToList(); // apologies in advance for this dodgy linq/loop - could do better...[CD] sectionTitles = (from c in speakers select c.Name.Substring(0, 1)).Distinct().ToList(); // sort the list alphabetically sectionTitles.Sort(); // add each element to the List<Element> according to the letter it starts with // in the SortedDictionary<int, List<Element>> foreach (var element in speakers) { // sectionNum a=1, b=2, c=3, etc int sectionNum = sectionTitles.IndexOf(element.Name.Substring(0, 1)); if (sectionElements.ContainsKey(sectionNum)) { // SortedDictionary already contains a List<Element> for that letter sectionElements[sectionNum].Add(element); } else { // first time that letter has appeared, create new List<Element> in the SortedDictionary sectionElements.Add(sectionNum, new List <MonkeySpace.Core.Speaker> { element }); } } }
/// <summary> /// Create the ViewControllers that we are going to use for the tabs: /// Sessions, Speakers /// </summary> /// <remarks> /// Some icons from glyphish.com -- CCA so DON'T FORGET attribution on the website!! /// </remarks> public override void ViewDidLoad() { base.ViewDidLoad (); var dvc = new HomeViewController (); navScheduleController = new MonoTouch.UIKit.UINavigationController(); navScheduleController.PushViewController(dvc, false); navScheduleController.NavigationBar.BarStyle = UIBarStyle.Black; navScheduleController.TopViewController.Title ="What's on"; navScheduleController.TabBarItem = new UITabBarItem("What's on", UIImage.FromFile("Images/83-calendar.png"), 0); var svc = new SpeakersViewController(); navSpeakerController = new MonoTouch.UIKit.UINavigationController(); navSpeakerController.PushViewController(svc, false); navSpeakerController.TopViewController.View.BackgroundColor = new UIColor(65.0f,169.0f,198.0f,255.0f); navSpeakerController.NavigationBar.BarStyle = UIBarStyle.Black; navSpeakerController.TopViewController.Title ="Speakers"; navSpeakerController.TabBarItem = new UITabBarItem("Speakers", UIImage.FromFile("Images/tabspeaker.png"), 1); var ssvc = new TagsViewController(); navSessionController = new MonoTouch.UIKit.UINavigationController(); navSessionController.PushViewController(ssvc, false); navSessionController.NavigationBar.BarStyle = UIBarStyle.Black; navSessionController.TopViewController.Title ="Sessions"; navSessionController.TabBarItem = new UITabBarItem("Sessions", UIImage.FromFile("Images/124-bullhorn.png"), 2); var mvc = new MapFlipViewController(); mvc.Title = "Map"; mvc.TabBarItem = new UITabBarItem("Map", UIImage.FromFile("Images/103-map.png"), 5); var fvc = new FavoritesViewController(); navFavoritesController = new MonoTouch.UIKit.UINavigationController(); navFavoritesController.PushViewController(fvc, false); navFavoritesController.NavigationBar.BarStyle = UIBarStyle.Black; navFavoritesController.TopViewController.Title ="My Schedule"; navFavoritesController.TabBarItem = new UITabBarItem("My Schedule", UIImage.FromFile("Images/28-star.png"), 7); var u = new UIViewController[] { navScheduleController , navSpeakerController , navSessionController , mvc , navFavoritesController }; SelectedIndex = 0; ViewControllers = u; MoreNavigationController.NavigationBar.BarStyle = UIBarStyle.Black; var backgroundColor = UIColor.FromPatternImage(UIImage.FromFile("Background.png")); MoreNavigationController.View.BackgroundColor = backgroundColor; CustomizableViewControllers = new UIViewController[]{}; }
/// <summary> /// Create the ViewControllers that we are going to use for the tabs: /// Sessions, Speakers /// </summary> /// <remarks> /// Some icons from glyphish.com -- CCA so DON'T FORGET attribution on the website!! /// </remarks> public override void ViewDidLoad() { base.ViewDidLoad(); var dvc = new HomeViewController(); navScheduleController = new MonoTouch.UIKit.UINavigationController(); navScheduleController.PushViewController(dvc, false); navScheduleController.NavigationBar.BarStyle = UIBarStyle.Black; navScheduleController.NavigationBar.TintColor = HeaderColor; navScheduleController.TopViewController.Title = "What's on"; navScheduleController.TabBarItem = new UITabBarItem("What's on", UIImage.FromFile("Images/83-calendar.png"), 0); var svc = new SpeakersViewController(); navSpeakerController = new MonoTouch.UIKit.UINavigationController(); navSpeakerController.PushViewController(svc, false); navSpeakerController.TopViewController.View.BackgroundColor = new UIColor(65.0f, 169.0f, 198.0f, 255.0f); navSpeakerController.NavigationBar.BarStyle = UIBarStyle.Black; navSpeakerController.NavigationBar.TintColor = HeaderColor; navSpeakerController.TopViewController.Title = "Speakers"; navSpeakerController.TabBarItem = new UITabBarItem("Speakers", UIImage.FromFile("Images/tabspeaker.png"), 1); var ssvc = new TagsViewController(); navSessionController = new MonoTouch.UIKit.UINavigationController(); navSessionController.PushViewController(ssvc, false); navSessionController.NavigationBar.BarStyle = UIBarStyle.Black; navSessionController.NavigationBar.TintColor = HeaderColor; navSessionController.TopViewController.Title = "Sessions by tag"; navSessionController.TabBarItem = new UITabBarItem("Sessions", UIImage.FromFile("Images/124-bullhorn.png"), 2); var mvc = new MapFlipViewController(); mvc.Title = "Map"; mvc.TabBarItem = new UITabBarItem("Map", UIImage.FromFile("Images/103-map.png"), 5); var fvc = new FavoritesViewController(); navFavoritesController = new MonoTouch.UIKit.UINavigationController(); navFavoritesController.PushViewController(fvc, false); navFavoritesController.NavigationBar.BarStyle = UIBarStyle.Black; navFavoritesController.NavigationBar.TintColor = HeaderColor; navFavoritesController.TopViewController.Title = "My Schedule"; navFavoritesController.TabBarItem = new UITabBarItem("My Schedule", UIImage.FromFile("Images/28-star.png"), 7); var u = new UIViewController[] { navScheduleController , navSpeakerController , navSessionController , mvc , navFavoritesController }; this.SelectedIndex = 0; this.ViewControllers = u; this.MoreNavigationController.NavigationBar.TintColor = HeaderColor; this.MoreNavigationController.NavigationBar.BarStyle = UIBarStyle.Black; var backgroundColor = UIColor.FromPatternImage(UIImage.FromFile("Background.png")); this.MoreNavigationController.View.BackgroundColor = backgroundColor; this.CustomizableViewControllers = new UIViewController[] {}; }
public CustomFlyoutNavigationController() { var dvc = new HomeViewController (); navScheduleController = new MonoTouch.UIKit.UINavigationController(); navScheduleController.PushViewController(dvc, false); navScheduleController.NavigationBar.BarStyle = UIBarStyle.Black; // navScheduleController.TopViewController.Title ="What's on"; // navScheduleController.TabBarItem = new UITabBarItem("What's on", UIImage.FromFile("Images/83-calendar.png"), 0); if (UIDevice.CurrentDevice.CheckSystemVersion (6,0)) { // iOS 6 and above support CollectionView var layout = new UICollectionViewFlowLayout (){ SectionInset = new UIEdgeInsets (0,0,0,0), ItemSize = SpeakerCollectionCell.Size, MinimumInteritemSpacing = 10, MinimumLineSpacing = 5 }; var svc = new SpeakersCollectionViewController (layout); // COLLECTION navSpeakerController = new MonoTouch.UIKit.UINavigationController(); navSpeakerController.PushViewController(svc, false); navSpeakerController.TopViewController.View.BackgroundColor = new UIColor(65.0f,169.0f,198.0f,255.0f); navSpeakerController.NavigationBar.BarStyle = UIBarStyle.Black; navSpeakerController.TopViewController.Title ="Speakers"; } else { // use a table var svc = new SpeakersViewController(); // TABLE navSpeakerController = new MonoTouch.UIKit.UINavigationController(); navSpeakerController.PushViewController (svc, false); navSpeakerController.NavigationBar.BarStyle = UIBarStyle.Black; } var ssvc = new TagsViewController(); navSessionController = new MonoTouch.UIKit.UINavigationController(); navSessionController.PushViewController(ssvc, false); navSessionController.NavigationBar.BarStyle = UIBarStyle.Black; // navSessionController.TopViewController.Title ="Sessions"; // navSessionController.TabBarItem = new UITabBarItem("Sessions", UIImage.FromFile("Images/124-bullhorn.png"), 2); var mapViewController = new MapFlipViewController(); mapViewController.View.BackgroundColor = UIColor.Black; var fvc = new FavoritesViewController(); navFavoritesController = new MonoTouch.UIKit.UINavigationController(); navFavoritesController.PushViewController(fvc, false); // var passbookViewController = new PassKitViewController (); var aboutViewController = new AboutViewController (); //var roomsViewController = new RoomsViewController (); // Create the navigation menu NavigationRoot = new RootElement ("Navigation") { new Section () { new StyledStringElement ("MonkeySpace 2013"){BackgroundColor = UIColor.Clear, TextColor = UIColor.White, Font = AppDelegate.Current.FontFlyoutMenuSection}, new StyledStringElement ("Sessions"){BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu}, new StyledStringElement ("Speakers"){BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu}, new StyledStringElement ("Favorites"){BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu}, //new StyledStringElement ("Room Plan"){BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu}, new StyledStringElement ("Location Map"){BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu}, //new StyledStringElement ("Passbook"){BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu}, new StyledStringElement ("About MonkeySpace"){BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu}, } }; // Supply view controllers corresponding to menu items: ViewControllers = new UIViewController[] { navScheduleController , navSessionController , navSpeakerController , navFavoritesController //, roomsViewController , mapViewController //, passbookViewController , aboutViewController }; if (MonoTouch.PassKit.PKPassLibrary.IsAvailable) { //TODO: only add the passkit screen if necessary } View.BackgroundColor = UIColor.Blue; }
public CustomFlyoutNavigationController() { var dvc = new HomeViewController(); navScheduleController = new MonoTouch.UIKit.UINavigationController(); navScheduleController.PushViewController(dvc, false); navScheduleController.NavigationBar.BarStyle = UIBarStyle.Black; // navScheduleController.TopViewController.Title ="What's on"; // navScheduleController.TabBarItem = new UITabBarItem("What's on", UIImage.FromFile("Images/83-calendar.png"), 0); if (UIDevice.CurrentDevice.CheckSystemVersion(6, 0)) { // iOS 6 and above support CollectionView var layout = new UICollectionViewFlowLayout() { SectionInset = new UIEdgeInsets(0, 0, 0, 0), ItemSize = SpeakerCollectionCell.Size, MinimumInteritemSpacing = 10, MinimumLineSpacing = 5 }; var svc = new SpeakersCollectionViewController(layout); // COLLECTION navSpeakerController = new MonoTouch.UIKit.UINavigationController(); navSpeakerController.PushViewController(svc, false); navSpeakerController.TopViewController.View.BackgroundColor = new UIColor(65.0f, 169.0f, 198.0f, 255.0f); navSpeakerController.NavigationBar.BarStyle = UIBarStyle.Black; navSpeakerController.TopViewController.Title = "Speakers"; } else { // use a table var svc = new SpeakersViewController(); // TABLE navSpeakerController = new MonoTouch.UIKit.UINavigationController(); navSpeakerController.PushViewController(svc, false); navSpeakerController.NavigationBar.BarStyle = UIBarStyle.Black; } var ssvc = new TagsViewController(); navSessionController = new MonoTouch.UIKit.UINavigationController(); navSessionController.PushViewController(ssvc, false); navSessionController.NavigationBar.BarStyle = UIBarStyle.Black; // navSessionController.TopViewController.Title ="Sessions"; // navSessionController.TabBarItem = new UITabBarItem("Sessions", UIImage.FromFile("Images/124-bullhorn.png"), 2); var mapViewController = new MapFlipViewController(); mapViewController.View.BackgroundColor = UIColor.Black; var fvc = new FavoritesViewController(); navFavoritesController = new MonoTouch.UIKit.UINavigationController(); navFavoritesController.PushViewController(fvc, false); // var passbookViewController = new PassKitViewController (); var aboutViewController = new AboutViewController(); //var roomsViewController = new RoomsViewController (); // Create the navigation menu NavigationRoot = new RootElement("Navigation") { new Section() { new StyledStringElement("MonkeySpace 2013") { BackgroundColor = UIColor.Clear, TextColor = UIColor.White, Font = AppDelegate.Current.FontFlyoutMenuSection }, new StyledStringElement("Sessions") { BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu }, new StyledStringElement("Speakers") { BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu }, new StyledStringElement("Favorites") { BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu }, //new StyledStringElement ("Room Plan"){BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu}, new StyledStringElement("Location Map") { BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu }, //new StyledStringElement ("Passbook"){BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu}, new StyledStringElement("About MonkeySpace") { BackgroundColor = UIColor.Clear, TextColor = UIColor.LightGray, Font = AppDelegate.Current.FontFlyoutMenu }, } }; // Supply view controllers corresponding to menu items: ViewControllers = new UIViewController[] { navScheduleController , navSessionController , navSpeakerController , navFavoritesController //, roomsViewController , mapViewController //, passbookViewController , aboutViewController }; if (MonoTouch.PassKit.PKPassLibrary.IsAvailable) { //TODO: only add the passkit screen if necessary } View.BackgroundColor = UIColor.Blue; }