Exemplo n.º 1
0
        /// <summary>
        /// <see cref="MyEvents.Api.Client.ISessionService"/>
        /// </summary>
        /// <param name="session"><see cref="MyEvents.Api.Client.ISessionService"/></param>
        /// <param name="callback"><see cref="MyEvents.Api.Client.ISessionService"/></param>
        /// <returns><see cref="MyEvents.Api.Client.ISessionService"/></returns>
        public IAsyncResult AddSessionAsync(Session session, Action<int> callback)
        {
            string url = String.Format(CultureInfo.InvariantCulture
                , "{0}api/sessions", _urlPrefix);

            return base.DoPost(url, session, callback);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Convert room to event
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            ViewModelLocator loc = (ViewModelLocator)App.Current.Resources["Locator"];

            if (value != null && loc != null)
            {
                string roomNumber = value.ToString().ToLowerInvariant().Replace("room ", "");
                int number = 0;
                int.TryParse(roomNumber, out number);

                if (number != 0)
                {
                    ObservableCollection<Session> Sessions = new ObservableCollection<Session>();
                    for (DateTime i = loc.EventSchedule.Event.StartTime; i < loc.EventSchedule.Event.EndTime; i = i.AddHours(1))
                    {
                        Session session = loc.EventSchedule.Event.Sessions.Where(s => s.RoomNumber == number && s.StartTime >= i && s.StartTime < i.AddHours(1)).FirstOrDefault();
                        if (session == null)
                        {
                            session = new Session() { Duration = 0, RoomNumber = number, StartTime = loc.EventSchedule.Event.StartTime };
                        }
                        Sessions.Add(session);
                    }

                    return Sessions;
                }
            }
            return new ObservableCollection<Session>();
        }
Exemplo n.º 3
0
        private object Convert(ViewModelLocator locator, int number, object parameter)
        {
            var eventDetailViewModel = locator.EventDetail as EventDetailViewModel;

            if (parameter != null && parameter.ToString() == "NoNulls")
            {
                return eventDetailViewModel.Event.Sessions.Where(s => s.RoomNumber == number);
            }
            ObservableCollection<Session> Sessions = new ObservableCollection<Session>();
            for (DateTime i = eventDetailViewModel.Event.StartTime; i < eventDetailViewModel.Event.EndTime; i = i.AddHours(1))
            {
                Session session = eventDetailViewModel.Event.Sessions.Where(s => s.RoomNumber == number && s.StartTime >= i && s.StartTime < i.AddHours(1)).FirstOrDefault();
                if (session == null)
                {
                    session = new Session() { Duration = 0, RoomNumber = number, StartTime = eventDetailViewModel.Event.StartTime };
                }
                Sessions.Add(session);
            }

            return Sessions;
        }
 private void ManageMaterialsExecute(Session selectedSession)
 {
     _navService.NavigateToUploadMaterials(selectedSession);
 }
 private void EditSessionExecute(Session selectedSession)
 {
     _navService.NavigateToEditSessionDetail(selectedSession);
 }
 private void DeleteSessionExecute(Session selectedSession)
 {
     _selectedSession = selectedSession;
     MessageText = LanguageResources.Dialog_delete_session;
     ShowConfirmation = true;
 }
