diff --git a/Chatbot_v0.8.1Beta.sln b/Chatbot_v0.8.1Beta.sln
new file mode 100644
index 0000000..d44672e
--- /dev/null
+++ b/Chatbot_v0.8.1Beta.sln
@@ -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}") = "Chatbot_v0.8.1Beta", "Chatbot_v0.8.1Beta\Chatbot_v0.8.1Beta.csproj", "{8DF403AC-FAB2-4607-B5B1-B0964E43ED12}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8DF403AC-FAB2-4607-B5B1-B0964E43ED12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8DF403AC-FAB2-4607-B5B1-B0964E43ED12}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8DF403AC-FAB2-4607-B5B1-B0964E43ED12}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8DF403AC-FAB2-4607-B5B1-B0964E43ED12}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {E3A49929-220B-45FE-A161-0101E469E51B}
+ EndGlobalSection
+EndGlobal
diff --git a/Chatbot_v0.8.1Beta/App.xaml b/Chatbot_v0.8.1Beta/App.xaml
new file mode 100644
index 0000000..144a91c
--- /dev/null
+++ b/Chatbot_v0.8.1Beta/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/Chatbot_v0.8.1Beta/App.xaml.cs b/Chatbot_v0.8.1Beta/App.xaml.cs
new file mode 100644
index 0000000..23e86ea
--- /dev/null
+++ b/Chatbot_v0.8.1Beta/App.xaml.cs
@@ -0,0 +1,14 @@
+using System.Configuration;
+using System.Data;
+using System.Windows;
+
+namespace Chatbot_v0._8._1Beta
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+
+}
diff --git a/Chatbot_v0.8.1Beta/AssemblyInfo.cs b/Chatbot_v0.8.1Beta/AssemblyInfo.cs
new file mode 100644
index 0000000..b0ec827
--- /dev/null
+++ b/Chatbot_v0.8.1Beta/AssemblyInfo.cs
@@ -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)
+)]
diff --git a/Chatbot_v0.8.1Beta/Chatbot_v0.8.1Beta.csproj b/Chatbot_v0.8.1Beta/Chatbot_v0.8.1Beta.csproj
new file mode 100644
index 0000000..b1ec409
--- /dev/null
+++ b/Chatbot_v0.8.1Beta/Chatbot_v0.8.1Beta.csproj
@@ -0,0 +1,12 @@
+
+
+
+ WinExe
+ net8.0-windows
+ Chatbot_v0._8._1Beta
+ enable
+ enable
+ true
+
+
+
diff --git a/Chatbot_v0.8.1Beta/MainWindow.xaml b/Chatbot_v0.8.1Beta/MainWindow.xaml
new file mode 100644
index 0000000..50316e9
--- /dev/null
+++ b/Chatbot_v0.8.1Beta/MainWindow.xaml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Chatbot_v0.8.1Beta/MainWindow.xaml.cs b/Chatbot_v0.8.1Beta/MainWindow.xaml.cs
new file mode 100644
index 0000000..0f0caa2
--- /dev/null
+++ b/Chatbot_v0.8.1Beta/MainWindow.xaml.cs
@@ -0,0 +1,240 @@
+using System.Text;
+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;
+using System.Net.Http;
+using System.Text.Json;
+using System.Threading.Tasks;
+using System.IO;
+
+namespace Chatbot_WPF_Projekt
+{
+ public partial class MainWindow : Window
+ {
+ // Variable für standort
+ private string currentLocation = "";
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+
+
+ // Methode für Senden-Button
+ private async void SendButton_Click(object sender, RoutedEventArgs e)
+ {
+ // Hole den Text und entferne führende Leerzeichen
+ string userInput = InputTextBox.Text.Trim();
+
+ // Überprüfe, ob der Text leer ist
+ if (string.IsNullOrEmpty(userInput))
+ {
+ MessageBox.Show("Bitte gib eine Nachricht ein!");
+ return;
+ }
+
+ // Füge die Nachricht des Benutzers zum Chat-Verlauf hinzu
+ ChatOutput.Text += $"Du: {userInput}\n";
+
+ // Deklariere die Variable botResponse
+ string botResponse = "";
+
+
+ // Überprüfe die Eingabe und reagiere entsprechend
+ if (userInput.ToLower() == "!hilfe")
+ {
+ botResponse = "Ich bin ein Chatbot. Du kannst folgende Befehle verwenden:\n!hilfe - Zeigt diese Nachricht\n!joke - Erzählt einen Witz\n!standort - Setzt deinen Standort\n!zeit - Zeigt die aktuelle Zeit am Standort\n!wetter - Zeigt das Wetter am Standort\n";
+ }
+ else if (userInput.ToLower() == "!joke")
+ {
+ string[] witze = new string[10];
+ witze[0] = "Warum können Geister so schlecht lügen? Weil man durch sie hindurchsieht.";
+ witze[1] = "Programmierer beim Bäcker: 'Ich hätte gern 2^3 Brötchen.'";
+ witze[2] = "Warum war der Entwickler pleite? Weil er in C# gearbeitet hat, aber nur in Cent bezahlt wurde.";
+ witze[3] = "Was sagt ein Bit zum anderen? 'Bist du noch ganz bei 0?'";
+ witze[4] = "Warum ging der Java-Entwickler ins Kloster? Er wollte finally blocken.";
+ witze[5] = "Wie nennt man einen falschen Programmierer? Einen *C#arlatan*.";
+ witze[6] = "Warum weinen Entwickler nie? Sie behandeln ihre Gefühle mit Try-Catch.";
+ witze[7] = "Was macht ein Informatiker beim Sport? Er läuft in Schleifen.";
+ witze[8] = "Warum ging der C#-Code nicht ins Kino? Zu viele Exceptions.";
+ witze[9] = "Was macht ein Arduino im Gefängnis? Er sitzt wegen Widerstands.";
+
+ Random zufall = new Random();
+ int zahl = zufall.Next(0, 10);
+
+ string output = witze[zahl];
+ botResponse = output;
+ }
+ else if (userInput.ToLower().StartsWith("!standort"))
+ {
+ string[] parts = userInput.Split(' ', 2);
+ if (parts.Length == 2)
+ {
+ currentLocation = parts[1].Trim();
+ botResponse = $"Standort wurde auf '{currentLocation}' gesetzt.";
+ }
+ else
+ {
+ botResponse = "Verwendung: !standort [stadtname]";
+ }
+ }
+ else if (userInput.ToLower() == "!zeit")
+ {
+ if (string.IsNullOrEmpty(currentLocation))
+ {
+ botResponse = "Bitte gib zuerst einen Standort mit !standort an.";
+ }
+ else
+ {
+ botResponse = $"Aktuelle Uhrzeit in {currentLocation}: {DateTime.Now.ToShortTimeString()}";
+ }
+ }
+ else if (userInput.ToLower() == "!wetter")
+ {
+ if (string.IsNullOrEmpty(currentLocation))
+ {
+ botResponse = "Bitte gib zuerst einen Standort mit !standort an.";
+ }
+ else
+ {
+ botResponse = await GetWeatherAsync(currentLocation);
+ }
+ }
+
+ else
+ {
+ botResponse = "Befehl nicht erkannt. Versuche es mit !hilfe.";
+ }
+
+ // Füge die Antwort des Bots zum Chat-Verlauf hinzu
+ ChatOutput.Text += $"Bot: {botResponse}\n";
+
+ // Eingabefeld leeren
+ InputTextBox.Clear();
+ }
+
+
+ // Methode für Enter-Taste, um eine Nachricht zu senden
+ private void InputTextBox_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter)
+ {
+ SendButton_Click(sender, e); // Gleich wie der Button
+ }
+ }
+
+ // Methode für Löschen-Button
+ private void ClearButton_Click(object sender, RoutedEventArgs e)
+ {
+ ChatOutput.Text = string.Empty; // Lösche den Chatverlauf
+ }
+
+ private void Color_theme_Checked(object sender, RoutedEventArgs e)
+ {
+ MessageBox.Show("Colortheme Charcoleblack aktiviert!");
+
+ //dunkles Theme
+ this.Background = new SolidColorBrush(Color.FromRgb(30, 30, 30));
+ SendButton.Background = new SolidColorBrush(Color.FromRgb(70, 70, 70));
+ SendButton.Foreground = new SolidColorBrush(Color.FromRgb(230, 230, 230));
+
+ ClearButton.Background = new SolidColorBrush(Color.FromRgb(70, 70, 70));
+ ClearButton.Foreground = new SolidColorBrush(Color.FromRgb(230, 230, 230));
+
+ Color_theme.Background = new SolidColorBrush(Color.FromRgb(70, 70, 70));
+ Color_theme.Foreground = new SolidColorBrush(Color.FromRgb(230, 230, 230));
+
+ SaveButton.Background = new SolidColorBrush(Color.FromRgb(70, 70, 70));
+ SaveButton.Foreground = new SolidColorBrush(Color.FromRgb(230, 230, 230));
+
+ ChatOutput.Background = new SolidColorBrush(Color.FromRgb(70, 70, 70));
+ ChatOutput.Foreground = new SolidColorBrush(Color.FromRgb(230, 230, 230));
+
+ InputTextBox.Background = new SolidColorBrush(Color.FromRgb(70, 70, 70));
+ InputTextBox.Foreground = new SolidColorBrush(Color.FromRgb(230, 230, 230));
+ }
+
+ private void Color_theme_Unchecked(object sender, RoutedEventArgs e)
+ {
+ MessageBox.Show("Colortheme Perlwhite aktiviert!");
+
+ //helles Theme
+ this.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));
+ SendButton.Background = new SolidColorBrush(Color.FromRgb(221, 221, 221));
+ SendButton.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0));
+
+ ClearButton.Background = new SolidColorBrush(Color.FromRgb(221, 221, 221));
+ ClearButton.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0));
+
+ SaveButton.Background = new SolidColorBrush(Color.FromRgb(221, 221, 221));
+ SaveButton.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0));
+
+ Color_theme.Background = new SolidColorBrush(Color.FromRgb(221, 221, 221));
+ Color_theme.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0));
+
+ ChatOutput.Background = new SolidColorBrush(Color.FromRgb(240, 240, 240));
+ ChatOutput.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0));
+
+ InputTextBox.Background = new SolidColorBrush(Color.FromRgb(240, 240, 240));
+ InputTextBox.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0));
+ }
+
+ private void SaveButton_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ // Hole das Verzeichnis, in dem die .exe liegt
+ string projectDirectory = Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).Parent.Parent.FullName;
+
+
+ // Erstelle Dateinamen mit Zeitstempel, z. B. Chat_2025-05-06_1532.txt
+ string fileName = $"Chat_{DateTime.Now:yyyy-MM-dd_HHmm}.txt";
+
+ // Kompletter Pfad zur Datei
+ string fullPath = System.IO.Path.Combine(projectDirectory, fileName);
+
+ // Schreibe den Chatverlauf in die Datei
+ System.IO.File.WriteAllText(fullPath, ChatOutput.Text);
+
+ MessageBox.Show($"Chatverlauf gespeichert als:\n{fileName}", "Gespeichert", MessageBoxButton.OK, MessageBoxImage.Information);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Fehler beim Speichern:\n" + ex.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+ }
+
+ //mehtohde für die wetter Api
+ private async Task GetWeatherAsync(string city)
+ {
+ string apiKey = "d3348e2e2c9dba104f58d7d44f6f623e";
+ string url = $"https://api.openweathermap.org/data/2.5/weather?q={Uri.EscapeDataString(city)}&units=metric&lang=de&appid={apiKey}";
+
+ using HttpClient client = new HttpClient();
+ try
+ {
+ HttpResponseMessage response = await client.GetAsync(url);
+ response.EnsureSuccessStatusCode();
+ string json = await response.Content.ReadAsStringAsync();
+
+ using JsonDocument doc = JsonDocument.Parse(json);
+ JsonElement root = doc.RootElement;
+
+ double temp = root.GetProperty("main").GetProperty("temp").GetDouble();
+ string description = root.GetProperty("weather")[0].GetProperty("description").GetString();
+
+ return $"Aktuelles Wetter in {city}: {temp}°C, {description}";
+ }
+ catch (Exception ex)
+ {
+ return $"Fehler beim Abrufen der Wetterdaten: {ex.Message}";
+ }
+ }
+
+ }
+}