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