private void UpdateGUI(List <List <Slot> > result) { _raw = result; _cyclicIndex = new CyclicIndex(); if (result == null || result.Count == 0) { if (_inputSlots.NoSlotIsChosen()) { _outputTimetables.SetState(TimetableList.NoSlotsIsChosen); AutoCloseNotificationBar.Show("No subject selected."); } else { _outputTimetables.SetState(TimetableList.NoPossibleCombination); NotificationBar.Show("No possible timetable found.", "Tell me why", () => { DialogBox.Show("Why no possible combination?", new ClashFinder(_subjectModels, _permutator).Message); }, false); } ToolBoxPanel.Visibility = Visibility.Hidden; _cyclicIndex.Reset(); } else { _outputTimetables.SetState(new TimetableList(result)); ToolBoxPanel.Visibility = Visibility.Visible; _cyclicIndex.MaxValue = result.Count - 1; _cyclicIndex.CurrentValue = 0; AutoCloseNotificationBar.Show(result.Count + " possible timetables found."); } TimetableViewer.Initialize(_cyclicIndex); CyclicIndexView.DataContext = new CyclicIndexVM(_cyclicIndex); }
private void UpdateGUI(List <List <Slot> > result) { _raw = result; _cyclicIndex = new CyclicIndex(); if (result == null || result.Count == 0) { if (_inputSlots.NoSlotIsChosen()) { _outputTimetables.SetState(TimetableList.NoSlotsIsChosen); } else { _outputTimetables.SetState(TimetableList.NoPossibleCombination); AutoClosePopup.Show("No possible timetable found."); } ToolBoxPanel.Visibility = Visibility.Hidden; _cyclicIndex.Reset(); } else { _outputTimetables.SetState(new TimetableList(result)); ToolBoxPanel.Visibility = Visibility.Visible; _cyclicIndex.MaxValue = result.Count - 1; _cyclicIndex.CurrentValue = 0; //AutoClosePopup.Show(result.Count + " possible timetables found."); } TimetableViewer.Initialize(_cyclicIndex); CyclicIndexView.DataContext = new CyclicIndexVM(_cyclicIndex); }
private void ShowFavoriteTimetable_Checked(object sender, RoutedEventArgs e) { var likedTimetable = _outputTimetables.GetLikedTimetableOnly(); _outputTimetables?.SetState(likedTimetable); var ci = new CyclicIndex(likedTimetable.Count - 1); TimetableViewer?.Initialize(ci); CyclicIndexView.DataContext = new CyclicIndexVM(ci); //Global.Snackbar.MessageQueue.Enqueue("Showing FAVORITE timetables"); }
private Page_CreateTimetable(SlotList inputSlots, Func <Slot[], List <List <Slot> > > permutator) { _inputSlots = inputSlots; _permutator = permutator; InitializeComponent(); TimetableViewer.SetObservedThings(_outputTimetables); TimetableViewer.Initialize(new CyclicIndex()); _cyclicIndex = new CyclicIndex(); CyclicIndexView.DataContext = new CyclicIndexVM(_cyclicIndex); InitializeExtraComponents(); ToolBoxPanel.Visibility = Visibility.Hidden; }
private void ShowAllTimetable_Checked(object sender, RoutedEventArgs e) { var allTimetables = _outputTimetables.GetPreviousState(); _outputTimetables?.SetState(allTimetables); var ci = new CyclicIndex(allTimetables.Count - 1); TimetableViewer?.Initialize(ci); if (CyclicIndexView != null) { CyclicIndexView.DataContext = new CyclicIndexVM(ci); } //Global.Snackbar.MessageQueue.Enqueue("Showing ALL timetables"); }
private void ViewSelector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (ViewSelector.SelectedIndex == 0) { var allTimetables = _outputTimetables.GetPreviousState(); _outputTimetables?.SetState(allTimetables); var ci = new CyclicIndex(allTimetables.Count - 1); TimetableViewer?.Initialize(ci); if (CyclicIndexView != null) { CyclicIndexView.DataContext = new CyclicIndexVM(ci); } // Global.Snackbar.MessageQueue.Enqueue("Showing ALL timetables"); } else { var likedTimetable = _outputTimetables.GetLikedTimetableOnly(); _outputTimetables?.SetState(likedTimetable); var ci = new CyclicIndex(likedTimetable.Count - 1); TimetableViewer?.Initialize(ci); CyclicIndexView.DataContext = new CyclicIndexVM(ci); // Global.Snackbar.MessageQueue.Enqueue("Showing FAVORITE timetables"); } }