Exemplo n.º 7
0
        /// <summary>
        /// <see cref="MyEvents.Api.Client.ISessionService"/>
        /// </summary>
        /// <param name="session"><see cref="MyEvents.Api.Client.ISessionService"/></param>
        /// <param name="callback"><see cref="MyEvents.Api.Client.ISessionService"/></param>
        /// <returns><see cref="MyEvents.Api.Client.ISessionService"/></returns>
        public IAsyncResult UpdateSessionAsync(Session session, Action<HttpStatusCode> callback)
        {
            string url = String.Format(CultureInfo.InvariantCulture
                , "{0}api/sessions", _urlPrefix);

            return base.DoPut(url, session, callback);
        }
 /// <summary>
 /// Constructor of the VEidSessionDetails view with parameter
 /// </summary>
 /// <param name="sessionToEdit"></param>
 public VEditSessionDetails(Session sessionToEdit)
 {
     InitializeComponent();
     (this.DataContext as EditSessionDetailsViewModel).CurrentSession = sessionToEdit;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Constructor with the session to wich the materials are going to be uploaded
 /// </summary>
 /// <param name="selectedSession"></param>
 public VMaterialUpload(Session selectedSession)
 {
     InitializeComponent();
     this.selectedSession = selectedSession;
     (this.DataContext as UploadMaterialViewModel).CurrentSession = selectedSession;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Navigate from event details page to session details.
 /// </summary>
 public void NavigateToSessionDetails(Session session)
 {
     App.RootFrame.Navigate(typeof(VSessionDetail), session);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Navigate to event details in read only mode
 /// </summary>
 /// <param name="selectedSession"></param>
 public void NavigateToEventDetailsReadOnly(Session selectedSession)
 {
     NavigationController.Instance.NavigateTo(new VEditSessionDetailsReadOnly(selectedSession));
 }
Exemplo n.º 12
0
 /// <summary>
 /// Navigate to a session detail for edition
 /// </summary>
 /// <param name="selectedSession"></param>
 public void NavigateToEditSessionDetail(Session selectedSession)
 {
     NavigationController.Instance.NavigateTo(new VEditSessionDetails(selectedSession));
 }
Exemplo n.º 13
0
 /// <summary>
 /// Navigate to upload materials for the session view
 /// </summary>
 /// <param name="selectedSession"></param>
 public void NavigateToUploadMaterials(Session selectedSession)
 {
     NavigationController.Instance.NavigateTo(new VMaterialUpload(selectedSession));
 }
Exemplo n.º 14
0
 /// <summary>
 /// When selecting an event, navigate to event details.
 /// </summary>
 public void NavigateToSessionDetailsCommandExecute(Session session)
 {
     _navService.NavigateToSessionDetails(session);
 }
Exemplo n.º 15
0
 public void SetToPinCommandExecute(Session session) 
 {
     if (session != SelectedSession)
     {
         SelectedSession = session;  
     }
     else
     {
         SelectedSession = null;                       
     }
 }
Exemplo n.º 16
0
        /// <summary>
        /// Initialize data.
        /// </summary>
        /// <param name="session"></param>
        public void InitializeData(Session session)
        {
            _myEventsService.CommentService.GetAllCommentsAsync(session.SessionId, (commentsResult) =>
            {
                _getCommentCompleted = false;

                if (commentsResult != null)
                {
                    App.RootFrame.Dispatcher.RunAsync(CoreDispatcherPriority.High, new DispatchedHandler(() =>
                    {
                        _session = session;
                        _session.Comments = new ObservableCollection<Comment>(commentsResult);
                        
                        RaisePropertyChanged(() => Session);
                        RaisePropertyChanged(() => CommentCount);                        
                        _getCommentCompleted = true;
                        RaisePropertyChanged(() => IsLoading);

                    })).AsTask().Wait();
                }
            });

            
            _myEventsService.RegisteredUserService.GetAllRegisteredUsersBySessionIdAsync(session.SessionId, (attendeeResult) => 
            {
                _getUsersCompleted = false;

                if (attendeeResult != null)
                {
                    App.RootFrame.Dispatcher.RunAsync(CoreDispatcherPriority.High, new DispatchedHandler(() =>
                    {
                        var sessionUserDetails = attendeeResult.Select(q =>
                            new SessionUserDetailsViewModel
                            {
                                Name = q.Name,
                                Bio = q.Bio,
                                Photo = string.Format("https://graph.facebook.com/{0}/picture", q.FacebookId),
                                Score = q.SessionRegisteredUsers.First(s => s.SessionId == session.SessionId).Score,
                                Rated = q.SessionRegisteredUsers.First(s=> s.SessionId == session.SessionId).Rated
                            }).ToList();

                        _attendees = new ObservableCollection<SessionUserDetailsViewModel>(sessionUserDetails);


                        RaisePropertyChanged(() => Attendees);
                        RaisePropertyChanged(() => AttendeeCount);
                        RaisePropertyChanged(() => SubmittedVotes);
                        RaisePropertyChanged(() => PendingVotes);
                        

                        _getUsersCompleted = true;
                        RaisePropertyChanged(() => IsLoading);

                    })).AsTask().Wait();                    
                }                
            });
        }