Beispiel #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();
        }
Beispiel #2
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var sampleDataGroup = await SampleDataSource.GetGroupAsync("Group-4");

            this.DefaultViewModel["Section3Items"] = sampleDataGroup;
            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("Tuesday", saturday));
            entracesPerDay.Add(new EntrancesByDay("Wednsday", saturday));
            entracesPerDay.Add(new EntrancesByDay("Thursday", saturday));
            entracesPerDay.Add(new EntrancesByDay("Friday", saturday));
            entracesPerDay.Add(new EntrancesByDay("Saturday", saturday));
            entracesPerDay.Add(new EntrancesByDay("Sunday", sunday));
            System.Diagnostics.Debug.WriteLine("entracesPerDay");
            System.Diagnostics.Debug.WriteLine("Saturday " + saturday);
            System.Diagnostics.Debug.WriteLine(entracesPerDay);
            this.DefaultViewModel["EntrancesPerDay"] = entracesPerDay;
            ((TimePicker)CommonHelper.FindChildControl <TimePicker>(this, "EntranceTimePicker")).Time = DateTime.Now.TimeOfDay;
        }
Beispiel #3
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var sampleDataGroups = await SampleDataSource.GetGroupsAsync();

            var entrances = await client.GetEntrances();

            var dayEntrances = await client.GetTodayEntrances();

            this.DefaultViewModel["Groups"] = sampleDataGroups;
            //  this.DefaultViewModel["DayEntrances"] = dayEntrances;
            this.DefaultViewModel["Entrances"] = entrances;
            System.Diagnostics.Debug.WriteLine(DateTime.Now.DayOfWeek.ToString().ToLower());
            System.Diagnostics.Debug.WriteLine(dayEntrances.Count());
            ((TimePicker)CommonHelper.FindChildControl <TimePicker>(this, "EntranceTimePicker")).Time = DateTime.Now.TimeOfDay;
        }