Ejemplo n.º 1
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            DateTime    date     = ((DatePicker)CommonHelper.FindChildControl <DatePicker>(this, "EntranceDatePicker")).Date.Date.AddHours(((TimePicker)CommonHelper.FindChildControl <TimePicker>(this, "EntranceTimePicker")).Time.Hours);
            int         people   = Int32.Parse(((TextBox)CommonHelper.FindChildControl <TextBox>(this, "NumberOfPeople")).Text);
            Entrance    entrance = new Entrance(date, people, ((Button)sender).Name == "InButton" ? true : false);
            StatsClient client   = new StatsClient();
            await client.PostEntrance(entrance);

            ((Grid)CommonHelper.FindChildControl <Grid>(this, "AddForm")).Visibility             = Visibility.Collapsed;
            ((StackPanel)CommonHelper.FindChildControl <StackPanel>(this, "PostAdd")).Visibility = Visibility.Visible;
            var entrances = await client.GetEntrances();

            this.DefaultViewModel["Entrances"] = entrances;
            List <EntrancesByDay> entracesPerDay = new List <EntrancesByDay>();
            var saturday = await client.GetEntrancesByDay("saturday");

            var sunday = await client.GetEntrancesByDay("sunday");

            entracesPerDay.Add(new EntrancesByDay("saturday", saturday));
            entracesPerDay.Add(new EntrancesByDay("sunday", sunday));
            System.Diagnostics.Debug.WriteLine("entracesPerDay");
            System.Diagnostics.Debug.WriteLine(entracesPerDay);
            this.DefaultViewModel["EntrancesPerDay"] = entracesPerDay;
            this.UpdateLayout();
        }
Ejemplo n.º 2
0
        private async void AppBarButton_Click(object sender, RoutedEventArgs e)
        {
            DateTime    date     = EntranceDatePicker.Date.Date.AddHours(EntranceTimePicker.Time.Hours);
            int         people   = Int32.Parse(NumberOfPeople.Text);
            Entrance    entrance = new Entrance(date, people, ((AppBarButton)sender).Name == "GoButton" ? true : false);
            StatsClient client   = new StatsClient();
            await client.PostEntrance(entrance);

            Frame.GoBack();
        }
Ejemplo n.º 3
0
        private async void AppBarButton_Click(object sender, RoutedEventArgs e)
        {
            DateTime date     = ((DatePicker)CommonHelper.FindChildControl <DatePicker>(this, "EntranceDatePicker")).Date.Date.AddHours(((TimePicker)CommonHelper.FindChildControl <TimePicker>(this, "EntranceTimePicker")).Time.Hours);
            int      people   = Int32.Parse(((TextBox)CommonHelper.FindChildControl <TextBox>(this, "NumberOfPeople")).Text);
            Entrance entrance = new Entrance(date, people, ((AppBarButton)sender).Name == "GoButton" ? true : false);

            ((Grid)CommonHelper.FindChildControl <Grid>(this, "AddForm")).Visibility = Visibility.Collapsed;
            ((Grid)CommonHelper.FindChildControl <Grid>(this, "AddNext")).Visibility = Visibility.Visible;
            AddButton.Visibility  = Visibility.Visible;
            GoButton.Visibility   = Visibility.Collapsed;
            QuitButton.Visibility = Visibility.Collapsed;
            await client.PostEntrance(entrance);
        }