04.04.2022
This commit is contained in:
parent
5190f4d046
commit
77ec2ab7e6
8
Test_App/Ressources/Students.json
Normal file
8
Test_App/Ressources/Students.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"ID": "1",
|
||||||
|
"Question": "John Doe",
|
||||||
|
"Answer": "Male"
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
|
@ -138,6 +138,7 @@
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="Ressources\Students.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
|
|
|
@ -6,35 +6,41 @@
|
||||||
xmlns:local="clr-namespace:Test_App.Views"
|
xmlns:local="clr-namespace:Test_App.Views"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="525" d:DesignWidth="602">
|
d:DesignHeight="525" d:DesignWidth="602">
|
||||||
|
<Page.Resources>
|
||||||
|
<DataTemplate x:Key="datas">
|
||||||
|
<Border Name="border" BorderBrush="DarkSlateBlue" BorderThickness="2"
|
||||||
|
CornerRadius="2" Padding="5" Margin="5" Background="WhiteSmoke">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Grid>
|
<TextBlock Grid.Row="0" Grid.Column="0" Padding="0,0,5,0" Text="ID:"/>
|
||||||
<Grid.RowDefinitions>
|
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=ID}"/>
|
||||||
<RowDefinition Height="*"/>
|
<TextBlock Grid.Row="1" Grid.Column="0" Padding="0,0,5,0" Text="Question: "/>
|
||||||
<RowDefinition/>
|
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Question}"/>
|
||||||
<RowDefinition/>
|
<TextBlock Grid.Row="2" Grid.Column="0" Padding="0,0,5,0" Text="Answer:"/>
|
||||||
<RowDefinition/>
|
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=Answer}"/>
|
||||||
<RowDefinition/>
|
|
||||||
<RowDefinition/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
</Grid>
|
||||||
<ColumnDefinition Width="Auto" />
|
</Border>
|
||||||
<ColumnDefinition />
|
</DataTemplate>
|
||||||
</Grid.ColumnDefinitions>
|
</Page.Resources>
|
||||||
|
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0" Padding="0,0,5,0" Text="ID:"/>
|
|
||||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=ID}"/>
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0" Padding="0,0,5,0" Text="Name:"/>
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Name}"/>
|
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0" Padding="0,0,5,0" Text="Gender:"/>
|
|
||||||
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=Gender}"/>
|
|
||||||
<TextBlock Grid.Row="3" Grid.Column="0" Padding="0,0,5,0" Text="Class:"/>
|
|
||||||
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Path=Class}"/>
|
|
||||||
<TextBlock Grid.Row="4" Grid.Column="0" Padding="0,0,5,0" Text="Seat:"/>
|
|
||||||
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding Path=Seat}"/>
|
|
||||||
<TextBlock Grid.Row="5" Grid.Column="0" Padding="0,0,5,0" Text="Comment:"/>
|
|
||||||
<TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding Path=Comment}"/>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
|
<DockPanel>
|
||||||
|
<Label DockPanel.Dock="Top" FontSize="20" Margin="5" Content="Database"/>
|
||||||
|
<ListBox x:Name="datalist"
|
||||||
|
ItemsSource="{Binding}"
|
||||||
|
ItemTemplate="{StaticResource datas}"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
IsSynchronizedWithCurrentItem="True"
|
||||||
|
Margin="5,0,5,5" />
|
||||||
|
</DockPanel>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
|
@ -25,8 +25,29 @@ namespace Test_App.Views
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
OutputJson();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void OutputJson()
|
||||||
|
|
||||||
|
{
|
||||||
|
string json = "";
|
||||||
|
var webclient = new System.Net.WebClient();
|
||||||
|
webclient.Encoding = Encoding.UTF8;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
json = webclient.DownloadString("https://git.weifer.org/weifer/Pruefungskatalog/raw/branch/master/assets/questions_answers.json");
|
||||||
|
}
|
||||||
|
catch (System.Net.WebException e)
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
datalist.ItemsSource = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Ressources.Datas>>(json);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user