예제 #1
0
        void LoadDropInData(object sender, RoutedEventArgs e)
        {
            var ofd = new OpenFileDialog();

            ofd.DefaultExt = ".json";
            ofd.Filter     = "JSON | *.json";

            bool?result = ofd.ShowDialog();

            if (result != true)
            {
                return;
            }

            string fileName = ofd.FileName;
            string json     = File.ReadAllText(fileName);

            diData = JsonConvert.DeserializeObject <DropInData>(json);

            foreach (var c in diData.courses)
            {
                requirements.Add(new CourseRequirement()
                {
                    course    = c,
                    specifics = new List <CourseRequirementSpecifics>()
                });
            }

            courseIntensityComboBox.ItemsSource = diData.courses;
            courseSpecificComboBox.ItemsSource  = diData.courses;
            courseWeekComboBox.ItemsSource      = diData.courses;
            courseShiftComboBox.ItemsSource     = diData.shifts;
        }
예제 #2
0
        public MainWindow()
        {
            InitializeComponent();

            diData       = new DropInData();
            requirements = new ObservableCollection <CourseRequirement>();
            specifics    = new ObservableCollection <CourseRequirementSpecifics>();
            DataContext  = this;
        }