Projektdateien hinzufügen.
This commit is contained in:
parent
d248befcee
commit
c8dc4d464d
25
MorseCoder.sln
Normal file
25
MorseCoder.sln
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.1.32421.90
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MorseCoder", "MorseCoder\MorseCoder.csproj", "{A29097B8-ED82-4466-8D09-28E1E595149F}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{A29097B8-ED82-4466-8D09-28E1E595149F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A29097B8-ED82-4466-8D09-28E1E595149F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A29097B8-ED82-4466-8D09-28E1E595149F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A29097B8-ED82-4466-8D09-28E1E595149F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {1EADC578-9475-4463-8B94-E09747121771}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
9
MorseCoder/App.xaml
Normal file
9
MorseCoder/App.xaml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<Application x:Class="MorseCoder.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="clr-namespace:MorseCoder"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
17
MorseCoder/App.xaml.cs
Normal file
17
MorseCoder/App.xaml.cs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace MorseCoder
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
10
MorseCoder/AssemblyInfo.cs
Normal file
10
MorseCoder/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)
|
||||||
|
)]
|
29
MorseCoder/MainWindow.xaml
Normal file
29
MorseCoder/MainWindow.xaml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<Window x:Class="MorseCoder.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:MorseCoder"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="MainWindow" Height="450" Width="633">
|
||||||
|
<Grid Margin="0,10,116,0">
|
||||||
|
<Button x:Name="mousen" Content="Morsen" HorizontalAlignment="Left" Margin="109,66,0,0" VerticalAlignment="Top" Height="40" Width="115" BorderBrush="#FF707070" MouseDown="mousen_MouseDown" MouseUp="mousen_MouseUp" />
|
||||||
|
<Label x:Name="label_" Content="Morse Code" HorizontalAlignment="Left" Margin="262,24,0,0" VerticalAlignment="Top" Height="43" Width="202" FontSize="24"/>
|
||||||
|
<Label x:Name="code_label" Content="" HorizontalAlignment="Left" Margin="286,68,0,0" VerticalAlignment="Top" Width="292" FontWeight="Bold" FontSize="18"/>
|
||||||
|
<Button Content="Next" HorizontalAlignment="Left" Margin="136,117,0,0" VerticalAlignment="Top" Height="25" Width="52" Click="Button_Click"/>
|
||||||
|
<Label Content="Decoded" HorizontalAlignment="Left" Margin="262,106,0,0" VerticalAlignment="Top" Height="38" Width="108" FontSize="24"/>
|
||||||
|
<Label x:Name="decode_label" Content="" HorizontalAlignment="Left" Margin="286,150,0,0" VerticalAlignment="Top" Width="292" FontSize="18" FontWeight="Bold"/>
|
||||||
|
<Button x:Name="clear_button" Content="Clear" HorizontalAlignment="Left" Margin="143,152,0,0" VerticalAlignment="Top" Click="Clear_Button_Click" Width="38"/>
|
||||||
|
<Image HorizontalAlignment="Left" Height="198" Margin="46,197,0,0" VerticalAlignment="Top" Width="332" Source="/codec.png" RenderTransformOrigin="0.5,0.5">
|
||||||
|
<Image.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<ScaleTransform/>
|
||||||
|
<SkewTransform/>
|
||||||
|
<RotateTransform Angle="0.101"/>
|
||||||
|
<TranslateTransform/>
|
||||||
|
</TransformGroup>
|
||||||
|
</Image.RenderTransform>
|
||||||
|
</Image>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
75
MorseCoder/MainWindow.xaml.cs
Normal file
75
MorseCoder/MainWindow.xaml.cs
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
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 MorseCoder
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
private int start = 0;
|
||||||
|
private Dictionary<string, string> codeLegende = new Dictionary<string, string>();
|
||||||
|
private List<string> morseWord = new List<string>();
|
||||||
|
private Stopwatch sw = new Stopwatch();
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
|
||||||
|
MorseCode getCode = new MorseCode();
|
||||||
|
getCode.Code(codeLegende);
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void mousen_MouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
sw.Start();
|
||||||
|
}
|
||||||
|
private void mousen_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
sw.Stop();
|
||||||
|
if(sw.Elapsed.TotalMilliseconds > 500)
|
||||||
|
{
|
||||||
|
morseWord.Add("long");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
morseWord.Add("short");
|
||||||
|
}
|
||||||
|
sw.Reset();
|
||||||
|
code_label.Content = String.Join(" ",morseWord);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
foreach(KeyValuePair<string, string> pair in codeLegende)
|
||||||
|
{
|
||||||
|
if(pair.Value.Equals(String.Join(" ", morseWord)))
|
||||||
|
{
|
||||||
|
decode_label.Content += pair.Key;
|
||||||
|
morseWord.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Clear_Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
code_label.Content = "";
|
||||||
|
decode_label.Content = "";
|
||||||
|
morseWord.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
48
MorseCoder/MorseCode.cs
Normal file
48
MorseCoder/MorseCode.cs
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace MorseCoder
|
||||||
|
{
|
||||||
|
|
||||||
|
internal class MorseCode
|
||||||
|
{
|
||||||
|
private Dictionary<string, string> code = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
// Erstellung des KeyValuePair für den MorseCode
|
||||||
|
public Dictionary<string, string> Code(Dictionary<string, string> code)
|
||||||
|
{
|
||||||
|
this.code = code;
|
||||||
|
this.code.Add("A", "short long");
|
||||||
|
this.code.Add("B", "long short short short");
|
||||||
|
this.code.Add("C", "long short long short");
|
||||||
|
this.code.Add("D", "long short short");
|
||||||
|
this.code.Add("E", "short");
|
||||||
|
this.code.Add("F", "short short long short");
|
||||||
|
this.code.Add("G", "long long short");
|
||||||
|
this.code.Add("H", "short short short short");
|
||||||
|
this.code.Add("I", "short short");
|
||||||
|
this.code.Add("J", "short long long long");
|
||||||
|
this.code.Add("K", "long short long");
|
||||||
|
this.code.Add("L", "short long short short");
|
||||||
|
this.code.Add("M", "long long");
|
||||||
|
this.code.Add("N", "long short");
|
||||||
|
this.code.Add("O", "long long long");
|
||||||
|
this.code.Add("P", "shor long long short");
|
||||||
|
this.code.Add("Q", "long long short long");
|
||||||
|
this.code.Add("R", "short long short");
|
||||||
|
this.code.Add("S", "short short short");
|
||||||
|
this.code.Add("T", "long");
|
||||||
|
this.code.Add("U", "short short long");
|
||||||
|
this.code.Add("V", "short short short long");
|
||||||
|
this.code.Add("W", "short long long");
|
||||||
|
this.code.Add("X", "long short short long");
|
||||||
|
this.code.Add("Y", "long short long long");
|
||||||
|
this.code.Add("Z", "long long short short");
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
MorseCoder/MorseCoder.csproj
Normal file
18
MorseCoder/MorseCoder.csproj
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="codec.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="codec.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
BIN
MorseCoder/codec.png
Normal file
BIN
MorseCoder/codec.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Loading…
Reference in New Issue
Block a user