コード例 #1
0
        public SessionDetailPage(Session session)
        {
            InitializeComponent();

            BindingContext = ViewModel = new SessionDetailsViewModel();
            ViewModel.SetData(session);
        }
コード例 #2
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (e.NavigationMode == System.Windows.Navigation.NavigationMode.New)
            {
                var vm      = new SessionDetailsViewModel();
                var session = default(Session);

                if (NavigationContext.QueryString.ContainsKey("id"))
                {
                    var id = int.Parse(NavigationContext.QueryString["id"]);
                    session = SessionManager.GetSession(id);
                }
                else if (NavigationContext.QueryString.ContainsKey("key"))
                {
                    var key = NavigationContext.QueryString["key"];
                    session = SessionManager.GetSessionWithKey(key);
                }

                if (session != null)
                {
                    vm.Update(session);
                }

                UpdateFavoriteButtonIcon(vm.IsFavorite);

                DataContext = vm;
            }
        }
コード例 #3
0
        protected override void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();
            vm = null;

            ListViewSpeakers.HeightRequest = 0;
        }
コード例 #4
0
 public SessionDetailsPage(Session session)
 {
     InitializeComponent();
     viewModel = new SessionDetailsViewModel();
     viewModel.CurrentSession = session;
     BindingContext           = viewModel;
 }
コード例 #5
0
        public SessionDetailsPage(Session session)
        {
            InitializeComponent();

            viewModel = SimpleIoc.Default.GetInstance <SessionDetailsViewModel>();
            viewModel.CurrentSession = session;
            BindingContext           = viewModel;
        }
コード例 #6
0
        private void SessionsBySpeaker_Click(object sender, EventArgs e)
        {
            SessionDetailsViewModel viewModel = ForView.Unwrap <SessionDetailsViewModel>(DataContext);

            if (viewModel != null)
            {
                NavigationService.Navigate(new Uri(String.Format("/Views/SpeakerView.xaml?SpeakerId={0}", Uri.EscapeUriString(viewModel.SpeakerId)), UriKind.Relative));
            }
        }
コード例 #7
0
        private void SessionsByTime_Click(object sender, EventArgs e)
        {
            SessionDetailsViewModel viewModel = ForView.Unwrap <SessionDetailsViewModel>(DataContext);

            if (viewModel != null)
            {
                NavigationService.Navigate(new Uri(viewModel.SearchByTimeUri, UriKind.Relative));
            }
        }
コード例 #8
0
        public SessionDetailsViewModel SessionsDetails(string friendlyBookingId = null)
        {
            var items = _appDbContext.ShoppingCartItems
                        .Where(x => x.ShoppingCartId.ContainsSubstring(friendlyBookingId, true))
                        .Include(x => x.Pie)
                        .ThenInclude(x => x.PieDetail).ToList();
            var comments = _appDbContext.ShoppingCartComments
                           .Where(x => x.ShoppingCartId.ContainsSubstring(friendlyBookingId, true))
                           .Where(x => !String.IsNullOrEmpty(x.Comments)).ToList();
            var discounts = _appDbContext.ShoppingCartDiscount
                            .Where(x => x.ShoppingCartId.ContainsSubstring(friendlyBookingId, true))
                            .Include(x => x.Discount).ToList();
            var dates = _appDbContext.ShoppingCartPickUpDates
                        .Where(x => x.BookingId.ContainsSubstring(friendlyBookingId, true))
                        .ToList();
            var customLunches = _appDbContext.ShoppingCartCustomLunch
                                .Where(x => x.BookingId.ContainsSubstring(friendlyBookingId, true))
                                .Include(x => x.Lunch).ToList();
            var caterings = _appDbContext.ShoppingCartCaterings
                            .Where(x => x.BookingId.ContainsSubstring(friendlyBookingId, true))
                            .Include(x => x.Lunch).ToList();
            var products = _appDbContext.ShoppingCartCatalogProducts
                           .Where(x => x.ShoppingCartId.ContainsSubstring(friendlyBookingId, true))
                           .Include(x => x.Product).ToList();
            var delivery = _appDbContext.DeliveryAddresses
                           .Where(x => x.ShoppingCartId.ContainsSubstring(friendlyBookingId, true)).ToList();
            var visits = _appDbContext.PageVisits
                         .Where(x => x.BookingId.ContainsSubstring(friendlyBookingId, true))
                         .OrderByDescending(x => x.Visited)
                         .Include(x => x.User).ToList();
            var ips = _appDbContext.BookingRecords
                      .Where(x => x.BookingId.ContainsSubstring(friendlyBookingId, true)).ToList();
            var repeatedIps = _appDbContext.BookingRecords
                              .Where(x => ips.Select(y => y.Ip).Contains(x.Ip)).ToList();
            var orders = _appDbContext.Orders
                         .Where(x => x.BookingId.ContainsSubstring(friendlyBookingId, true)).ToList();
            var users = visits.Where(x => x.User != null).Select(x => x.User).Distinct().ToList();

            SessionDetailsViewModel sessionDetails = new SessionDetailsViewModel()
            {
                Items             = items,
                Comments          = comments,
                Discounts         = discounts,
                PickUpDates       = dates,
                CustomLunches     = customLunches,
                Caterings         = caterings,
                Products          = products,
                FriendlyBookingId = friendlyBookingId,
                Delivery          = delivery,
                Visits            = visits,
                Ips    = ips.Union(repeatedIps).OrderByDescending(x => x.Created),
                Orders = orders,
                Users  = users
            };

            return(sessionDetails);
        }
