Example #1
0
        public AmbiguityResolverWindow()
        {
            InitializeComponent();

            var allCourses = InMemoryCourseRepository.getInstance().Courses;

            _ambiguousCourses = allCourses.FindAll(m => m.AmbiguousState);

            CoursesDataGrid.ItemsSource = _ambiguousCourses;

            this.Loaded += new RoutedEventHandler(Window_OnLoaded);
            this.Closed += new EventHandler(Window_OnClosed);
        }
        private void Menu_Export(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter = "Excel Worksheets|*.xls";
            if (saveFileDialog.ShowDialog() == true)
            {
                var fileName     = saveFileDialog.FileName;
                var templateFile = Path.Combine(Environment.CurrentDirectory, "ClassroomGridTemplate.xls");
                using (var fileStream = File.OpenRead(templateFile))
                {
                    IWorkbook workbook = new HSSFWorkbook(fileStream);
                    workbook.RemoveSheetAt(workbook.GetSheetIndex("Sheet1"));

                    workbook.MissingCellPolicy = MissingCellPolicy.CREATE_NULL_AS_BLANK;
                    ExcelSchedulePrinter printer          = new ExcelSchedulePrinter(fileName, workbook);
                    ICourseRepository    courseRepository = InMemoryCourseRepository.getInstance();
                    //IRoomRepository roomRepository = InMemoryRoomRepository.getInstance();

                    new ScheduleVisualization(courseRepository, null, printer).PrintSchedule();
                }
            }
        }