diff --git a/HFUTCourseSimulation/Dialog/EditCourse.xaml b/HFUTCourseSimulation/Dialog/EditCourse.xaml new file mode 100644 index 0000000..7728ab2 --- /dev/null +++ b/HFUTCourseSimulation/Dialog/EditCourse.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HFUTCourseSimulation/Dialog/EditCourse.xaml.cs b/HFUTCourseSimulation/Dialog/EditCourse.xaml.cs new file mode 100644 index 0000000..7e8738f --- /dev/null +++ b/HFUTCourseSimulation/Dialog/EditCourse.xaml.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace HFUTCourseSimulation.Dialog { + /// + /// Interaction logic for EditCourse.xaml + /// + public partial class EditCourse : Window { + public EditCourse() { + InitializeComponent(); + this.DataContext = Kernel.Context.Instance.currentCourse; + } + } +} diff --git a/HFUTCourseSimulation/Dialog/EditSchedule.xaml b/HFUTCourseSimulation/Dialog/EditSchedule.xaml new file mode 100644 index 0000000..24f5254 --- /dev/null +++ b/HFUTCourseSimulation/Dialog/EditSchedule.xaml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HFUTCourseSimulation/Dialog/EditSchedule.xaml.cs b/HFUTCourseSimulation/Dialog/EditSchedule.xaml.cs new file mode 100644 index 0000000..5a6f5c9 --- /dev/null +++ b/HFUTCourseSimulation/Dialog/EditSchedule.xaml.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace HFUTCourseSimulation.Dialog { + /// + /// Interaction logic for EditSchedule.xaml + /// + public partial class EditSchedule : Window { + public EditSchedule() { + InitializeComponent(); + this.DataContext = Kernel.Context.Instance.currentSchedule; + } + + } + +} diff --git a/HFUTCourseSimulation/HFUTCourseSimulation.csproj b/HFUTCourseSimulation/HFUTCourseSimulation.csproj index fffa8ea..6c0cec8 100644 --- a/HFUTCourseSimulation/HFUTCourseSimulation.csproj +++ b/HFUTCourseSimulation/HFUTCourseSimulation.csproj @@ -75,6 +75,12 @@ MSBuild:Compile + + EditCourse.xaml + + + EditSchedule.xaml + @@ -86,6 +92,14 @@ + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -129,5 +143,8 @@ + + + \ No newline at end of file diff --git a/HFUTCourseSimulation/Kernel/Context.cs b/HFUTCourseSimulation/Kernel/Context.cs index 06e24ea..5a87d2b 100644 --- a/HFUTCourseSimulation/Kernel/Context.cs +++ b/HFUTCourseSimulation/Kernel/Context.cs @@ -7,18 +7,16 @@ using System.Threading.Tasks; namespace HFUTCourseSimulation.Kernel { public class Context { - private static Context s_Instance = new Context(); - public static Context GetSingleton() { return s_Instance; } - + public static readonly Context Instance = new Context(); private Context() { currentSemester = null; currentCourse = null; currentSchedule = null; } - private UserData.Semester currentSemester; - private UserData.Course currentCourse; - private UserData.Schedule currentSchedule; + public UserData.Semester currentSemester; + public UserData.Course currentCourse; + public UserData.Schedule currentSchedule; } diff --git a/HFUTCourseSimulation/MainWindow.xaml b/HFUTCourseSimulation/MainWindow.xaml index fe5846c..7743d9e 100644 --- a/HFUTCourseSimulation/MainWindow.xaml +++ b/HFUTCourseSimulation/MainWindow.xaml @@ -5,36 +5,55 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:HFUTCourseSimulation" mc:Ignorable="d" - Title="HFUT课表模拟" Height="450" Width="800"> + Title="HFUT课表模拟" Height="600" Width="800"> - - - + + + + + + + + - - - + + + - + + + + - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + diff --git a/HFUTCourseSimulation/MainWindow.xaml.cs b/HFUTCourseSimulation/MainWindow.xaml.cs index 292e495..115a6bd 100644 --- a/HFUTCourseSimulation/MainWindow.xaml.cs +++ b/HFUTCourseSimulation/MainWindow.xaml.cs @@ -34,8 +34,8 @@ namespace HFUTCourseSimulation { uiMenuOpen.IsEnabled = true; uiMenuSave.IsEnabled = false; uiMenuClose.IsEnabled = false; - uiMenuSimulation.IsEnabled = false; - uiMenuExport.IsEnabled = false; + uiMenuSimulator.IsEnabled = false; + uiMenuRender.IsEnabled = false; uiMainTab.Visibility = Visibility.Collapsed; /* @@ -54,7 +54,7 @@ namespace HFUTCourseSimulation { uiCourseName.IsEnabled = false; uiCourseDescription.IsEnabled = false; - uiDate.IsEnabled = false; + uiStartDate.IsEnabled = false; uiWeekCount.IsEnabled = false; uiCoursesList.IsEnabled = false; @@ -66,8 +66,8 @@ namespace HFUTCourseSimulation { uiMenuOpen.IsEnabled = false; uiMenuSave.IsEnabled = true; uiMenuClose.IsEnabled = true; - uiMenuSimulation.IsEnabled = true; - uiMenuExport.IsEnabled = true; + uiMenuSimulator.IsEnabled = true; + uiMenuRender.IsEnabled = true; uiMainTab.Visibility = Visibility.Visible; /* @@ -86,7 +86,7 @@ namespace HFUTCourseSimulation { uiCourseName.IsEnabled = true; uiCourseDescription.IsEnabled = true; - uiDate.IsEnabled = true; + uiStartDate.IsEnabled = true; uiWeekCount.IsEnabled = true; uiCoursesList.IsEnabled = true; @@ -152,12 +152,12 @@ namespace HFUTCourseSimulation { UpdateUI(); } - private void uiMenuSimulation_Click(object sender, RoutedEventArgs e) { + private void uiMenuSimulator_Click(object sender, RoutedEventArgs e) { var win = new Simulation(); win.ShowDialog(); } - private void uiMenuExport_Click(object sender, RoutedEventArgs e) { + private void uiMenuRender_Click(object sender, RoutedEventArgs e) { //convert data int weekCount; DateTime originDate; @@ -190,7 +190,7 @@ namespace HFUTCourseSimulation { void SyncMainData() { isUpdatingData = true; - this.uiDate.SelectedDate = DateTime.Parse(General.GeneralSheet.StartDate); + this.uiStartDate.SelectedDate = DateTime.Parse(General.GeneralSheet.StartDate); this.uiWeekCount.Text = General.GeneralSheet.WeekCount.ToString(); SyncCourseListData(); @@ -379,9 +379,9 @@ namespace HFUTCourseSimulation { } //main - private void uiDate_SelectedDateChanged(object sender, SelectionChangedEventArgs e) { + private void uiStartDate_SelectedDateChanged(object sender, SelectionChangedEventArgs e) { if (isUpdatingData) return; - General.GeneralSheet.StartDate = this.uiDate.SelectedDate.ToString(); + General.GeneralSheet.StartDate = this.uiStartDate.SelectedDate.ToString(); } private void uiWeekCount_TextChanged(object sender, TextChangedEventArgs e) {