コード例 #9
0
        public SessionDetailsPage(Session session)
        {
            InitializeComponent();

            _extension = DependencyService.Get <IPlatformSpecificExtension <Session> >();

            ItemId = session?.Title;

            FavoriteButtonAndroid.Clicked += (sender, e) => {
                Device.BeginInvokeOnMainThread(() => FavoriteIconAndroid.Grow());
            };
            FavoriteButtoniOS.Clicked += (sender, e) => {
                Device.BeginInvokeOnMainThread(() => FavoriteIconiOS.Grow());
            };

            ListViewSpeakers.ItemSelected += async(sender, e) =>
            {
                var speaker = ListViewSpeakers.SelectedItem as Speaker;
                if (speaker == null)
                {
                    return;
                }

                ContentPage destination;

                if (Device.OS == TargetPlatform.Windows || Device.OS == TargetPlatform.WinPhone)
                {
                    var speakerDetailsUwp = new SpeakerDetailsPageUWP(vm.Session.Id);
                    speakerDetailsUwp.Speaker = speaker;
                    destination = speakerDetailsUwp;
                }
                else
                {
                    var speakerDetails = new SpeakerDetailsPage(vm.Session.Id);
                    speakerDetails.Speaker = speaker;
                    destination            = speakerDetails;
                }

                await NavigationService.PushAsync(Navigation, destination);

                ListViewSpeakers.SelectedItem = null;
            };


            ButtonRate.Clicked += async(sender, e) =>
            {
                if (!Settings.Current.IsLoggedIn)
                {
                    MessagingService.Current.SendMessage(MessageKeys.NavigateLogin);
                    return;
                }
                await NavigationService.PushModalAsync(Navigation, new EvolveNavigationPage(new FeedbackPage(ViewModel.Session)));
            };
            BindingContext = new SessionDetailsViewModel(Navigation, session);
            ViewModel.LoadSessionCommand.Execute(null);
        }
コード例 #10
0
        private void SessionsByTrack_Click(object sender, EventArgs e)
        {
            SessionDetailsViewModel viewModel = ForView.Unwrap <SessionDetailsViewModel>(DataContext);

            if (viewModel != null)
            {
                viewModel.SearchByTrack();
            }
            NavigationService.Navigate(new Uri("/Views/TracksView.xaml", UriKind.Relative));
        }
コード例 #11
0
        private void Remove_Click(object sender, EventArgs e)
        {
            SessionDetailsViewModel viewModel = ForView.Unwrap <SessionDetailsViewModel>(DataContext);

            if (viewModel != null)
            {
                viewModel.Remove();
            }
            NavigationService.GoBack();
        }
コード例 #12
0
        protected override void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();
            vm = null;

            ListViewSpeakers.HeightRequest = 0;

            var adjust = Device.OS != TargetPlatform.Android ? 1 : -ViewModel.SessionMaterialItems.Count + 2;

            ListViewSessionMaterial.HeightRequest = (ViewModel.SessionMaterialItems.Count * ListViewSessionMaterial.RowHeight) - adjust;
        }
コード例 #13
0
 private static bool ShouldGoToSettings(SessionDetailsViewModel viewModel)
 {
     if (viewModel != null && viewModel.ShouldPromptForPushNotification())
     {
         MessageBoxResult result = MessageBox.Show(
             "Would you like to enable push notifications to stay informed of schedule changes?",
             viewModel.GetConferenceName(),
             MessageBoxButton.OKCancel);
         return(result == MessageBoxResult.OK);
     }
     return(false);
 }
