コード例 #1
0
        public TabbedMainPage(Client _ConnectedClient)
        {
            InitializeComponent();

            Requests = new HttpRequests(this, Children);
            ClientReservationStatus = new ReservationStatus();

            if (_ConnectedClient != null)
            {
                ConnectedClient = _ConnectedClient;
                Reservations    = new List <Reservation>();
                FillProfil();
                BeginDatePicker.MinimumDate = DateTime.Now.AddMinutes(1); // Update possible date
                EndDatePicker.MinimumDate   = DateTime.Now.AddMinutes(30);
                BeginTimePicker.Time        = DateTime.Now.AddMinutes(30).TimeOfDay;
                EndTimePicker.Time          = DateTime.Now.AddMinutes(90).TimeOfDay;
                AccessButton.Text           = "Accès avec réservation";
            }
            else
            {
                ClientReservationStatus = ReservationStatus.Guest;
                CurrentPage             = LiFiNavPage;
                this.Children.Remove(ReservationNavPage);
                this.Children.Remove(ProfilNavPage);
                AccessButton.Text = "Accès sans réservation";
            }

            MainAppThreadAsync();
            new Thread(MainThread).Start();
            //Device.StartTimer(TimeSpan.FromSeconds(5), () =>
            //{
            //   BeginDatePicker.MaximumDate = DateTime.Now.AddDays(1);
            //   EndDatePicker.MaximumDate = DateTime.Now.AddDays(1);
            //   if (BeginDatePicker.Date > DateTime.Now.AddHours(1) && EndDatePicker.Date > DateTime.Now.AddHours(1))
            //   {
            //        BeginDatePicker.MinimumDate = DateTime.Now.AddHours(1);
            //        EndDatePicker.MinimumDate = DateTime.Now.AddHours(1);
            //    }
            //   if (TimerEnabled)
            //       MainAppThreadAsync();

            //   return true; // True = Repeat again, False = Stop the timer
            //});
        }