06.04.2022 15:37
This commit is contained in:
parent
9a514dcb4e
commit
3c2e0b9f82
|
@ -3,4 +3,7 @@
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||||
</startup>
|
</startup>
|
||||||
|
<appSettings>
|
||||||
|
<add key="JsonUrl" value="https://git.weifer.org/weifer/Test_App/raw/branch/master/Test_App/Ressources/data.json" />
|
||||||
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
BIN
Test_App/Images/code.ico
Normal file
BIN
Test_App/Images/code.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
|
@ -10,7 +10,8 @@
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
MouseDown="Drag_Window">
|
MouseDown="Drag_Window"
|
||||||
|
Icon="Images/code.ico">
|
||||||
<Border Background="#232041" CornerRadius="30,60,30,0">
|
<Border Background="#232041" CornerRadius="30,60,30,0">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
@ -25,8 +26,8 @@
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel Grid.Row="1">
|
<StackPanel Grid.Row="1">
|
||||||
<Button Content="Home" HorizontalAlignment="Center" VerticalAlignment="Top" Height="59" Width="198" BorderBrush="{x:Null}" Style="{StaticResource Button_Hover}" Click="home_on_click" FontFamily="Tw Cen MT" />
|
<Button Content="Home" HorizontalAlignment="Center" VerticalAlignment="Top" Height="59" Width="198" BorderBrush="{x:Null}" Style="{StaticResource Button_Hover}" Click="home_on_click" FontFamily="Tw Cen MT" />
|
||||||
<Button Content="Start" HorizontalAlignment="Center" VerticalAlignment="Top" Height="59" Width="198" BorderBrush="{x:Null}" Style="{StaticResource Button_Hover}" Click="start_on_click" FontFamily="Tw Cen MT"/>
|
<Button Content="Test" HorizontalAlignment="Center" VerticalAlignment="Top" Height="59" Width="198" BorderBrush="{x:Null}" Style="{StaticResource Button_Hover}" Click="start_on_click" FontFamily="Tw Cen MT" ToolTip="Teste dein Wissen"/>
|
||||||
<Button Content="Datenbank" HorizontalAlignment="Center" VerticalAlignment="Top" Height="59" Width="198" BorderBrush="{x:Null}" Style="{StaticResource Button_Hover}" Click="datenbank_on_click" FontFamily="Tw Cen MT"/>
|
<Button Content="Datenbank" HorizontalAlignment="Center" VerticalAlignment="Top" Height="59" Width="198" BorderBrush="{x:Null}" Style="{StaticResource Button_Hover}" Click="datenbank_on_click" FontFamily="Tw Cen MT" ToolTip="Eine Liste aller Fragaen auf einem Blick"/>
|
||||||
<Button Content="Info" HorizontalAlignment="Center" VerticalAlignment="Top" Height="59" Width="198" BorderBrush="{x:Null}" Style="{StaticResource Button_Hover}" Click="info_on_click" FontFamily="Tw Cen MT"/>
|
<Button Content="Info" HorizontalAlignment="Center" VerticalAlignment="Top" Height="59" Width="198" BorderBrush="{x:Null}" Style="{StaticResource Button_Hover}" Click="info_on_click" FontFamily="Tw Cen MT"/>
|
||||||
<Button Content="Quit" HorizontalAlignment="Center" VerticalAlignment="Top" Height="59" Width="198" BorderBrush="{x:Null}" Style="{StaticResource Button_Hover}" Click="exit_on_click" FontFamily="Tw Cen MT"/>
|
<Button Content="Quit" HorizontalAlignment="Center" VerticalAlignment="Top" Height="59" Width="198" BorderBrush="{x:Null}" Style="{StaticResource Button_Hover}" Click="exit_on_click" FontFamily="Tw Cen MT"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
@ -72,7 +73,7 @@ namespace Test_App
|
||||||
}
|
}
|
||||||
private void Ping_Url()
|
private void Ping_Url()
|
||||||
{
|
{
|
||||||
var hostUrl = "git.weifer.org";
|
var hostUrl = "www.google.de";
|
||||||
|
|
||||||
Ping ping = new Ping();
|
Ping ping = new Ping();
|
||||||
try
|
try
|
||||||
|
|
|
@ -27,3 +27,10 @@ Copy Right als Laufschrift
|
||||||
|
|
||||||
Doppelklick auf Item in Datenbank -> öffnet neues Fenster mit der Antwort
|
Doppelklick auf Item in Datenbank -> öffnet neues Fenster mit der Antwort
|
||||||
|
|
||||||
|
Tooltips zu den Menü Buttons
|
||||||
|
|
||||||
|
Bei Verbindungsproblemen Client oder Serverseitig wird nun darauf hingewiesen
|
||||||
|
|
||||||
|
Json Url nun in die App Config Implementiert
|
||||||
|
|
||||||
|
Info Frame erstellt
|
|
@ -1,13 +1,12 @@
|
||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<Style BasedOn="{StaticResource {x:Type TextBox}}"
|
<Style BasedOn="{StaticResource {x:Type TextBlock}}"
|
||||||
TargetType="{x:Type TextBox}"
|
TargetType="{x:Type TextBlock}"
|
||||||
x:Key="Custom_Window">
|
x:Key="Custom_Window">
|
||||||
<Setter Property="Background" Value="#232041"/>
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
<Setter Property="FontSize" Value="22"/>
|
<Setter Property="FontSize" Value="22"/>
|
||||||
<Setter Property="FontFamily" Value="Tw Cen MT"/>
|
<Setter Property="FontFamily" Value="Tw Cen MT"/>
|
||||||
<Setter Property="Foreground" Value="White"/>
|
<Setter Property="Foreground" Value="White"/>
|
||||||
<Setter Property="Width" Value="430"/>
|
|
||||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||||
<Setter Property="TextWrapping" Value="Wrap"/>
|
<Setter Property="TextWrapping" Value="Wrap"/>
|
||||||
<Setter Property="TextWrapping" Value="Wrap"/>
|
<Setter Property="TextWrapping" Value="Wrap"/>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<ProjectGuid>{90B7D34D-C7F6-4BCF-88D5-20FF99927438}</ProjectGuid>
|
<ProjectGuid>{90B7D34D-C7F6-4BCF-88D5-20FF99927438}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<RootNamespace>Test_App</RootNamespace>
|
<RootNamespace>Test_App</RootNamespace>
|
||||||
<AssemblyName>Test_App</AssemblyName>
|
<AssemblyName>FIAE Prüfungsapp</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
<UpdatePeriodically>false</UpdatePeriodically>
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
<UpdateRequired>false</UpdateRequired>
|
<UpdateRequired>false</UpdateRequired>
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
<ApplicationRevision>1</ApplicationRevision>
|
<ApplicationRevision>3</ApplicationRevision>
|
||||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
|
@ -62,11 +62,15 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<SignManifests>true</SignManifests>
|
<SignManifests>true</SignManifests>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationIcon>code.ico</ApplicationIcon>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
@ -99,9 +103,6 @@
|
||||||
<Compile Include="Views\Info.xaml.cs">
|
<Compile Include="Views\Info.xaml.cs">
|
||||||
<DependentUpon>Info.xaml</DependentUpon>
|
<DependentUpon>Info.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\MainView.xaml.cs">
|
|
||||||
<DependentUpon>MainView.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Views\Start.xaml.cs">
|
<Compile Include="Views\Start.xaml.cs">
|
||||||
<DependentUpon>Start.xaml</DependentUpon>
|
<DependentUpon>Start.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -145,10 +146,6 @@
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\MainView.xaml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
</Page>
|
|
||||||
<Page Include="Views\Start.xaml">
|
<Page Include="Views\Start.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
@ -208,5 +205,11 @@
|
||||||
<Install>false</Install>
|
<Install>false</Install>
|
||||||
</BootstrapperPackage>
|
</BootstrapperPackage>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Images\code.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="code.ico" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -20,7 +21,7 @@ namespace Test_App.Views
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Database : Page
|
public partial class Database : Page
|
||||||
{
|
{
|
||||||
|
public string content { get; set; }
|
||||||
public Database()
|
public Database()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
@ -28,6 +29,7 @@ namespace Test_App.Views
|
||||||
OutputJson();
|
OutputJson();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Parst Json von der Webseite in eine Liste
|
||||||
public void OutputJson()
|
public void OutputJson()
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -36,7 +38,7 @@ namespace Test_App.Views
|
||||||
webclient.Encoding = Encoding.UTF8;
|
webclient.Encoding = Encoding.UTF8;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
json = webclient.DownloadString("https://git.weifer.org/weifer/Test_App/raw/branch/master/Test_App/Ressources/data.json");
|
json = webclient.DownloadString(ConfigurationManager.AppSettings.Get("JsonUrl"));
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -47,38 +49,28 @@ namespace Test_App.Views
|
||||||
|
|
||||||
datalist.ItemsSource = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Ressources.Datas>>(json);
|
datalist.ItemsSource = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Ressources.Datas>>(json);
|
||||||
}
|
}
|
||||||
|
// Ändert die Hintergrundfarbe beim betreten mit der Maus
|
||||||
private void border_MouseEnter(object sender, MouseEventArgs e)
|
private void border_MouseEnter(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
Border border = sender as Border;
|
Border border = sender as Border;
|
||||||
border.Background = new SolidColorBrush(Colors.LightGray);
|
border.Background = new SolidColorBrush(Colors.LightGray);
|
||||||
}
|
}
|
||||||
|
// Ändert die Hintergrundfarbe beim verlassen der Maus
|
||||||
private void border_MouseLeave(object sender, MouseEventArgs e)
|
private void border_MouseLeave(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
Border border = sender as Border;
|
Border border = sender as Border;
|
||||||
border.Background = new SolidColorBrush(Colors.WhiteSmoke);
|
border.Background = new SolidColorBrush(Colors.WhiteSmoke);
|
||||||
}
|
}
|
||||||
|
// Öffnet neues Fenster (Database_Info) und übergibt die Antwort als string
|
||||||
private void itemOnClick(object sender, MouseButtonEventArgs e)
|
private void itemOnClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
Ressources.Datas current = datalist.SelectedItem as Ressources.Datas;
|
Ressources.Datas current = datalist.SelectedItem as Ressources.Datas;
|
||||||
Database_Info window = new Database_Info();
|
content = current.Answer;
|
||||||
|
Database_Info window = new Database_Info(content);
|
||||||
window.Show();
|
window.Show();
|
||||||
|
}
|
||||||
|
|
||||||
/*TextBox textBox = new TextBox();
|
}
|
||||||
textBox.Style = (Style)FindResource("Custom_Window");
|
|
||||||
textBox.Text = "Antwort: \n" + current.Answer + "\n";
|
|
||||||
|
|
||||||
Window window = new Window();
|
|
||||||
window.Width = 550;
|
|
||||||
window.Height = 300;
|
|
||||||
window.SizeToContent = SizeToContent.WidthAndHeight;
|
|
||||||
window.Content = textBox;
|
|
||||||
window.Show();*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
MouseDown="Drag_Window"
|
MouseDown="Drag_Window"
|
||||||
Name="databse_info_window">
|
Name="databse_info_window"
|
||||||
|
Icon="../Images/code.ico">
|
||||||
<Border Background="#232041" CornerRadius="30,60,30,0">
|
<Border Background="#232041" CornerRadius="30,60,30,0">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
@ -21,7 +22,7 @@
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Button Content="X" HorizontalAlignment="Left" Margin="483,10,0,0" VerticalAlignment="Top" Height="26" Width="29" Background="Transparent" Foreground="White" BorderBrush="{x:Null}" FontWeight="Bold" FontFamily="Tw Cen MT" FontSize="20" RenderTransformOrigin="-0.258,0.549" Click="close_window"/>
|
<Button Content="X" HorizontalAlignment="Left" Margin="483,10,0,0" VerticalAlignment="Top" Height="26" Width="29" Background="Transparent" Foreground="White" BorderBrush="{x:Null}" FontWeight="Bold" FontFamily="Tw Cen MT" FontSize="20" RenderTransformOrigin="-0.258,0.549" Click="close_window"/>
|
||||||
<TextBox x:Name="database_info_window_textbox" HorizontalAlignment="Center" Margin="0,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="494" Height="236" Style="{StaticResource Custom_Window}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" Focusable="False"/>
|
<TextBlock Name="database_info_textblock" TextWrapping="Wrap" Text="TextBlock" Margin="21,36,22,19" Style="{StaticResource Custom_Window}" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
|
@ -19,21 +19,29 @@ namespace Test_App.Views
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Database_Info : Window
|
public partial class Database_Info : Window
|
||||||
{
|
{
|
||||||
public Database_Info()
|
public Database_Info(string text)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
SetTextBlockText(text);
|
||||||
}
|
}
|
||||||
|
// Macht das fenster mit linkem Mausklick verschiebbar
|
||||||
private void Drag_Window(object sender, MouseButtonEventArgs e)
|
private void Drag_Window(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.ChangedButton == MouseButton.Left)
|
if (e.ChangedButton == MouseButton.Left)
|
||||||
this.DragMove();
|
this.DragMove();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Wird dem X Button zugewiesen um das Fenster zu schließen
|
||||||
private void close_window(object sender, RoutedEventArgs e)
|
private void close_window(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var window = Application.Current.Windows.OfType<Window>().SingleOrDefault(x => x.IsActive);
|
var window = Application.Current.Windows.OfType<Window>().SingleOrDefault(x => x.IsActive);
|
||||||
window.Close();
|
window.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wird bei Fenster aufruf ausgeführt um den Parameter einzusetzen
|
||||||
|
public void SetTextBlockText(string text)
|
||||||
|
{
|
||||||
|
database_info_textblock.Text = text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,27 +6,5 @@
|
||||||
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">
|
||||||
<TextBlock
|
<TextBox Name="block" HorizontalAlignment="Center" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Center" Height="505" Width="582" Foreground="#FFFDFDFD" FontFamily="Verdana" FontSize="15" SelectionBrush="Blue" BorderBrush="{x:Null}" Background="Transparent" BorderThickness="0" IsReadOnly="True" IsInactiveSelectionHighlightEnabled="True"/>
|
||||||
Name="MyWipedText"
|
|
||||||
Margin="20"
|
|
||||||
Width="480" Height="100" FontSize="48" FontWeight="Bold" Foreground="Maroon">
|
|
||||||
Ist in Arbeit
|
|
||||||
|
|
||||||
<!-- Animates the text block's width. -->
|
|
||||||
<TextBlock.Triggers>
|
|
||||||
<EventTrigger RoutedEvent="TextBlock.Loaded">
|
|
||||||
<BeginStoryboard>
|
|
||||||
<Storyboard>
|
|
||||||
<DoubleAnimation
|
|
||||||
Storyboard.TargetName="MyWipedText"
|
|
||||||
Storyboard.TargetProperty="(TextBlock.Width)"
|
|
||||||
To="0.0" Duration="0:0:10"
|
|
||||||
AutoReverse="True" RepeatBehavior="Forever" />
|
|
||||||
</Storyboard>
|
|
||||||
</BeginStoryboard>
|
|
||||||
</EventTrigger>
|
|
||||||
</TextBlock.Triggers>
|
|
||||||
</TextBlock>
|
|
||||||
|
|
||||||
|
|
||||||
</Page>
|
</Page>
|
|
@ -23,11 +23,21 @@ namespace Test_App.Views
|
||||||
public Info()
|
public Info()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
block.Text = "Diese App beinhaltet mögliche Prüfungsfragen zum Teil 1 der Abschlussprüfung.\n" +
|
||||||
|
"\nDie Fragen stammen aus einer Offiziellen Quelle sind abgeändert und sind sehr nah an die echten Prüfungsfragen angelehnt.\n\n" +
|
||||||
|
"Die Fragen Datenbank ist hierbei Dynamisch, die Fragen und Antworten werden von einem Server abgerufen, deswegen ist eine Internetverbindung wichtig.\n\n" +
|
||||||
|
"Bis zum Sommer 2022 werde ich alle Fragen zum Teil 1 der Abschlussprüfung hinzufügen.\n" +
|
||||||
|
"Bis zum Sommer 2023 werde ich die Fragen mit Prüfungsrelevanten Fragen zur Abschlussprüfung Teil 2 ergänzen.\n\n" +
|
||||||
|
"Bei Fragen, wendet euch an mich im FIAE Discord\n" +
|
||||||
|
"Marcus Ferl\n\n" +
|
||||||
|
"Oder eine Email an:\n" +
|
||||||
|
"support@weifer.de\n" +
|
||||||
|
"\nFalls jemand meine Arbeit unterstützen will, (die Fragen waren nicht kostenlis):\n\n" +
|
||||||
|
"Paypal: marcus@weifer.de\n" +
|
||||||
|
"Bitcoin: 17ruVoy3NXooM5yRbva9Kz898hB75XYqtx\n";
|
||||||
|
|
||||||
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
|
}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
<Page x:Class="Test_App.Views.MainView"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:local="clr-namespace:Test_App.Views"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
|
||||||
Title="MainView">
|
|
||||||
|
|
||||||
<Grid>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</Page>
|
|
|
@ -1,28 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace Test_App.Views
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaktionslogik für MainView.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class MainView : Page
|
|
||||||
{
|
|
||||||
public MainView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -17,7 +17,7 @@
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<TextBox x:Name="question_textbox" Style="{StaticResource Textbox_Round_Corners}" Grid.Row="0" Background="#FF9A9494" TextWrapping="Wrap" Foreground="White" SelectionBrush="{x:Null}" FontSize="22" HorizontalAlignment="Center" VerticalAlignment="Center" BorderBrush="{x:Null}" Focusable="False" Cursor="None" IsEnabled="False" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Width="719" Height="205" TextChanged="question_textbox_TextChanged"/>
|
<TextBox x:Name="question_textbox" Style="{StaticResource Textbox_Round_Corners}" Grid.Row="0" Background="#FF9A9494" TextWrapping="Wrap" Foreground="White" SelectionBrush="{x:Null}" FontSize="22" HorizontalAlignment="Center" VerticalAlignment="Center" BorderBrush="{x:Null}" Focusable="False" Cursor="None" IsEnabled="False" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Width="719" Height="205"/>
|
||||||
<TextBox x:Name="answer_textbox" Style="{StaticResource Textbox_Round_Corners}" Grid.Row="1" Background="#FF6C74F1" TextWrapping="Wrap" Foreground="Black" SelectionBrush="{x:Null}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" BorderBrush="{x:Null}" Focusable="False" Cursor="None" IsEnabled="False" Width="720" Height="188" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="0,0,0,50"/>
|
<TextBox x:Name="answer_textbox" Style="{StaticResource Textbox_Round_Corners}" Grid.Row="1" Background="#FF6C74F1" TextWrapping="Wrap" Foreground="Black" SelectionBrush="{x:Null}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" BorderBrush="{x:Null}" Focusable="False" Cursor="None" IsEnabled="False" Width="720" Height="188" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="0,0,0,50"/>
|
||||||
|
|
||||||
<Button Content="Answer" Background="#232041" FontSize="30px" HorizontalAlignment="Left" Margin="113,214,0,0" Grid.Row="1" VerticalAlignment="Top" Height="40" Width="109" Style="{StaticResource Button_Hover}" Click="Get_Answer_Button"/>
|
<Button Content="Answer" Background="#232041" FontSize="30px" HorizontalAlignment="Left" Margin="113,214,0,0" Grid.Row="1" VerticalAlignment="Top" Height="40" Width="109" Style="{StaticResource Button_Hover}" Click="Get_Answer_Button"/>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -22,23 +23,27 @@ namespace Test_App.Views
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Start : Page
|
public partial class Start : Page
|
||||||
{
|
{
|
||||||
string json_url = "https://git.weifer.org/weifer/Pruefungskatalog/raw/branch/master/assets/questions_answers.json";
|
string json_url = ConfigurationManager.AppSettings.Get("JsonUrl"); // Json File
|
||||||
|
|
||||||
string get_questions = "";
|
string get_questions = "";
|
||||||
string get_answer = "";
|
string get_answer = "";
|
||||||
//dynamic data = null;
|
List<int> list = new List<int>();
|
||||||
public Start()
|
public Start()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
// data = get_jsonData(json_url);
|
liste();
|
||||||
|
|
||||||
}
|
}
|
||||||
// Buttons
|
// ### Buttons ###
|
||||||
|
|
||||||
|
// Gibt eine Zufallsfrage aus
|
||||||
private void Next_Button_Click(object sender, RoutedEventArgs e)
|
private void Next_Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
get_question();
|
get_question();
|
||||||
question_textbox.Text = get_questions;
|
question_textbox.Text = get_questions;
|
||||||
answer_textbox.Text = "";
|
answer_textbox.Text = "";
|
||||||
}
|
}
|
||||||
|
// Gibt antwort auf Zufallsfrage aus
|
||||||
private void Get_Answer_Button(object sender, RoutedEventArgs e)
|
private void Get_Answer_Button(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (get_answer.Length < 100)
|
if (get_answer.Length < 100)
|
||||||
|
@ -50,41 +55,56 @@ namespace Test_App.Views
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Json
|
// Convertiert Json von der Url
|
||||||
dynamic get_jsonData(string url)
|
dynamic get_jsonData(string url)
|
||||||
{
|
{
|
||||||
string json = "";
|
string json = "";
|
||||||
var webclient = new System.Net.WebClient();
|
var webclient = new System.Net.WebClient();
|
||||||
webclient.Encoding = Encoding.UTF8;
|
webclient.Encoding = Encoding.UTF8; // Damit umlaute angezeigt werde
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
json = webclient.DownloadString(url);
|
json = webclient.DownloadString(url);
|
||||||
}
|
}
|
||||||
catch (System.Net.WebException e)
|
catch
|
||||||
{
|
{
|
||||||
throw e;
|
var window = Application.Current.Windows.OfType<Window>().SingleOrDefault(x => x.IsActive);
|
||||||
|
window.Close();
|
||||||
|
MessageBox.Show("Keine Verbindung zum Server möglich. Versuche es Später nocheinmal");
|
||||||
|
|
||||||
}
|
}
|
||||||
dynamic dynJson = JsonConvert.DeserializeObject(json);
|
dynamic dynJson = JsonConvert.DeserializeObject(json);
|
||||||
return dynJson;
|
return dynJson;
|
||||||
|
|
||||||
}
|
}
|
||||||
// Returns random String from a Random Json Object in JsonData
|
// Erstellt die Zufallsfrage
|
||||||
public void get_question()
|
public void get_question()
|
||||||
{
|
{
|
||||||
|
|
||||||
dynamic json_data = get_jsonData(json_url);
|
dynamic json_data = get_jsonData(json_url);
|
||||||
int count = json_data.Count; // Count Json Objects
|
int random_number_counter = new Random().Next(0, list.Count); // Generiert eine Zufallsindex
|
||||||
int random_number = new Random().Next(0, 40); // Random number between 0, and all Json Objects
|
int random_number = list.ElementAt(random_number_counter); // Gibt die Zahl am Listindex aus
|
||||||
get_questions = json_data[random_number][$"{random_number}"]["question"];
|
|
||||||
|
|
||||||
get_answer = json_data[random_number][$"{random_number}"]["answer"];
|
get_questions = json_data[random_number]["Question"];
|
||||||
|
get_answer = json_data[random_number]["Answer"];
|
||||||
|
|
||||||
|
list.RemoveAt(random_number_counter); // Entfernt die Zahl aus der Liste um Wiederholungen zu vermeiden
|
||||||
|
|
||||||
}
|
if (!list.Any())
|
||||||
|
|
||||||
private void question_textbox_TextChanged(object sender, TextChangedEventArgs e)
|
|
||||||
{
|
{
|
||||||
|
MessageBox.Show("Alle Fragen erreicht!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Erstellen der Zahlen Liste für die Zufallszahl
|
||||||
|
public void liste()
|
||||||
|
{
|
||||||
|
dynamic json_data = get_jsonData(json_url);
|
||||||
|
int count = json_data.Count;
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
list.Add(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
Test_App/code.ico
Normal file
BIN
Test_App/code.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Loading…
Reference in New Issue
Block a user