コード例 #14
0
        public SessionDetails(Session session, MainWindowViewModel mainWindowViewModel,
                              ScheduleAppointmentCollection scheduleAppointments)
        {
            _adding       = false;
            _appointments = scheduleAppointments;
            var avaibleTerms = mainWindowViewModel.GetAvailableTerms(session, session.Time,
                                                                     mainWindowViewModel.RemainingSessions.FirstOrDefault(s => s.Subject.Id == session.Subject.Id));

            _viewModel           = new SessionDetailsViewModel(session.Subject.MinimumTermsPerSession, avaibleTerms);
            DataContext          = _viewModel;
            _mainWindowViewModel = mainWindowViewModel;
            _viewModel.Session   = session;
            InitializeComponent();
            DeleteButton.Visibility = Visibility.Visible;
        }
コード例 #15
0
        public IActionResult Errors()
        {
            var exceptions = _appDbContext.Exceptions.OrderByDescending(x => x.SiteExceptionId);
            //var bookingRecords = _appDbContext.BookingRecords.Where(x => x.Created > _calendar.LocalTime().AddDays(-7)).Take(100);

            SessionDetailsViewModel sessionDetails = _cart.SessionsDetails();

            ErrorsViewModel result = new ErrorsViewModel()
            {
                Exceptions     = exceptions,
                SessionDetails = sessionDetails,
                BookingRecords = new List <BookingRecord>()
            };

            return(View(result));
        }
コード例 #16
0
        private void Add_Click(object sender, EventArgs e)
        {
            SessionDetailsViewModel viewModel = ForView.Unwrap <SessionDetailsViewModel>(DataContext);

            if (viewModel != null)
            {
                viewModel.Add();
            }
            if (ShouldGoToSettings(viewModel))
            {
                NavigationService.Navigate(new Uri("/Views/SettingsView.xaml", UriKind.Relative));
            }
            else
            {
                NavigationService.GoBack();
            }
        }
コード例 #17
0
        public SessionDetailsPage(Session session)
        {
            InitializeComponent();

            _extension = DependencyService.Get <IPlatformSpecificExtension <Session> >();

            ItemId = session?.Title;

            ListViewSpeakers.ItemSelected += async(sender, e) =>
            {
                var speaker = ListViewSpeakers.SelectedItem as Speaker;
                if (speaker == null)
                {
                    return;
                }

                ContentPage destination;

                if (Device.OS == TargetPlatform.Windows || Device.OS == TargetPlatform.WinPhone)
                {
                    var speakerDetailsUwp = new SpeakerDetailsPageUWP(vm.Session.Id);
                    speakerDetailsUwp.Speaker = speaker;
                    destination = speakerDetailsUwp;
                }
                else
                {
                    var speakerDetails = new SpeakerDetailsPage(vm.Session.Id);
                    speakerDetails.Speaker = speaker;
                    destination            = speakerDetails;
                }

                await NavigationService.PushAsync(Navigation, destination);

                ListViewSpeakers.SelectedItem = null;
            };


            ButtonRate.Clicked += async(sender, e) =>
            {
                await NavigationService.PushModalAsync(
                    Navigation,
                    new EvolveNavigationPage(new FeedbackPage(ViewModel.Session)));
            };
            BindingContext = new SessionDetailsViewModel(Navigation, session);
            ViewModel.LoadSessionCommand.Execute(null);
        }
コード例 #18
0
 public SessionDetails(MainWindowViewModel mainWindowViewModel,
                       ScheduleAppointmentCollection scheduleAppointments, int avaibleTerms, DateTime startTime,
                       RemainingSession dragData)
 {
     _adding                      = true;
     _appointments                = scheduleAppointments;
     _viewModel                   = new SessionDetailsViewModel(dragData.Subject.MinimumTermsPerSession, avaibleTerms);
     DataContext                  = _viewModel;
     _remainingSession            = dragData;
     _mainWindowViewModel         = mainWindowViewModel;
     _viewModel.Session.Subject   = dragData.Subject;
     _viewModel.Session.Classroom = mainWindowViewModel.Classroom;
     _viewModel.Session.Day       = startTime.DayOfWeek;
     _viewModel.Session.Time      = startTime;
     _viewModel.Session.Schedule  = mainWindowViewModel.LastOpenedSchedule;
     InitializeComponent();
     DeleteButton.Visibility = Visibility.Collapsed;
 }
