Skip to content

Commit 7d10403

Browse files
committed
debug; add validation output
1 parent 688f085 commit 7d10403

File tree

8 files changed

+244
-180
lines changed

8 files changed

+244
-180
lines changed

Diff for: LearnJsonEverything.LessonEditor/Controls/Editor.xaml

+29-19
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<RowDefinition Height="Auto"/>
2222
</Grid.RowDefinitions>
2323
<Grid.ColumnDefinitions>
24-
<ColumnDefinition Width="Auto"/>
24+
<ColumnDefinition Width="1*"/>
2525
<ColumnDefinition Width="2*"/>
2626
<ColumnDefinition Width="3*"/>
2727
</Grid.ColumnDefinitions>
@@ -30,7 +30,8 @@
3030
<RowDefinition/>
3131
<RowDefinition Height="Auto"/>
3232
</Grid.RowDefinitions>
33-
<ListBox MinWidth="100" ItemsSource="{Binding Lessons, ElementName=Self}"
33+
<ListBox MinWidth="100"
34+
ItemsSource="{Binding Lessons, ElementName=Self}"
3435
SelectedItem="{Binding SelectedLesson, ElementName=Self}">
3536
<ListBox.ItemTemplate>
3637
<DataTemplate DataType="{x:Type services:LessonData}">
@@ -52,26 +53,33 @@
5253
</Grid>
5354
</Grid>
5455
<Grid Grid.Column="1" Margin="5">
55-
<Grid.RowDefinitions>
56-
<RowDefinition Height="Auto"/>
57-
<RowDefinition/>
58-
<RowDefinition Height="Auto"/>
59-
<RowDefinition/>
60-
</Grid.RowDefinitions>
61-
<local:TextInput Label="Title" TextContent="{Binding LessonTitle, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
62-
<local:TextInput Grid.Row="1" Label="Background" TextContent="{Binding LessonBackground, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
63-
<local:TextInput Grid.Row="2" Label="Docs Path (from root on docs.json-everything.net)" TextContent="{Binding DocsPath, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
64-
<local:TextInput Grid.Row="3" Label="Instructions" TextContent="{Binding Instructions, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
56+
<Grid.RowDefinitions>
57+
<RowDefinition Height="Auto"/>
58+
<RowDefinition/>
59+
<RowDefinition Height="Auto"/>
60+
<RowDefinition/>
61+
</Grid.RowDefinitions>
62+
<local:TextInput Label="Title
63+
" TextContent="{Binding SelectedLesson.Title, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
64+
<local:TextInput Grid.Row="1" Label="Background"
65+
TextContent="{Binding SelectedLesson.Background, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
66+
<local:TextInput Grid.Row="2" Label="Docs Path (from root on docs.json-everything.net)"
67+
TextContent="{Binding SelectedLesson.DocsPath, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
68+
<local:TextInput Grid.Row="3" Label="Instructions"
69+
TextContent="{Binding SelectedLesson.Instructions, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
6570
</Grid>
6671
<Grid Grid.Column="2" Grid.RowSpan="2" Margin="5">
6772
<Grid.RowDefinitions>
68-
<RowDefinition/>
73+
<RowDefinition Height="3*"/>
74+
<RowDefinition Height="3*"/>
6975
<RowDefinition/>
7076
</Grid.RowDefinitions>
7177
<local:CodeInput Label="Initial Code" Margin="0,0,5,5"
72-
CodeContent="{Binding InitialCode, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
73-
<local:CodeInput Grid.Row="1" Label="Solution" Margin="0,5,5,0"
74-
CodeContent="{Binding Solution, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
78+
CodeContent="{Binding SelectedLesson.InitialCode, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
79+
<local:CodeInput Grid.Row="1" Label="Solution" Margin="0,5,5,5"
80+
CodeContent="{Binding SelectedLesson.Solution, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
81+
<local:CodeInput Grid.Row="2" Label="Solution" Margin="0,5,5,0"
82+
CodeContent="{Binding ValidationOutput, ElementName=Self}"/>
7583
<Button Grid.Row="1" Content="Copy from above" Click="CopyInitialToSolution"
7684
HorizontalAlignment="Right" VerticalAlignment="Top"
7785
Padding="10,0"/>
@@ -83,7 +91,9 @@
8391
<RowDefinition Height="Auto"/>
8492
</Grid.RowDefinitions>
8593
<Label Content="Tests"/>
86-
<ListBox Grid.Row="1" ItemsSource="{Binding Tests, ElementName=Self}" SelectedItem="{Binding SelectedTest, ElementName=Self}">
94+
<ListBox Grid.Row="1" SelectionChanged="SelectedTestChanged"
95+
ItemsSource="{Binding SelectedLesson.Tests, ElementName=Self}"
96+
SelectedItem="{Binding SelectedLesson.SelectedTest, ElementName=Self}">
8797
<ListBox.ItemTemplate>
8898
<DataTemplate DataType="{x:Type local:TestModel}">
8999
<TextBlock Text="{Binding Condensed}"/>
@@ -103,8 +113,8 @@
103113
<Button Content="🡇" Click="MoveTestDown" Grid.Column="3"/>
104114
</Grid>
105115
</Grid>
106-
<local:CodeInput Grid.Column="1" Grid.Row="1" Label="Test Data" Margin="5"
107-
CodeContent="{Binding SelectedTest.Formatted, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
116+
<local:CodeInput x:Name="TestInput" Grid.Column="1" Grid.Row="1" Label="Test Data" Margin="5"
117+
CodeContent="{Binding SelectedLesson.SelectedTest.Formatted, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
108118
<StackPanel Grid.Row="2" Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,5,5">
109119
<Button Content="Validate" Click="ValidateSolution"/>
110120
<Button Content="Save" Click="SaveChanges" IsEnabled="{Binding CanSave, ElementName=Self}"/>

0 commit comments

Comments
 (0)