Skip to content

Commit

Permalink
解决 #6 中的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
STBBRD committed Nov 19, 2023
1 parent be12188 commit c871191
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<ColumnDefinition/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="48"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Margin="8,6">
<TextBlock x:Name="TextBlockHintSubject" Text="在此输入课程名称" Foreground="#CC000000" FontSize="14"
Expand All @@ -33,11 +34,11 @@
Text="{Binding StartTime, RelativeSource={RelativeSource AncestorType=UserControl}}"
VerticalContentAlignment="Center" Background="{x:Null}"
TextChanged="StartTimeTextBox_TextChanged"/>
<local:TimeTextBox x:Name="EndTimeTextBox" BorderThickness="0" Grid.Column="2" Margin="48,6"
<local:TimeTextBox x:Name="EndTimeTextBox" BorderThickness="0" Grid.Column="2" Margin="8,6"
Text="{Binding EndTime, RelativeSource={RelativeSource AncestorType=UserControl}}"
VerticalContentAlignment="Center" Background="{x:Null}"
TextChanged="EndTimeTextBox_TextChanged"/>
<ui:SymbolIcon Grid.Column="2" HorizontalAlignment="Right" Margin="16,8" Opacity="0.5" Symbol="Delete" MouseUp="SymbolIconDelete_MouseUp"/>
<ui:SymbolIcon Grid.Column="3" HorizontalAlignment="Right" Margin="16,8" Opacity="0.5" Symbol="Delete" MouseUp="SymbolIconDelete_MouseUp"/>
</Grid>
</Border>
</UserControl>
3 changes: 2 additions & 1 deletion ZongziTEK_Blackboard_Sticker/TimetableEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:local="clr-namespace:ZongziTEK_Blackboard_Sticker.Resources"
mc:Ignorable="d"
Title="ZongziTEK 黑板贴 - 课程表编辑器" Height="800" Width="800" MinHeight="450" MinWidth="800"
Title="ZongziTEK 黑板贴 - 课程表编辑器" Height="600" Width="800" MinHeight="450" MinWidth="800"
ui:WindowHelper.UseModernWindowStyle="True"
ui:ThemeManager.RequestedTheme="Light"
Background="#fff3f3f3"
Expand All @@ -33,6 +33,7 @@
<ColumnDefinition/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="48"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="课程名称" FontSize="14" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="开始时间" FontSize="14" HorizontalAlignment="Center" VerticalAlignment="Center"/>
Expand Down
10 changes: 2 additions & 8 deletions ZongziTEK_Blackboard_Sticker/TimetableEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,7 @@ private void Item_LessonInfoChanged(object sender, EventArgs e)
try
{
Lesson lesson = new Lesson(changedItem.Subject, TimeSpan.Parse(changedItem.StartTime), TimeSpan.Parse(changedItem.EndTime));
if (index < GetSelectedDay().Count)
{
GetSelectedDay()[index] = lesson;
}
else
{
GetSelectedDay().Add(lesson);
}
GetSelectedDay()[index] = lesson;
}
catch { }
}
Expand All @@ -122,6 +115,7 @@ private void ButtonInsertLesson_Click(object sender, RoutedEventArgs e)
TimetableEditorItem item = new TimetableEditorItem();
item.LessonInfoChanged += Item_LessonInfoChanged;
item.LessonDeleting += Item_LessonDeleting;
GetSelectedDay().Add(new Lesson("",new TimeSpan(0,0,0),new TimeSpan(0,0,0)));
ListStackPanel.Children.Add(item);
}
#endregion
Expand Down

0 comments on commit c871191

Please sign in to comment.