Projektdateien hinzufügen.
This commit is contained in:
parent
adba644522
commit
dff5de30de
9
App.xaml
Normal file
9
App.xaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<Application x:Class="WährungsrechnerOOC.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:WährungsrechnerOOC"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
14
App.xaml.cs
Normal file
14
App.xaml.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace WährungsrechnerOOC
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
10
AssemblyInfo.cs
Normal file
10
AssemblyInfo.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
26
MainWindow.xaml
Normal file
26
MainWindow.xaml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<Window x:Class="EuroToDollarConverter.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
Title="Euro-Umrechner" Height="300" Width="400">
|
||||||
|
<Grid VerticalAlignment="Center">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBox Name="euroBox" Width="300" Height="40" Margin="10" FontSize="16" Grid.Row="0"
|
||||||
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center" />
|
||||||
|
<ComboBox Name="currencyBox" Width="300" Height="40" Margin="10" FontSize="16" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||||
|
HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
|
||||||
|
<ComboBoxItem Content="Dollar $"/>
|
||||||
|
<ComboBoxItem Content="Pfund £" />
|
||||||
|
<ComboBoxItem Content="Yen ¥"/>
|
||||||
|
<ComboBoxItem Content="Lira ₺"/>
|
||||||
|
<ComboBoxItem Content="Dirham د. إ "/>
|
||||||
|
</ComboBox>
|
||||||
|
<Button Content="Umrechnen" Width="300" Height="40" Margin="10" FontSize="16" Grid.Row="2" Click="Convert_Click"/>
|
||||||
|
<TextBox Name="dollarBox" Width="300" Height="40" Margin="10" FontSize="16" Grid.Row="3" IsReadOnly="True"
|
||||||
|
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
127
MainWindow.xaml.cs
Normal file
127
MainWindow.xaml.cs
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace EuroToDollarConverter
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
public MainWindow()
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Convert_Click(object sender, RoutedEventArgs e)
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
string eingabe = euroBox.Text;
|
||||||
|
|
||||||
|
bool Nummer = true;
|
||||||
|
|
||||||
|
foreach (char c in eingabe)
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ((c < '0' || c > '9') && c != ',')
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
Nummer = false;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Nummer)
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
MessageBox.Show("Nur Ziffern und maximal ein Komma erlaubt!");
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
double euro = Convert.ToDouble(eingabe);
|
||||||
|
|
||||||
|
double rate = 1;
|
||||||
|
|
||||||
|
ComboBoxItem Item = currencyBox.SelectedItem as ComboBoxItem;
|
||||||
|
|
||||||
|
if (Item == null)
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
MessageBox.Show("Bitte wählen Sie eine Währung aus.");
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
string Währung = Item.Content.ToString();
|
||||||
|
|
||||||
|
switch (Währung)
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
case "Dollar $":
|
||||||
|
|
||||||
|
rate = 1.10;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Pfund £":
|
||||||
|
|
||||||
|
rate = 0.85;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Yen ¥":
|
||||||
|
|
||||||
|
rate = 160.50;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Lira ₺":
|
||||||
|
|
||||||
|
rate = 35;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Dirham د. إ ":
|
||||||
|
|
||||||
|
rate = 10;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
|
||||||
|
MessageBox.Show("Unbekannte Währung ausgewählt.");
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
double result = euro * rate;
|
||||||
|
|
||||||
|
dollarBox.Text = result.ToString("F2");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
11
WährungsrechnerOOC.csproj
Normal file
11
WährungsrechnerOOC.csproj
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
25
WährungsrechnerOOC.sln
Normal file
25
WährungsrechnerOOC.sln
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.13.35931.197 d17.13
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WährungsrechnerOOC", "WährungsrechnerOOC.csproj", "{07E8B74D-7967-4584-B2D9-E614252EE777}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{07E8B74D-7967-4584-B2D9-E614252EE777}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{07E8B74D-7967-4584-B2D9-E614252EE777}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{07E8B74D-7967-4584-B2D9-E614252EE777}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{07E8B74D-7967-4584-B2D9-E614252EE777}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {1075A1FD-F275-4BDB-804E-B8AD906C91F7}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
Loading…
x
Reference in New Issue
Block a user