public SessionDetailPage(SessionDetailViewModel context) { InitializeComponent(); BindingContext = context; }
protected override void Act() { _sut = new SessionDetailViewModel(5); }
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { var settingsService = ServiceLocator.Current.GetInstance <ISettingsService> (); var schedulesService = ServiceLocator.Current.GetInstance <ISchedulesService> (); if (userActivity.ActivityType == CSSearchableItem.ActionType) { var tabController = this.Window.RootViewController as UITabBarController; var navController = tabController.ViewControllers [0] as UINavigationController; var identifier = userActivity?.UserInfo?.ObjectForKey(CSSearchableItem.ActivityIdentifier); if (identifier != null && identifier.ToString().Contains("|\\/|")) { // This is a session or a speaker var parts = identifier.ToString().Split(new [] { "|\\/|" }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length == 2) { //This is a session var conferenceSlug = parts [0]; var sessionSlug = parts [1]; var conferencesViewModel = Application.Locator.Conferences; var task = Task.Run(async() => { await conferencesViewModel.LoadConferences(Priority.Explicit); }); task.Wait(); var conference = conferencesViewModel.Conferences.Single(c => c.Slug == conferenceSlug); var session = conference.Sessions.Single(s => s.Slug == sessionSlug); var conferenceVm = new ConferenceDetailViewModel(conference, schedulesService, settingsService); var sessionVm = new SessionDetailViewModel(session, conference.Name); Application.Locator.Conference = conferenceVm; Application.Locator.Session = sessionVm; var storyboard = UIStoryboard.FromName("Main", null); var conferencesViewController = storyboard.InstantiateViewController("ConferencesViewController") as ConferencesViewController; var conferenceDetailViewController = storyboard.InstantiateViewController("ConferenceDetailViewController") as ConferenceDetailViewController; var sessionsViewController = storyboard.InstantiateViewController("SessionsViewController") as SessionsViewController; var sessionDetailViewController = storyboard.InstantiateViewController("SessionDetailViewController"); navController.SetViewControllers(new UIViewController[] { conferencesViewController, conferenceDetailViewController, sessionsViewController, sessionDetailViewController }, animated: false); } else if (parts.Length == 3) { //This is a speaker var conferenceSlug = parts [0]; var sessionSlug = parts [1]; var speakerSlug = parts [2]; var conferencesViewModel = Application.Locator.Conferences; var task = Task.Run(async() => { await conferencesViewModel.LoadConferences(Priority.Explicit); }); task.Wait(); var conference = conferencesViewModel.Conferences.Single(c => c.Slug == conferenceSlug); var session = conference.Sessions.Single(s => s.Slug == sessionSlug); var speaker = session.Speakers.Single(s => s.Slug == speakerSlug); var conferenceVm = new ConferenceDetailViewModel(conference, schedulesService, settingsService); var sessionVm = new SessionDetailViewModel(session, conference.Name); var speakerVm = new SpeakerDetailViewModel(session, speaker); Application.Locator.Conference = conferenceVm; Application.Locator.Session = sessionVm; Application.Locator.Speaker = speakerVm; var storyboard = UIStoryboard.FromName("Main", null); var conferencesViewController = storyboard.InstantiateViewController("ConferencesViewController") as ConferencesViewController; var conferenceDetailViewController = storyboard.InstantiateViewController("ConferenceDetailViewController") as ConferenceDetailViewController; var sessionsViewController = storyboard.InstantiateViewController("SessionsViewController") as SessionsViewController; var sessionDetailViewController = storyboard.InstantiateViewController("SessionDetailViewController"); var speakerDetailViewController = storyboard.InstantiateViewController("SpeakerDetailViewController"); navController.SetViewControllers(new UIViewController[] { conferencesViewController, conferenceDetailViewController, sessionsViewController, sessionDetailViewController, speakerDetailViewController }, animated: false); } } else { // This is a conference var conferenceSlug = identifier.ToString(); var conferencesViewModel = Application.Locator.Conferences; var task = Task.Run(async() => { await conferencesViewModel.LoadConferences(Priority.Explicit); }); task.Wait(); var conference = conferencesViewModel.Conferences.Single(c => c.Slug == conferenceSlug); var vm = new ConferenceDetailViewModel(conference, schedulesService, settingsService); Application.Locator.Conference = vm; var storyboard = UIStoryboard.FromName("Main", null); var conferenceDetailViewController = storyboard.InstantiateViewController("ConferenceDetailViewController") as ConferenceDetailViewController; ; navController.SetViewControllers(new UIViewController[] { conferenceDetailViewController }, animated: false); } } return(true); }
protected override void Act() { _sut = new SessionDetailViewModel(5); }