コード例 #19
0
        public SessionDetailsPage(Session session)
        {
            InitializeComponent();


            FavoriteButtonAndroid.Clicked += (sender, e) => {
                Device.BeginInvokeOnMainThread(() => FavoriteIconAndroid.Grow());
            };
            FavoriteButtoniOS.Clicked += (sender, e) => {
                Device.BeginInvokeOnMainThread(() => FavoriteIconiOS.Grow());
            };

            ListViewSpeakers.ItemSelected += async(sender, e) =>
            {
                var speaker = ListViewSpeakers.SelectedItem as Speaker;
                if (speaker == null)
                {
                    return;
                }

                var speakerDetails = new SpeakerDetailsPage(vm.Session.Id);

                speakerDetails.Speaker = speaker;
                App.Logger.TrackPage(AppPage.Speaker.ToString(), speaker.FullName);
                await NavigationService.PushAsync(Navigation, speakerDetails);

                ListViewSpeakers.SelectedItem = null;
            };


            ButtonRate.Clicked += async(sender, e) =>
            {
                if (!Settings.Current.IsLoggedIn)
                {
                    DependencyService.Get <ILogger>().TrackPage(AppPage.Login.ToString(), "Feedback");
                    MessagingService.Current.SendMessage(MessageKeys.NavigateLogin);
                    return;
                }
                await NavigationService.PushModalAsync(Navigation, new EvolveNavigationPage(new FeedbackPage()
                                                                                            .WithSession(ViewModel.Session)));
            };
            BindingContext = new SessionDetailsViewModel(Navigation, session);
            ViewModel.LoadSessionCommand.Execute(null);
        }
コード例 #20
0
        public SessionDetailsPage(Session session)
        {
            InitializeComponent();
            CarouselMaps.ItemsSource = new List <EvolveMap>
            {
                new EvolveMap
                {
                    //   Local = "floor_1.png",
                    Url = session.Title
                          // Title = "Floor Maps (1/2)"
                },
                new EvolveMap
                {
                    // Local = "floor_2.png",
                    Url = "https://s3.amazonaws.com/xamarin-releases/evolve-2016/floor_2.png",
                    // Title = "Floor Maps (2/2)"
                }
            };


            if (Device.OS == TargetPlatform.Android || Device.OS == TargetPlatform.iOS)
            {
                Title = "Floor Maps (1/2)";
                CarouselMaps.ItemSelected += (sender, args) =>
                {
                    var current = args.SelectedItem as EvolveMap;
                    if (current == null)
                    {
                        return;
                    }
                    Title = current.Title;
                };
            }

            try
            {
                FavoriteButtonAndroid.Clicked += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(() => FavoriteIconAndroid.Grow());
                };
                FavoriteButtoniOS.Clicked += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(() => FavoriteIconiOS.Grow());
                };
            }
            catch
            {
            }

            //ListViewSpeakers.ItemSelected += async (sender, e) =>
            //    {
            //        var speaker = ListViewSpeakers.SelectedItem as Speaker;
            //        if(speaker == null)
            //            return;

            //        var speakerDetails = new SpeakerDetailsPage(vm.Session.Id);

            //        speakerDetails.Speaker = speaker;
            //        App.Logger.TrackPage(AppPage.Speaker.ToString(), speaker.FullName);
            //        await NavigationService.PushAsync(Navigation, speakerDetails);
            //        ListViewSpeakers.SelectedItem = null;
            //    };


            ButtonRate.Clicked += async(sender, e) =>
            {
                //if(!Settings.Current.IsLoggedIn)
                //{
                //    DependencyService.Get<ILogger>().TrackPage(AppPage.Login.ToString(), "Feedback");
                //    MessagingService.Current.SendMessage(MessageKeys.NavigateLogin);
                //    return;
                //}
                await NavigationService.PushModalAsync(Navigation, new EvolveNavigationPage(new FeedbackPage(ViewModel.Session)));
            };
            BindingContext = new SessionDetailsViewModel(Navigation, session);
            ViewModel.LoadSessionCommand.Execute(null);
        }
コード例 #21
0
 public SessionDetailsPage()
 {
     InitializeComponent();
     this.BindingContext = _viewModel = Startup.ServiceProvider.GetService <SessionDetailsViewModel>();
 }
コード例 #22
0
        public IActionResult SessionsActivities(string bookingId)
        {
            SessionDetailsViewModel sessionDetails = _cart.SessionsDetails(bookingId);

            return(View(sessionDetails));
        }