Beispiel #1
0
 private void SetPlanHeaders()
 {
     MondayItems.Add(new LessonItem("Nr", "Godzina", "Nazwa", 16));
     TuesdayItems.Add(new LessonItem("Nr", "Godzina", "Nazwa", 16));
     WednesdayItems.Add(new LessonItem("Nr", "Godzina", "Nazwa", 16));
     ThursdayItems.Add(new LessonItem("Nr", "Godzina", "Nazwa", 16));
     FridayItems.Add(new LessonItem("Nr", "Godzina", "Nazwa", 16));
 }
Beispiel #2
0
        private async void LoadPlan(string path)
        {
            Title = ChoosedBranch.Name;
            ClearPlan();

            try
            {
                XmlPlanInterpreter xmlInterpreter = new XmlPlanInterpreter(path);
                //
                if (IsChangesInListOfBranches(xmlInterpreter))
                {
                    ChoosedBranch.id = -1;

                    await ChoosedBranch.ShowDialogChooseBranch(path);

                    Title = ChoosedBranch.Name;
                }
                if (ChoosedBranch.id == -1)
                {
                    Title = "Nie wybrano klasy!";
                }
                //
                List <string> Hours = xmlInterpreter.GetHours();
                for (int a = 0; a != 5; a++)
                {
                    if (a == 0)
                    {
                        for (int n = 1; n <= Hours.Count; n++)
                        {
                            MondayItems.Add(new LessonItem(n.ToString(), Hours[n - 1], xmlInterpreter.GetPlanForHour(ChoosedBranch.BranchType, ChoosedBranch.id, n, "Poniedziałek"), 14));
                        }
                    }
                    if (a == 1)
                    {
                        for (int n = 1; n <= Hours.Count; n++)
                        {
                            TuesdayItems.Add(new LessonItem(n.ToString(), Hours[n - 1], xmlInterpreter.GetPlanForHour(ChoosedBranch.BranchType, ChoosedBranch.id, n, "Wtorek"), 14));
                        }
                    }
                    if (a == 2)
                    {
                        for (int n = 1; n <= Hours.Count; n++)
                        {
                            WednesdayItems.Add(new LessonItem(n.ToString(), Hours[n - 1], xmlInterpreter.GetPlanForHour(ChoosedBranch.BranchType, ChoosedBranch.id, n, "Środa"), 14));
                        }
                    }
                    if (a == 3)
                    {
                        for (int n = 1; n <= Hours.Count; n++)
                        {
                            ThursdayItems.Add(new LessonItem(n.ToString(), Hours[n - 1], xmlInterpreter.GetPlanForHour(ChoosedBranch.BranchType, ChoosedBranch.id, n, "Czwartek"), 14));
                        }
                    }
                    if (a == 4)
                    {
                        for (int n = 1; n <= Hours.Count; n++)
                        {
                            FridayItems.Add(new LessonItem(n.ToString(), Hours[n - 1], xmlInterpreter.GetPlanForHour(ChoosedBranch.BranchType, ChoosedBranch.id, n, "Piątek"), 14));
                        }
                    }
                }
            }
            catch (Exception)
            {
                await App.Current.MainPage.DisplayAlert("Błąd!", "Wystąpił błąd podczas odczytywania pliku z planem. Prawdopodobnie plik jest uszkodzony lub używasz nieaktualnej wersji programu!", "OK");
            }
        }