Exemplo n.º 1
0
        private async void InitLoadSequence()
        {
            #if DEBUG
            Debug.WriteLine("Network Task created!");
            #endif
            await ScheduleNetwork.Refresh();

            #if DEBUG
            Debug.WriteLine("Loading Schedule Complete.");
            #endif

            schedules = null;
            schedules = ScheduleManager.GetSchedules();

            //Updating Bindings (the data behind the Pivot)
            Binding binding = new Binding();
            binding.Source = schedules;
            binding.Mode   = BindingMode.TwoWay;
            binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            BindingOperations.SetBinding(pivot1, Pivot.ItemsSourceProperty, binding);

            LoadingProcessProgressRing.IsActive   = false;
            LoadingProcessProgressRing.Visibility = Windows.UI.Xaml.Visibility.Collapsed;

            Windows.Storage.ApplicationDataContainer localSettings =
                Windows.Storage.ApplicationData.Current.LocalSettings;
            pivot1.Title = (string)localSettings.Values["UpdateDate"];
        }
Exemplo n.º 2
0
        public static ObservableCollection <Schedule> GetSchedules()
        {
            Windows.Storage.ApplicationDataContainer localSettings =
                Windows.Storage.ApplicationData.Current.LocalSettings;

            #if DEBUG
            Debug.WriteLine("Creating ScheduleManager");
            #endif

            ObservableCollection <Schedule> outList = new ObservableCollection <Schedule>();

            int pagesCount = (int)localSettings.Values[ScheduleNetwork.PAGES_COUNT];

            for (int i = 1; i <= pagesCount; i++)
            {
                List <ScheduleEntry> entries = new List <ScheduleEntry>();
                string date = ScheduleNetwork.GetDate(i);

                ScheduleHandler handler = new ScheduleHandler(i);

                List <string> classes = handler.getClassList();

                foreach (string classStr in classes)
                {
                    entries.Add(new ScheduleEntry
                    {
                        ClassName = classStr,
                        Entries   = handler.GetClassInfo(classStr)
                    });
                }

                outList.Add(new Schedule
                {
                    DayName         = date,
                    ScheduleEntries = entries
                });
            }

            return(outList);
        }