private void CreatePlanButton_Click(object sender, RoutedEventArgs e) { ScheduleOptionDisplay schedule = (ScheduleOptionDisplay)((Button)sender).DataContext; MainWindow window = GlobalFunction.GetMainWindow(); window._mainFrame.Navigate(new Plans.PlanEditPage(schedule.ID, schedule.ClassroomId)); }
//schedules(scheduleId INTEGER PRIMARY KEY, classroomId INTEGER, roomId INTEGER, repetitivity INTEGER, nextDate INTEGER, duration INTEGER); public ScheduleOption(int classroomId) { InitializeComponent(); scheduleDisplayCollection = new ObservableCollection <ScheduleOptionDisplay>(); List <ScheduleInfo> scheduleList = Database.Get.Schedule.AllFromClassroomId(classroomId); foreach (ScheduleInfo schedule in scheduleList) { DateTime nextDateTime = DateTimeOffset.FromUnixTimeSeconds((long)schedule.nextDate).LocalDateTime; TimeSpan durationTime = TimeSpan.FromSeconds((double)schedule.duration); ScheduleOptionDisplay scheduleDisplay = new ScheduleOptionDisplay() { ID = (int)schedule.scheduleId, ClassroomId = (int)schedule.classroomId, Room = Database.Get.Room.NameFromID((int)schedule.roomId), Repetitivity = schedule.repetitivity == 0 ? "Une fois par semaine" : "Une semaine sur deux", NextDate = nextDateTime.ToString("g", GlobalVariable.culture), Duration = durationTime.ToString(@"hh\:mm") }; scheduleDisplayCollection.Add(scheduleDisplay); } _scheduleDataGrid.ItemsSource = scheduleDisplayCollection; }