CursonQuestionsTable
This commit is contained in:
parent
597981281f
commit
d60ef97525
@ -11,6 +11,7 @@ namespace StudentManager.Common
|
|||||||
public class FileSystem : Singleton<FileSystem>
|
public class FileSystem : Singleton<FileSystem>
|
||||||
{
|
{
|
||||||
public Action AutoSaveInvoke { get; set; }
|
public Action AutoSaveInvoke { get; set; }
|
||||||
|
public Action SavedInvoke { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -19,6 +20,8 @@ namespace StudentManager.Common
|
|||||||
{
|
{
|
||||||
StudentLib.Save();
|
StudentLib.Save();
|
||||||
QuestionLib.Instance.Save();
|
QuestionLib.Instance.Save();
|
||||||
|
|
||||||
|
SavedInvoke?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FreashAllInfo()
|
public void FreashAllInfo()
|
||||||
@ -36,6 +39,8 @@ namespace StudentManager.Common
|
|||||||
|
|
||||||
await Task.Delay(10000);
|
await Task.Delay(10000);
|
||||||
SaveAll();
|
SaveAll();
|
||||||
|
SavedInvoke?.Invoke();
|
||||||
|
|
||||||
|
|
||||||
AutoSave(time);
|
AutoSave(time);
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,9 @@ namespace StudentManager.Data
|
|||||||
{
|
{
|
||||||
QuestionDic.Clear();
|
QuestionDic.Clear();
|
||||||
|
|
||||||
|
|
||||||
|
if(!Path.Exists(StudentLib.LibPath))
|
||||||
|
Directory.CreateDirectory(Path.GetFullPath( StudentLib.LibPath));
|
||||||
Debug.Assert(Path.Exists(StudentLib.LibPath));
|
Debug.Assert(Path.Exists(StudentLib.LibPath));
|
||||||
|
|
||||||
if (!Path.Exists(StudentLib.LibPath + FileName))
|
if (!Path.Exists(StudentLib.LibPath + FileName))
|
||||||
@ -102,6 +105,8 @@ namespace StudentManager.Data
|
|||||||
}
|
}
|
||||||
public ObservableCollection<QuestionData> GetAllQuestionByLesson(uint lesson)
|
public ObservableCollection<QuestionData> GetAllQuestionByLesson(uint lesson)
|
||||||
{
|
{
|
||||||
|
if (!QuestionTableDic.ContainsKey(lesson)) return new ObservableCollection<QuestionData>();
|
||||||
|
|
||||||
var list = new ObservableCollection<QuestionData>();
|
var list = new ObservableCollection<QuestionData>();
|
||||||
foreach (QuestionData data in QuestionTableDic[lesson].Values)
|
foreach (QuestionData data in QuestionTableDic[lesson].Values)
|
||||||
{
|
{
|
||||||
|
@ -57,48 +57,84 @@
|
|||||||
<Border BorderBrush="#FFE1E1E1" BorderThickness="1,0,0,0" Margin="0,0,0,0" Grid.Column="1"/>
|
<Border BorderBrush="#FFE1E1E1" BorderThickness="1,0,0,0" Margin="0,0,0,0" Grid.Column="1"/>
|
||||||
|
|
||||||
|
|
||||||
<ScrollViewer Grid.Column="1" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden" Margin="10">
|
<DockPanel Grid.Column="1" LastChildFill="False">
|
||||||
<ItemsControl Grid.Row="1" ItemsSource="{Binding HomeworkTestData}" HorizontalAlignment="Left">
|
|
||||||
<ItemsControl.ItemsPanel>
|
<ScrollViewer HorizontalScrollBarVisibility="Disabled" DockPanel.Dock="Top" VerticalScrollBarVisibility="Hidden" Margin="10">
|
||||||
<ItemsPanelTemplate>
|
<ItemsControl Grid.Row="1" ItemsSource="{Binding StudentDatas}" HorizontalAlignment="Left">
|
||||||
<WrapPanel/>
|
<ItemsControl.ItemsPanel>
|
||||||
</ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
</ItemsControl.ItemsPanel>
|
<WrapPanel/>
|
||||||
<ItemsControl.ItemTemplate>
|
</ItemsPanelTemplate>
|
||||||
<DataTemplate>
|
</ItemsControl.ItemsPanel>
|
||||||
<Border Background="#FFFEFEFE" BorderBrush="Gray" BorderThickness="0" CornerRadius="10"
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border Background="#FFF9F9F9" BorderBrush="Gray" BorderThickness="0" CornerRadius="10"
|
||||||
|
Padding="5" Height="150" Width="120" Margin="5" IsHitTestVisible="True">
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect Color="#FFF5F5F5" BlurRadius="10" ShadowDepth="1" Direction="0"/>
|
||||||
|
</Border.Effect>
|
||||||
|
<i:Interaction.Triggers>
|
||||||
|
<i:EventTrigger EventName="MouseEnter">
|
||||||
|
<i:ChangePropertyAction PropertyName="Background" Value="#FFFEFEFE"/>
|
||||||
|
</i:EventTrigger>
|
||||||
|
<i:EventTrigger EventName="MouseLeave">
|
||||||
|
<i:ChangePropertyAction PropertyName="Background" Value="#FFF9F9F9"/>
|
||||||
|
</i:EventTrigger>
|
||||||
|
</i:Interaction.Triggers>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock TextWrapping="Wrap" FontSize="12" FontWeight="Bold" Text="{Binding Type}"
|
||||||
|
VerticalAlignment="Center" HorizontalAlignment="Left" Padding="10,10"/>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
<ScrollViewer HorizontalScrollBarVisibility="Disabled" DockPanel.Dock="Bottom" VerticalScrollBarVisibility="Hidden" Margin="10">
|
||||||
|
<ItemsControl Grid.Row="1" ItemsSource="{Binding HomeworkTestData}" HorizontalAlignment="Left">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<WrapPanel/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border Background="#FFF9F9F9" BorderBrush="Gray" BorderThickness="0" CornerRadius="10"
|
||||||
Padding="5" Height="150" Width="120" Margin="5" IsHitTestVisible="True">
|
Padding="5" Height="150" Width="120" Margin="5" IsHitTestVisible="True">
|
||||||
<Border.Effect>
|
<Border.Effect>
|
||||||
<DropShadowEffect Color="#FFF5F5F5" BlurRadius="10" ShadowDepth="1" Direction="0"/>
|
<DropShadowEffect Color="#FFF5F5F5" BlurRadius="10" ShadowDepth="1" Direction="0"/>
|
||||||
</Border.Effect>
|
</Border.Effect>
|
||||||
<i:Interaction.Triggers>
|
<i:Interaction.Triggers>
|
||||||
<i:EventTrigger EventName="MouseEnter">
|
<i:EventTrigger EventName="MouseEnter">
|
||||||
<i:ChangePropertyAction PropertyName="Background" Value="#FFFEFEFE"/>
|
<i:ChangePropertyAction PropertyName="Background" Value="#FFFEFEFE"/>
|
||||||
</i:EventTrigger>
|
</i:EventTrigger>
|
||||||
<i:EventTrigger EventName="MouseLeave">
|
<i:EventTrigger EventName="MouseLeave">
|
||||||
<i:ChangePropertyAction PropertyName="Background" Value="#FFF9F9F9"/>
|
<i:ChangePropertyAction PropertyName="Background" Value="#FFF9F9F9"/>
|
||||||
</i:EventTrigger>
|
</i:EventTrigger>
|
||||||
</i:Interaction.Triggers>
|
</i:Interaction.Triggers>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock TextWrapping="Wrap" FontSize="12" FontWeight="Bold" Text="{Binding Type}"
|
<TextBlock TextWrapping="Wrap" FontSize="12" FontWeight="Bold" Text="{Binding Type}"
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Left" Padding="10,10"/>
|
VerticalAlignment="Center" HorizontalAlignment="Left" Padding="10,10"/>
|
||||||
|
|
||||||
<Border BorderBrush="Gray" BorderThickness="0,0.5,0,0" Margin="5,0,60,10"/>
|
<Border BorderBrush="Gray" BorderThickness="0,0.5,0,0" Margin="5,0,60,10"/>
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<TextBlock TextWrapping="Wrap" FontSize="12" Text="题干" Margin="5" Foreground="Gray"
|
<TextBlock TextWrapping="Wrap" FontSize="12" Text="题干" Margin="5" Foreground="Gray"
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
||||||
<TextBlock TextWrapping="Wrap" FontSize="12" Margin="5"
|
<TextBlock TextWrapping="Wrap" FontSize="12" Margin="5"
|
||||||
Text="{Binding Stem}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
Text="{Binding Stem}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
</DockPanel>
|
||||||
</StackPanel>
|
|
||||||
</Border>
|
|
||||||
</DataTemplate>
|
|
||||||
</ItemsControl.ItemTemplate>
|
|
||||||
</ItemsControl>
|
|
||||||
</ScrollViewer>
|
|
||||||
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Button Grid.Row="1" DockPanel.Dock="Bottom" Content="发布作业" Style="{DynamicResource MaterialDesignFlatDarkButton}"
|
<Button Grid.Row="1" DockPanel.Dock="Bottom" Content="发布作业" Style="{DynamicResource MaterialDesignFlatDarkButton}"
|
||||||
|
@ -209,7 +209,7 @@
|
|||||||
</ItemsControl.ItemsPanel>
|
</ItemsControl.ItemsPanel>
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Border Background="#FFFEFEFE" BorderBrush="Gray" BorderThickness="0" CornerRadius="10"
|
<Border Background="#FFF9F9F9" BorderBrush="Gray" BorderThickness="0" CornerRadius="10"
|
||||||
Padding="5" Height="200" Width="120" Margin="5" IsHitTestVisible="True" MouseRightButtonDown="Border_MouseRightButtonDown">
|
Padding="5" Height="200" Width="120" Margin="5" IsHitTestVisible="True" MouseRightButtonDown="Border_MouseRightButtonDown">
|
||||||
<i:Interaction.Triggers>
|
<i:Interaction.Triggers>
|
||||||
<i:EventTrigger EventName="MouseEnter">
|
<i:EventTrigger EventName="MouseEnter">
|
||||||
@ -218,12 +218,6 @@
|
|||||||
<i:EventTrigger EventName="MouseLeave">
|
<i:EventTrigger EventName="MouseLeave">
|
||||||
<i:ChangePropertyAction PropertyName="Background" Value="#FFF9F9F9"/>
|
<i:ChangePropertyAction PropertyName="Background" Value="#FFF9F9F9"/>
|
||||||
</i:EventTrigger>
|
</i:EventTrigger>
|
||||||
<i:EventTrigger EventName="MouseRightButtonDown">
|
|
||||||
<i:InvokeCommandAction Command="{Binding DataContext.SelectedCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding}"/>
|
|
||||||
</i:EventTrigger>
|
|
||||||
<!--<i:EventTrigger EventName="MouseRightButtonDown">
|
|
||||||
<i:InvokeCommandAction Command="{Binding DataContext.ShowContextMenuCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding}"/>
|
|
||||||
</i:EventTrigger>-->
|
|
||||||
</i:Interaction.Triggers>
|
</i:Interaction.Triggers>
|
||||||
<Border.Effect>
|
<Border.Effect>
|
||||||
<DropShadowEffect Color="#FFF5F5F5" BlurRadius="10" ShadowDepth="1" Direction="0"/>
|
<DropShadowEffect Color="#FFF5F5F5" BlurRadius="10" ShadowDepth="1" Direction="0"/>
|
||||||
|
@ -250,7 +250,8 @@ namespace StudentManager.Model
|
|||||||
CreateMenuBar();
|
CreateMenuBar();
|
||||||
CurrentTime = DateTime.Now.ToString("HH:mm");
|
CurrentTime = DateTime.Now.ToString("HH:mm");
|
||||||
|
|
||||||
Timer timer = new Timer(() => {
|
Timer timer = new Timer(() =>
|
||||||
|
{
|
||||||
CurrentTime = DateTime.Now.ToString("HH:mm");
|
CurrentTime = DateTime.Now.ToString("HH:mm");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -259,6 +260,11 @@ namespace StudentManager.Model
|
|||||||
aggregator.SendMessage(" 将在10秒后自动保存 ");
|
aggregator.SendMessage(" 将在10秒后自动保存 ");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FileSystem.Instance.SavedInvoke += () =>
|
||||||
|
{
|
||||||
|
aggregator.SendMessage(" 已保存 ");
|
||||||
|
};
|
||||||
|
|
||||||
FileSystem.Instance.AutoSave();
|
FileSystem.Instance.AutoSave();
|
||||||
|
|
||||||
RegionTo = new DelegateCommand<string>((x) =>
|
RegionTo = new DelegateCommand<string>((x) =>
|
||||||
@ -346,7 +352,10 @@ namespace StudentManager.Model
|
|||||||
ADDQuestionDatas.Clear();
|
ADDQuestionDatas.Clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
SaveAllCommand = new DelegateCommand(() => FileSystem.Instance.SaveAll());
|
SaveAllCommand = new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
FileSystem.Instance.SaveAll();
|
||||||
|
});
|
||||||
FreshAllCommand = new DelegateCommand(() =>
|
FreshAllCommand = new DelegateCommand(() =>
|
||||||
{
|
{
|
||||||
FileSystem.Instance.FreashAllInfo();
|
FileSystem.Instance.FreashAllInfo();
|
||||||
|
Loading…
Reference in New Issue
Block a user