// GET: /<controller>/SpeakerDetail?speakerId=
        public IActionResult SpeakerDetail([FromQuery] Guid speakerId)
        {
            var speaker = DataStore.Speakers.FirstOrDefault(s => s.Id == speakerId);

            if (speaker != null)
            {
                var vm = new SpeakerDetailViewModel {
                    Speaker = speaker
                };
                return(View(vm));
            }

            return(NotFound());
        }
Exemplo n.º 2
0
        public SpeakerListViewModel(IParameterViewStackService viewStackService, ISpeakerService speakerService)
        {
            _viewStackService = viewStackService;
            _speakerService   = speakerService;

            Refresh    = ReactiveCommand.CreateFromTask(ExecuteRefresh);
            ItemTapped = ReactiveCommand.Create <SpeakerItemViewModel, Unit>(item =>
            {
                var profile = new SpeakerDetailViewModel(_viewStackService, new SpeakerServiceMock());
                _viewStackService.PushPage(profile, new NavigationParameter {
                    { "Id", item.SpeakerId.ToString() }
                }).Subscribe();
                return(Unit.Default);
            });

            _isRefreshing =
                this.WhenAnyObservable(x => x.Refresh.IsExecuting)
                .ToProperty(this, x => x.IsRefreshing)
                .DisposeWith(Subscriptions);
        }
Exemplo n.º 3
0
        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);
        }
 public SpeakerDetailFragment()
 {
     ViewModel = ServiceLocator.SpeakerDetailViewModel;
 }
 public SpeakerDetailPage(SpeakerDetailViewModel context)
 {
     InitializeComponent();
     BindingContext = context;
 }