Abgabe
This commit is contained in:
parent
0ec86d7bb8
commit
a81c1cf697
63
.gitattributes
vendored
Normal file
63
.gitattributes
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
25
Aborea-Projekt.sln
Normal file
25
Aborea-Projekt.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.11.35431.28
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aborea-Projekt", "Aborea-Projekt\Aborea-Projekt.csproj", "{8EE5B298-F0F5-4B9D-9645-548A17BF20BD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8EE5B298-F0F5-4B9D-9645-548A17BF20BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8EE5B298-F0F5-4B9D-9645-548A17BF20BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8EE5B298-F0F5-4B9D-9645-548A17BF20BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8EE5B298-F0F5-4B9D-9645-548A17BF20BD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {7DDCCD04-83C1-4ACE-8679-703C785BB520}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
34
Aborea-Projekt/Aborea-Projekt.csproj
Normal file
34
Aborea-Projekt/Aborea-Projekt.csproj
Normal file
@ -0,0 +1,34 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<RootNamespace>Aborea_Projekt</RootNamespace>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="9.0.0" />
|
||||
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.10" />
|
||||
<PackageReference Include="System.Data.OleDb" Version="9.0.0" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.9.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
9
Aborea-Projekt/App.xaml
Normal file
9
Aborea-Projekt/App.xaml
Normal file
@ -0,0 +1,9 @@
|
||||
<Application x:Class="Aborea_Projekt.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:Aborea_Projekt"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
14
Aborea-Projekt/App.xaml.cs
Normal file
14
Aborea-Projekt/App.xaml.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Windows;
|
||||
|
||||
namespace Aborea_Projekt
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
|
||||
}
|
10
Aborea-Projekt/AssemblyInfo.cs
Normal file
10
Aborea-Projekt/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)
|
||||
)]
|
378
Aborea-Projekt/Datenbank.cs
Normal file
378
Aborea-Projekt/Datenbank.cs
Normal file
@ -0,0 +1,378 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using SQLitePCL;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
|
||||
namespace Aborea_Projekt
|
||||
{
|
||||
internal class Datenbank
|
||||
{
|
||||
public const string DatabaseName = "AboreaDatenbank.sqlite";
|
||||
public Datenbank()
|
||||
{
|
||||
//Schauen, ob die Datenbank existiert
|
||||
if (File.Exists(DatabaseName))
|
||||
return;
|
||||
|
||||
|
||||
//Wenn die DB nicht existiert, Daten anlegen
|
||||
//1. Rüstungsart durch Konstruktor
|
||||
List<Rüstungsart> rüstungsartList = new();
|
||||
|
||||
rüstungsartList.Add(new Rüstungsart("Ungerüstet",0,0,0,0,0));
|
||||
rüstungsartList.Add(new Rüstungsart("Lederrüstung",3,+1,0,9,10));
|
||||
rüstungsartList.Add(new Rüstungsart("Kettenhemd",4,+2,-1,130,15));
|
||||
rüstungsartList.Add(new Rüstungsart("Halbe Platte",5,+3,-2,200,18));
|
||||
rüstungsartList.Add(new Rüstungsart("Plattenpanzer",6,+4,-3,400,30));
|
||||
rüstungsartList.Add(new Rüstungsart("Ritterrüstung",7,+5,-4,800,40));
|
||||
rüstungsartList.Add(new Rüstungsart("Schild",3,+1,0,11,5));
|
||||
rüstungsartList.Add(new Rüstungsart("Turmschild",4,+2,-1,18,10));
|
||||
|
||||
InsertRüstungarten(rüstungsartList);
|
||||
|
||||
|
||||
|
||||
//1. Gegenstände durch Konstruktor
|
||||
List<Gegenstände> GegenständeList = new();
|
||||
|
||||
GegenständeList.Add(new Gegenstände("Bier",0.5,0.01,"häufig","Halber Liter Bier"));
|
||||
GegenständeList.Add(new Gegenstände("Bolzen",1.5,1.6,"mittel","10 Bolzen für Armbrüste"));
|
||||
GegenständeList.Add(new Gegenstände("Cidre", 1, 0.01, "häufig", "1L Apfel-Cidre"));
|
||||
GegenständeList.Add(new Gegenstände("Fakel", 0.1, 0.01, "häufig", "Brennt 6 Stunden und erhellt 6 m Umkreis"));
|
||||
GegenständeList.Add(new Gegenstände("Federkiel und Tinte", 0.1, 0.7, "häufig", "Zum Schreiben mit Tinte"));
|
||||
GegenständeList.Add(new Gegenstände("Feuerstein und Zunder", 0.3, 0.22, "mittel", "Zum Entzünden eines Feuers innerhalb von ca. 3 Minuten"));
|
||||
GegenständeList.Add(new Gegenstände("Gasthauszimmer", 0 , 0.1, "mittel","Preis für ein Einzelzimmer pro Nacht und Person inklusive Frühstück"));
|
||||
GegenständeList.Add(new Gegenstände("Große Heilertasche", 4, 240, "sehr selten", "Bis zu 20 Anwendungen, erlaubt einen Manöverbonus von + 4 auf Wissen(Heilkunde)"));
|
||||
GegenständeList.Add(new Gegenstände("Haltbare Nahrung", 5, 0.3, "häufig", "Für eine Woche Nahrung"));
|
||||
GegenständeList.Add(new Gegenstände("Heilsalbe", 0.05, 100, "selten", "Verdoppelt die Genesungsrate(5 Anwendungen"));
|
||||
GegenständeList.Add(new Gegenstände("Heiltrank", 0.1, 400, "sehr selten", "Regeneriert umgehend 20 Trefferpunkte"));
|
||||
GegenständeList.Add(new Gegenstände("Kerze", 0.05, 0.08, "mittel", "Brennt 2 Stunden und erhellt 3 m Umkreis"));
|
||||
GegenständeList.Add(new Gegenstände("Kleine Heilertasche", 2, 100, "selten", "Bis zu 20 Anwendungen, erlaubt einen Manöverbonus von +2 auf Wissen (Heilkunde)"));
|
||||
GegenständeList.Add(new Gegenstände("Kleiner Hammer", 2, 2.6, "mittel", "Für kleinere Arbeiten oder zum Einschlagen von Kletterhaken"));
|
||||
GegenständeList.Add(new Gegenstände("Kletterhaken", 0.1, 6, "selten", "Unterstützt beim Klettern (Bonus von +4); braucht einen Hammer"));
|
||||
GegenständeList.Add(new Gegenstände("Köcher", 1.5, 1.2, "häufig", "Platz für bis zu 20 Pfeile"));
|
||||
GegenständeList.Add(new Gegenstände("Krähenfüße", 0.1, 1, "selten", "10 Krähenfüße, die Verfolgern Schmerzen bereiten können"));
|
||||
GegenständeList.Add(new Gegenstände("Kreide", 0, 0.05, "mittel", "Ein Stück Kreide"));
|
||||
GegenständeList.Add(new Gegenstände("Laterne", 1, 2.8, "mittel", "Brennt pro halbem Liter Öl 6 Stunden und erhellt 15 m Umkreis"));
|
||||
GegenständeList.Add(new Gegenstände("Mahlzeit", 0, 0.02, "häufig", "Eine übliche Mahlzeit"));
|
||||
GegenständeList.Add(new Gegenstände("Metallkugeln (Schleuder)", 1, 0.05, "häufig", "Beutel mit 30 Stück"));
|
||||
GegenständeList.Add(new Gegenstände("Öl", 0.5, 0.8, "mittel", "Leicht entzündlich; nötig für Laternen und brennt 6 Stunden in einer Laterne"));
|
||||
GegenständeList.Add(new Gegenstände("Pergament", 0.1, 0.6, "mittel", "Ein Blatt Pergament"));
|
||||
GegenständeList.Add(new Gegenstände("Pfeile", 1.2, 1, "häufig", "20 Pfeile für Bögen"));
|
||||
GegenständeList.Add(new Gegenstände("Pony", 0, 40, "mittel", "7 km/h, trägt bis zu 90 kg"));
|
||||
GegenständeList.Add(new Gegenstände("Reitpferd", 0, 90, "mittel", "12 km/h, trägt bis zu 150 kg"));
|
||||
GegenständeList.Add(new Gegenstände("Rucksack", 1, 0.44, "mittel", "Kann bis zu 20 kg oder 40 l verstauen"));
|
||||
GegenständeList.Add(new Gegenstände("Sattel", 6, 12, "mittel", "Sattel für ein Reittier"));
|
||||
GegenständeList.Add(new Gegenstände("Arbeitspferd", 400, 70, "häufig", "Kann 100 kg transportieren"));
|
||||
GegenständeList.Add(new Gegenstände("Dietrich", 0.1, 2, "selten", "+1 auf Schlösser öffnen"));
|
||||
GegenständeList.Add(new Gegenstände("Elefant", 5500, 1300, "selten", "Kann 500 kg transportieren"));
|
||||
GegenständeList.Add(new Gegenstände("Fährfahrt", 0, 0.2, "mittel", "Übersetzen von einer Person"));
|
||||
GegenständeList.Add(new Gegenstände("Falle", 1, 1.8, "mittel", "Einfache Tierfalle"));
|
||||
GegenständeList.Add(new Gegenstände("Galeere - groß", 0, 200000, "extrem selten", "Bis zu 400 Personen"));
|
||||
GegenständeList.Add(new Gegenstände("Galeere - klein", 0, 75000, "sehr selten", "Bis zu 200 Personen"));
|
||||
GegenständeList.Add(new Gegenstände("Glasphiole", 0.1, 0.5, "mittel", "100 ml Fassungsvermögen"));
|
||||
GegenständeList.Add(new Gegenstände("Glücksbringer", 0.3, 1, "mittel", "Einfacher (nicht-magischer) Talisman"));
|
||||
GegenständeList.Add(new Gegenstände("Göttliches Symbol", 0.2, 5, "mittel", "Einfaches Symbol eines Gottes"));
|
||||
GegenständeList.Add(new Gegenstände("Handschuhe", 0.2, 3, "mittel", "Lederhandschuhe"));
|
||||
GegenständeList.Add(new Gegenstände("Hängematte", 2, 0.3, "mittel", "Stoffhängematte"));
|
||||
GegenständeList.Add(new Gegenstände("Hemd", 0.5, 0.5, "häufig", "Einfach"));
|
||||
GegenständeList.Add(new Gegenstände("Hose", 1, 0.4, "häufig", "Einfach"));
|
||||
GegenständeList.Add(new Gegenstände("Hundeschlitten", 0, 126, "mittel", "Mit 8 Schlittenhunden, kann 200 kg transportieren"));
|
||||
GegenständeList.Add(new Gegenstände("Hut", 0.5, 1, "mittel", "Einfach"));
|
||||
GegenständeList.Add(new Gegenstände("Kamel", 450, 300, "selten", "Kann 200 kg transportieren"));
|
||||
GegenständeList.Add(new Gegenstände("Kanu", 70, 140, "selten", "Kann 350 kg transportieren"));
|
||||
GegenständeList.Add(new Gegenstände("Kette", 3, 0.4, "mittel", "Preis und Gewicht pro Meter"));
|
||||
GegenständeList.Add(new Gegenstände("Kriegsschiff - groß", 0, 800000, "extrem selten", "Bis zu 1.000 Personen"));
|
||||
GegenständeList.Add(new Gegenstände("Kutsche", 1500, 1500, "selten", "Kann 500 kg transportieren"));
|
||||
GegenständeList.Add(new Gegenstände("Lama", 100, 160, "selten", "Kann 25 kg transportieren (insbesondere im Gebirge)"));
|
||||
GegenständeList.Add(new Gegenstände("Maultier", 200, 50, "häufig", "Kann 150 kg transportieren"));
|
||||
GegenständeList.Add(new Gegenstände("Ochse", 1000, 170, "häufig", "Kann 350 kg transportieren"));
|
||||
GegenständeList.Add(new Gegenstände("Pferdekarren", 200, 60, "mittel", "Kann 400 kg transportieren"));
|
||||
GegenständeList.Add(new Gegenstände("Planwagen", 450, 160, "mittel", "Kann 700 kg transportieren"));
|
||||
GegenständeList.Add(new Gegenstände("Ruderboot", 100, 80, "mittel", "Kann 500 kg transportieren"));
|
||||
GegenständeList.Add(new Gegenstände("Satteltaschen", 5, 1.8, "häufig", "Kann bis zu 8 kg fassen"));
|
||||
GegenständeList.Add(new Gegenstände("Schiffsreise", 0, 1, "mittel", "Koje auf einem Schiff"));
|
||||
GegenständeList.Add(new Gegenstände("Schlachtross", 600, 140, "selten", "Kann 200 kg transportieren, gewährt +2 auf berittenen Kampf"));
|
||||
GegenständeList.Add(new Gegenstände("Schloss", 0.5, 6, "mittel", "Eisenschloss (MS 8) mit einem Schlüssel"));
|
||||
GegenständeList.Add(new Gegenstände("Segelboot (10 m)", 0, 1600, "selten", "Bis zu 8 Personen"));
|
||||
GegenständeList.Add(new Gegenstände("Segelschiff - groß", 0, 60000, "sehr selten", "Bis zu 200 Personen"));
|
||||
GegenständeList.Add(new Gegenstände("Segelschiff - mittel", 0, 7500, "selten", "Bis zu 40 Personen"));
|
||||
GegenständeList.Add(new Gegenstände("Seil mit Wurfhaken", 5, 5, "mittel", "10 m Seil mit Wurfhaken"));
|
||||
GegenständeList.Add(new Gegenstände("Spiegel", 0.2, 8, "mittel", "Metallspiegel"));
|
||||
GegenständeList.Add(new Gegenstände("Stiefel", 2, 2.4, "häufig", "Einfach"));
|
||||
GegenständeList.Add(new Gegenstände("Umhang", 1.5, 1.8, "häufig", "Einfach"));
|
||||
GegenständeList.Add(new Gegenstände("Verstärktes Seil", 0.3, 0.3, "mittel", "Hält dreimal mehr Gewicht als normales Seil"));
|
||||
GegenständeList.Add(new Gegenstände("Waffengürtel", 0.5, 1, "häufig", "Kann zwei Waffen halten"));
|
||||
GegenständeList.Add(new Gegenstände("Schlafrolle", 4, 1.2, "häufig", "Wärmt nachts; hält durchschnittlich 2 Jahre"));
|
||||
GegenständeList.Add(new Gegenstände("Seil", 0.2, 0.1, "häufig", "Stabiles Seil. Kann Bonus auf Manöver geben (beispielsweise Athletik zum Klettern)"));
|
||||
GegenständeList.Add(new Gegenstände("Stallplatz", 0, 0.01, "-", "Für einen Tag Platz und Pflege für ein Tier"));
|
||||
GegenständeList.Add(new Gegenstände("Wasserbeutel", 0.1, 0.02, "häufig", "Für 1 l Flüssigkeit"));
|
||||
GegenständeList.Add(new Gegenstände("Wein", 0.3, 0.02, "häufig", "0.3 l Verdünnter Wein"));
|
||||
GegenständeList.Add(new Gegenstände("Zelt", 3, 5, "mittel", "Bietet zwei Personen Schutz"));
|
||||
|
||||
InsertGegenstände(GegenständeList);
|
||||
}
|
||||
|
||||
private void InsertRüstungarten(List<Rüstungsart> list)
|
||||
{
|
||||
//Rüstungsart in die DB speichern
|
||||
using (var connection = new SqliteConnection("Data Source=" + DatabaseName))
|
||||
{
|
||||
connection.Open();// Verbindung zur SQLite-Datenbank öffnen
|
||||
|
||||
var command = connection.CreateCommand();
|
||||
// SQL-Befehl zur Erstellung der Tabelle "Gegenstände" falls sie nicht existiert
|
||||
string create = "CREATE TABLE Rüstungen(Name varchar(255) NOT NULL, minStärke int, RüstungBonus int, Manöver int, KostenTT double,Gewicht double, PRIMARY KEY (Name));";
|
||||
string items = "";// String zur Speicherung der INSERT-Statements vorbereiten
|
||||
// Schleife über die Liste der Gegenstände, um SQL-Befehl zum Einfügen vorzubereiten
|
||||
foreach (var item in list)
|
||||
{
|
||||
// Dynamisches Erstellen von SQL-INSERT-Befehl für jedes Gegenstand-Element
|
||||
items += "INSERT INTO Rüstungen (Name, minStärke,RüstungBonus,Manöver,KostenTT,Gewicht) VALUES ('" + item.Name + "', " + item.minStärke + "," + item.RüstungBonus + "," + item.Manöver + "," + item.KostenTT.ToString(System.Globalization.CultureInfo.InvariantCulture) + "," + item.Gewicht.ToString(System.Globalization.CultureInfo.InvariantCulture) + ");";
|
||||
}
|
||||
// Kombinieren des CREATE-Befehls mit den vorbereiteten INSERT-Befehlen
|
||||
command.CommandText = create + items;
|
||||
// SQL-Befehl ausführen
|
||||
command.ExecuteNonQuery();
|
||||
// Verbindung zur SQLite-Datenbank schließen
|
||||
connection.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void InsertGegenstände(List<Gegenstände> list)
|
||||
{
|
||||
//Gegenstände in die DB speichern
|
||||
using (var connection = new SqliteConnection("Data Source=" + DatabaseName))
|
||||
{
|
||||
connection.Open();// Verbindung zur SQLite-Datenbank öffnen
|
||||
|
||||
var command = connection.CreateCommand();
|
||||
// SQL-Befehl zur Erstellung der Tabelle "Gegenstände" falls sie nicht existiert
|
||||
string create = "CREATE TABLE Gegenstände(Name varchar(255) NOT NULL,Gewicht double,KostenTT double, Häufigkeit varchar(255),Funktion varchar(255) ,PRIMARY KEY (Name));";
|
||||
string items = ""; // String zur Speicherung der INSERT-Statements vorbereiten
|
||||
// Schleife über die Liste der Gegenstände, um SQL-Befehl zum Einfügen vorzubereiten
|
||||
foreach (var item in list)
|
||||
{
|
||||
// Dynamisches Erstellen von SQL-INSERT-Befehl für jedes Gegenstand-Element
|
||||
items += "INSERT INTO Gegenstände (Name, Gewicht, KostenTT, Häufigkeit,Funktion) VALUES ('" + item.Name + "', " + item.Gewicht.ToString(System.Globalization.CultureInfo.InvariantCulture) + "," + item.KostenTT.ToString(System.Globalization.CultureInfo.InvariantCulture) + ",'" + item.Häufigkeit + "','" + item.Funktion + "');";
|
||||
}
|
||||
// Kombinieren des CREATE-Befehls mit den vorbereiteten INSERT-Befehlen
|
||||
command.CommandText = create + items;
|
||||
// SQL-Befehl ausführen
|
||||
command.ExecuteNonQuery();
|
||||
// Verbindung zur SQLite-Datenbank schließen
|
||||
connection.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal static LinkedList<Rüstungsart> GetRüstungsarten()
|
||||
{
|
||||
//Rüstungsart von der DB abrufen
|
||||
// Verbindung zur SQLite-Datenbank erstellen, um Rüstungsarten aus der Datenbank abzurufen
|
||||
using (var connection = new SqliteConnection("Data Source=" + DatabaseName))
|
||||
{
|
||||
connection.Open(); // Verbindung öffnen
|
||||
|
||||
// SQL-Befehl zum Abrufen aller Einträge aus der Tabelle "Rüstungen"
|
||||
var command = connection.CreateCommand();
|
||||
command.CommandText = "SELECT * FROM Rüstungen";// SQL-Query, um alle Einträge aus der Tabelle "Rüstungen" zu lesen
|
||||
SqliteDataReader sqlDR = command.ExecuteReader();// Datenleser erstellen, um die Ergebnisse zu lesen
|
||||
|
||||
// Eine LinkedList erstellen, um die abgerufenen Rüstungsarten zu speichern
|
||||
LinkedList<Rüstungsart> rüstungsartList = new LinkedList<Rüstungsart>();
|
||||
|
||||
// Schleife zum Durchlaufen der Datensätze aus der Datenbankabfrage
|
||||
while (sqlDR.Read())
|
||||
{
|
||||
// Für jeden Datensatz ein neues Rüstungsart-Objekt erstellen und zur LinkedList hinzufügen
|
||||
// Achtung: Die Spaltennamen wie "Name", "minStärke", "RüsungsBonus" usw. müssen korrekt existieren
|
||||
rüstungsartList.AddLast(new Rüstungsart(sqlDR.GetString("Name"), sqlDR.GetInt32("minStärke"), sqlDR.GetInt32("RüstungBonus"), sqlDR.GetInt32("Manöver"), sqlDR.GetDouble("KostenTT"), sqlDR.GetDouble("Gewicht")));
|
||||
}
|
||||
connection.Close();// Verbindung zur Datenbank schließen
|
||||
|
||||
// Die gefüllte Liste von Rüstungsarten zurückgeben
|
||||
return rüstungsartList;
|
||||
}
|
||||
}
|
||||
|
||||
internal static LinkedList<Gegenstände> GetGegenstände()
|
||||
{
|
||||
//Gegenstände von der DB abrufen
|
||||
// Verbindung zur SQLite-Datenbank herstellen
|
||||
using (var connection = new SqliteConnection("Data Source=" + DatabaseName))
|
||||
{
|
||||
connection.Open();// Verbindung öffnen
|
||||
|
||||
// SQL-Befehl erstellen, um alle Einträge aus der Tabelle "Gegenstände" abzurufen
|
||||
var command = connection.CreateCommand();
|
||||
command.CommandText = "SELECT * FROM Gegenstände";
|
||||
// Datenleser initialisieren, um die Ergebnisse der SQL-Abfrage zu verarbeiten
|
||||
SqliteDataReader sqlDR = command.ExecuteReader();
|
||||
|
||||
// Eine LinkedList erstellen, um die Gegenstände zu speichern
|
||||
LinkedList<Gegenstände> GegenständeList = new LinkedList<Gegenstände>();
|
||||
|
||||
// Schleife über die Ergebnisse der Abfrage
|
||||
while (sqlDR.Read())
|
||||
{
|
||||
// Gegenstand aus den Daten der Datenbank erstellen und zur Liste hinzufügen
|
||||
// Hinweis: "sqlDR.GetString" und "sqlDR.GetDouble" erfordern korrekte Spaltennamen
|
||||
GegenständeList.AddLast(new Gegenstände(sqlDR.GetString("Name"), sqlDR.GetDouble("Gewicht"), sqlDR.GetDouble("KostenTT"), sqlDR.GetString("Häufigkeit"), sqlDR.GetString("Funktion")));
|
||||
|
||||
}
|
||||
// Verbindung schließen
|
||||
connection.Close();
|
||||
|
||||
// Rückgabe der Liste von Gegenständen
|
||||
return GegenständeList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void SpeichereRüstungsart(Rüstungsart rüstung)
|
||||
{
|
||||
using (var connection = new SqliteConnection("Data Source=" + DatabaseName))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
// SQL-Befehl zur Erstellung der Tabelle (falls sie noch nicht existiert)
|
||||
var createCommand = connection.CreateCommand();
|
||||
createCommand.CommandText = @"
|
||||
CREATE TABLE IF NOT EXISTS Rüstungen (
|
||||
Name TEXT NOT NULL PRIMARY KEY,
|
||||
minStärke INT,
|
||||
RüstungBonus INT,
|
||||
Manöver INT,
|
||||
KostenTT REAL,
|
||||
Gewicht REAL
|
||||
);";
|
||||
createCommand.ExecuteNonQuery();
|
||||
|
||||
// SQL-Befehl zum Einfügen der neuen Rüstung
|
||||
var insertCommand = connection.CreateCommand();
|
||||
insertCommand.CommandText = @"
|
||||
INSERT INTO Rüstungen (Name, minStärke, RüstungBonus, Manöver, KostenTT, Gewicht)
|
||||
VALUES (@Name, @minStärke, @RüstungBonus, @Manöver, @KostenTT, @Gewicht);";
|
||||
insertCommand.Parameters.AddWithValue("@Name", rüstung.Name);
|
||||
insertCommand.Parameters.AddWithValue("@minStärke", rüstung.minStärke);
|
||||
insertCommand.Parameters.AddWithValue("@RüstungBonus", rüstung.RüstungBonus);
|
||||
insertCommand.Parameters.AddWithValue("@Manöver", rüstung.Manöver);
|
||||
insertCommand.Parameters.AddWithValue("@KostenTT", rüstung.KostenTT);
|
||||
insertCommand.Parameters.AddWithValue("@Gewicht", rüstung.Gewicht);
|
||||
|
||||
insertCommand.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SpeichereGegenstand(Gegenstände neuerGegenstand)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var connection = new SqliteConnection("Data Source=" + DatabaseName))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
// Tabelle erstellen, falls sie nicht existiert
|
||||
var createCommand = connection.CreateCommand();
|
||||
createCommand.CommandText = @"
|
||||
CREATE TABLE IF NOT EXISTS Gegenstände (
|
||||
Name varchar(255) NOT NULL,
|
||||
Gewicht double,
|
||||
KostenTT double,
|
||||
Häufigkeit varchar(255),
|
||||
Funktion varchar(255),
|
||||
PRIMARY KEY (Name)
|
||||
);";
|
||||
createCommand.ExecuteNonQuery();
|
||||
|
||||
// Gegenstand einfügen
|
||||
var insertCommand = connection.CreateCommand();
|
||||
insertCommand.CommandText = @"
|
||||
INSERT INTO Gegenstände (Name, Gewicht, KostenTT, Häufigkeit, Funktion)
|
||||
VALUES (@Name, @Gewicht, @KostenTT, @Häufigkeit, @Funktion);";
|
||||
|
||||
insertCommand.Parameters.AddWithValue("@Name", neuerGegenstand.Name);
|
||||
insertCommand.Parameters.AddWithValue("@Gewicht", neuerGegenstand.Gewicht);
|
||||
insertCommand.Parameters.AddWithValue("@KostenTT", neuerGegenstand.KostenTT);
|
||||
insertCommand.Parameters.AddWithValue("@Häufigkeit", neuerGegenstand.Häufigkeit);
|
||||
insertCommand.Parameters.AddWithValue("@Funktion", neuerGegenstand.Funktion);
|
||||
|
||||
insertCommand.ExecuteNonQuery();
|
||||
connection.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Fehler beim Speichern des Gegenstands: " + ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void LöscheGegenstand(string gegenstandName)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var connection = new SqliteConnection("Data Source=" + DatabaseName))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
// Gegenstand löschen
|
||||
var deleteCommand = connection.CreateCommand();
|
||||
deleteCommand.CommandText = @"
|
||||
DELETE FROM Gegenstände
|
||||
WHERE Name = @Name;";
|
||||
|
||||
deleteCommand.Parameters.AddWithValue("@Name", gegenstandName); // 'gegenstandName' ist der Name des Gegenstands, den Sie löschen möchten.
|
||||
|
||||
deleteCommand.ExecuteNonQuery();
|
||||
connection.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Fehler beim Löschen des Gegenstands: " + ex.Message, ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal static void LöscheRüstung(string rüstungName)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var connection = new SqliteConnection("Data Source=" + DatabaseName))
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
// Gegenstand löschen
|
||||
var deleteCommand = connection.CreateCommand();
|
||||
deleteCommand.CommandText = @"
|
||||
DELETE FROM Rüstungen
|
||||
WHERE Name = @Name;";
|
||||
|
||||
deleteCommand.Parameters.AddWithValue("@Name", rüstungName); // 'gegenstandName' ist der Name des Gegenstands, den Sie löschen möchten.
|
||||
|
||||
deleteCommand.ExecuteNonQuery();
|
||||
connection.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Fehler beim Löschen des Gegenstands: " + ex.Message, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
27
Aborea-Projekt/Gegenstände.cs
Normal file
27
Aborea-Projekt/Gegenstände.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Aborea_Projekt
|
||||
{
|
||||
class Gegenstände
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public double Gewicht { get; set; }
|
||||
public double KostenTT { get; set; }
|
||||
public string Häufigkeit { get; set; }
|
||||
public string Funktion { get; set; }
|
||||
|
||||
public Gegenstände(string Name, double Gewicht, double KostenTT, string Häufigkeit, string Funktion)
|
||||
{
|
||||
this.Name = Name;
|
||||
this.Gewicht = Gewicht;
|
||||
this.KostenTT = KostenTT;
|
||||
this.Häufigkeit = Häufigkeit;
|
||||
this.Funktion = Funktion;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
24
Aborea-Projekt/KaufObjekt.cs
Normal file
24
Aborea-Projekt/KaufObjekt.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Aborea_Projekt
|
||||
{
|
||||
internal class KaufObjekt
|
||||
{
|
||||
|
||||
|
||||
public string Name { get; set; }
|
||||
public int Menge { get; set; }
|
||||
public double Gewicht { get; set; }
|
||||
public double gesPreis { get; set; }
|
||||
public int HändlerProzentsatz { get; internal set; }
|
||||
public string gesPreisString { get; internal set; }
|
||||
public string Funktion { get; internal set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
432
Aborea-Projekt/MainWindow.xaml
Normal file
432
Aborea-Projekt/MainWindow.xaml
Normal file
@ -0,0 +1,432 @@
|
||||
<Window x:Class="Aborea_Projekt.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:Aborea_Projekt"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="700" Width="800"
|
||||
MinWidth="850" MinHeight="800"
|
||||
|
||||
>
|
||||
|
||||
<Grid>
|
||||
|
||||
<TextBlock Text="Aborea-Spielleiter-Händler-Hilfe"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
FontSize="25"
|
||||
Margin="0,10,0,0"
|
||||
Foreground="Black"
|
||||
Height="Auto"
|
||||
Background="LightGray"
|
||||
Width="Auto"/>
|
||||
|
||||
<StackPanel x:Name="ObjektAuswahl" Orientation="Vertical" HorizontalAlignment="Left" Margin="20,50,0,0" >
|
||||
<TextBlock Text="Objekt Auswahl:"
|
||||
FontSize="14"
|
||||
Margin="0,0,0,5"
|
||||
Foreground="Black"
|
||||
Background="LightGray"/>
|
||||
<!-- Combobox zur Auswahl -->
|
||||
<ComboBox x:Name="Combo"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Width="200"
|
||||
IsEditable="True"
|
||||
KeyUp ="Combo_KeyUp" IsTextSearchEnabled="False" />
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
FontSize="14"
|
||||
Margin="0,100,0,0"
|
||||
Foreground="Black"
|
||||
Height="Auto"
|
||||
Background="LightGray"
|
||||
Width="Auto">
|
||||
|
||||
Währung:
|
||||
<LineBreak />
|
||||
1 Goldfalke (GF) = 10 TrionTaler (TT)
|
||||
<LineBreak />
|
||||
1 TrionTaler (TT) = 10 Kupferling (Kl)
|
||||
<LineBreak />
|
||||
1 Kupferling (Kl) = 10 Muena (Mu)
|
||||
</TextBlock>
|
||||
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="20,100,0,0">
|
||||
<TextBlock Text="Menge:"
|
||||
FontSize="14"
|
||||
Margin="0,0,0,5"
|
||||
Background="LightGray"
|
||||
Foreground="Black"/>
|
||||
|
||||
|
||||
<!-- Eingabefeld für Menge -->
|
||||
<TextBox x:Name="QuantityTextBox"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Width="100"
|
||||
Text="1" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
<!-- Eingabefeld für Händler-Prozentsatz mit Beschreibung -->
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="20,150,0,0">
|
||||
<TextBlock Text="Händler-Prozentsatz:"
|
||||
FontSize="14"
|
||||
Margin="0,0,0,5"
|
||||
Background="LightGray"
|
||||
Foreground="Black"/>
|
||||
|
||||
<TextBox x:Name="MerchantPercentageTextBox"
|
||||
HorizontalAlignment="Left"
|
||||
Width="100"
|
||||
Text="0"
|
||||
ToolTip="Geben Sie den Prozentsatz ein, den der Händler auf den Preis aufschlägt." />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Button zum Hinzufügen der Auswahl zur Liste -->
|
||||
<Button Content="Auswahl hinzufügen"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="20,200,0,0"
|
||||
Width="150"
|
||||
Click="AddSelection_Click" />
|
||||
|
||||
|
||||
<!-- DataGrid zur Anzeige der bisherigen Eingaben -->
|
||||
<DataGrid x:Name="SelectionGrid"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top"
|
||||
Margin="20,230,20,0"
|
||||
Height="300"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
AutoGenerateColumns="False"
|
||||
ItemsSource="{Binding}" IsReadOnly="True" CanUserReorderColumns="False" CanUserResizeColumns="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Gegenstand" Binding="{Binding Name}" Width="Auto"/>
|
||||
<DataGridTemplateColumn Header="-" Width="20">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button Content="-"
|
||||
Click="MinusMengeButton_Click"
|
||||
Tag="{Binding}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="Menge" Binding="{Binding Menge}" Width="Auto"/>
|
||||
<DataGridTemplateColumn Header="+" Width="20">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button Content="+"
|
||||
Click="PlusMengeButton_Click"
|
||||
Tag="{Binding}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="Preis" Binding="{Binding gesPreisString}" Width="Auto"/>
|
||||
<DataGridTextColumn Header="Gewicht in kg" Binding="{Binding Gewicht}" Width="Auto"/>
|
||||
<DataGridTemplateColumn Header="Funktion" Width="*" >
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Funktion}" TextWrapping="Wrap" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="Aktion" Width="50">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button Content="Löschen"
|
||||
Click="DeleteButton_Click"
|
||||
Tag="{Binding}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<!-- Button zur Berechnung der Gesamtpreise -->
|
||||
<Button x:Name="GesamtpreisBerechnen"
|
||||
Content="Gesamtpreis berechnen"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="20,600,0,0"
|
||||
Width="200"
|
||||
Click="CalculateTotalPrice_Click" />
|
||||
|
||||
<!-- TextBlock zur Anzeige des Gesamtrechnungswerts -->
|
||||
<TextBlock x:Name="TotalPriceDisplay"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="240,600,0,0"
|
||||
FontSize="16"
|
||||
Background="LightGray"
|
||||
Text="Gesamtpreis: 0" />
|
||||
|
||||
<!-- TextBlock zur Anzeige des Gesamtrechnungswerts -->
|
||||
<TextBlock x:Name="TotalWightDisplay"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Margin="240,640,0,0"
|
||||
FontSize="16"
|
||||
Background="LightGray"
|
||||
Text="Gesamtgewicht: 0" />
|
||||
|
||||
<!-- Eingabefeld für Händler-Prozentsatz mit Beschreibung -->
|
||||
<StackPanel x:Name="HändlerGesamtProezent" Orientation="Vertical" HorizontalAlignment="Left" Margin="20,640,0,0">
|
||||
<TextBlock Text="Händler-gesamt-Prozentsatz:"
|
||||
FontSize="14"
|
||||
Margin="0,0,0,5"
|
||||
Background="LightGray"
|
||||
Foreground="Black"/>
|
||||
|
||||
<TextBox x:Name="MerchantGesPercentageTextBox"
|
||||
HorizontalAlignment="Left"
|
||||
Width="100"
|
||||
Text="0"
|
||||
ToolTip="Geben Sie den Prozentsatz ein, den der Händler auf den Preis aufschlägt." />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<StackPanel x:Name="ObjektHinzufügen"
|
||||
Orientation="Vertical" Margin="550,600,20,0">
|
||||
|
||||
<!-- TextBlock -->
|
||||
<TextBlock Text="Objektart-Auswahl"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
Margin="0,0,0,5"
|
||||
Width="200"
|
||||
Background="LightGray"
|
||||
Foreground="Black" />
|
||||
|
||||
<!-- ComboBox -->
|
||||
<ComboBox x:Name="ObjektAuswahlCombo"
|
||||
HorizontalAlignment="Left"
|
||||
Width="200"
|
||||
Margin="0,0,0,5"
|
||||
IsEditable="True"
|
||||
KeyUp="Combo_KeyUp" />
|
||||
|
||||
|
||||
<Button Content="Objekt Hinzufügen"
|
||||
HorizontalAlignment="Left"
|
||||
Width="200"
|
||||
Margin="0,0,0,10" Click="ObjektHinzufügenButton_Click" />
|
||||
<!-- Abstand nach unten -->
|
||||
|
||||
<Button Content="Objekt Löschen"
|
||||
HorizontalAlignment="Left"
|
||||
Width="200"
|
||||
Margin="0,0,0,10" Click="ObjektLöschenButton_Click" />
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<StackPanel x:Name="Rüstungsarten1"
|
||||
Orientation="Vertical"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="0,0,225,10"
|
||||
Visibility="Collapsed" Width="210" Height="218">
|
||||
<!-- Unsichtbar beim Start -->
|
||||
<TextBlock Text="Name:" Margin="5"
|
||||
Background="LightGray"
|
||||
Foreground="Black"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
/>
|
||||
<TextBox x:Name="txtRüstungsartName" Width="200" Margin="5" HorizontalAlignment="Left"/>
|
||||
|
||||
<TextBlock Text="Min. Stärke:" Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
Background="LightGray"
|
||||
Foreground="Black"/>
|
||||
<TextBox x:Name="txtRüstungsartMinStärke" Width="200" Margin="5" HorizontalAlignment="Left"/>
|
||||
|
||||
<TextBlock Text="Rüstungsbonus:" Margin="5" Background="LightGray"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
Foreground="Black"/>
|
||||
<TextBox x:Name="txtRüstungsartRüstungBonus" Width="200" Margin="5" HorizontalAlignment="Left"/>
|
||||
|
||||
<TextBlock Text="Manöver:" Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
Background="LightGray"
|
||||
Foreground="Black"/>
|
||||
<TextBox x:Name="txtRüstungsartManöver" Width="200" Margin="5" HorizontalAlignment="Left"/>
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel x:Name="Rüstungsarten2"
|
||||
Orientation="Vertical"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="0,0,10,10"
|
||||
Visibility="Collapsed" Width="200" Height="218">
|
||||
<!-- Unsichtbar beim Start -->
|
||||
<TextBlock Text="Kosten TT:" Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
Background="LightGray"
|
||||
Foreground="Black"/>
|
||||
<TextBox x:Name="txtRüstungsartKostenTT" Width="200" Margin="5" HorizontalAlignment="Left"/>
|
||||
|
||||
<TextBlock Text="Gewicht:" Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
Background="LightGray"
|
||||
Foreground="Black"/>
|
||||
<TextBox x:Name="txtGRüstungsartGewicht" Width="200" Margin="5" HorizontalAlignment="Left"/>
|
||||
|
||||
<Button x:Name="RüstungsartSpeichern"
|
||||
Content="Objekt speichern"
|
||||
Width="100"
|
||||
Margin="5"
|
||||
Click="RüstungsartSpeichern_Click"
|
||||
/>
|
||||
<Button x:Name="RüstungsartAbbrechen"
|
||||
Content="Abbrechen"
|
||||
Width="100"
|
||||
Margin="5"
|
||||
Click="RüstungsartAbbrechen_Click"
|
||||
/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel x:Name="Gegenstände1"
|
||||
Orientation="Vertical"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="0,0,225,10"
|
||||
Visibility="Collapsed" Width="210" Height="218">
|
||||
<!-- Unsichtbar beim Start -->
|
||||
<TextBlock Text="Name:" Margin="5"
|
||||
Background="LightGray"
|
||||
Foreground="Black"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
/>
|
||||
<TextBox x:Name="txtGegenstandName" Width="200" Margin="5" HorizontalAlignment="Left"/>
|
||||
|
||||
<TextBlock Text="Gewicht:" Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
Background="LightGray"
|
||||
Foreground="Black"/>
|
||||
<TextBox x:Name="txtGegenstandGewicht" Width="200" Margin="5" HorizontalAlignment="Left"/>
|
||||
|
||||
<TextBlock Text="Kosten TT:" Margin="5" Background="LightGray"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
Foreground="Black"/>
|
||||
<TextBox x:Name="txtGegenstandKostenTT" Width="200" Margin="5" HorizontalAlignment="Left"/>
|
||||
|
||||
<TextBlock Text="Häufigkeit:" Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
Background="LightGray"
|
||||
Foreground="Black"/>
|
||||
<TextBox x:Name="txtGegenstandHäufigkeit" Width="200" Margin="5" HorizontalAlignment="Left"/>
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel x:Name="Gegenstände2"
|
||||
Orientation="Vertical"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="0,0,10,10"
|
||||
Visibility="Collapsed" Width="200" Height="218">
|
||||
<!-- Unsichtbar beim Start -->
|
||||
<TextBlock Text="Funktion:" Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
Background="LightGray"
|
||||
Foreground="Black"/>
|
||||
<TextBox x:Name="txtGegenstandFunktion" Width="200" Margin="5" HorizontalAlignment="Left"/>
|
||||
|
||||
|
||||
|
||||
<Button x:Name="GegenstandSpeichern"
|
||||
Content="Objekt speichern"
|
||||
Width="100"
|
||||
Margin="5"
|
||||
Click="GegenstandSpeichern_Click"/>
|
||||
|
||||
<Button x:Name="GegenstandAbbrechen"
|
||||
Content="Abbrechen"
|
||||
Width="100"
|
||||
Margin="5"
|
||||
Click="GegenstandAbbrechen_Click"
|
||||
/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel x:Name="Gegenstand_Löschen"
|
||||
Orientation="Vertical"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="0,0,10,10"
|
||||
Visibility="Collapsed" Width="200" Height="218">
|
||||
|
||||
<TextBlock Text="Name des Objekts:" Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
Background="LightGray"
|
||||
Foreground="Black"/>
|
||||
<TextBox x:Name="NameObjektLöschenGegenstand" Width="200" Margin="5" HorizontalAlignment="Left"/>
|
||||
<Button x:Name="GegenstandLöschen"
|
||||
Content="Löschen"
|
||||
Width="100"
|
||||
Margin="5"
|
||||
Click="GegenstandLöschen_Click" />
|
||||
<Button x:Name="GegenstandLöschenAbbrechen"
|
||||
Content="Abbrechen"
|
||||
Width="100"
|
||||
Margin="5"
|
||||
Click="GegenstandLöschenAbbrechen_Click"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel x:Name="Rüstung_Löschen"
|
||||
Orientation="Vertical"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="0,0,10,10"
|
||||
Visibility="Collapsed" Width="200" Height="218">
|
||||
|
||||
<TextBlock Text="Name des Objekts:" Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
Background="LightGray"
|
||||
Foreground="Black"/>
|
||||
<TextBox x:Name="NameObjektLöschenRüstung" Width="200" Margin="5" HorizontalAlignment="Left"/>
|
||||
<Button x:Name="RüstungLöschen"
|
||||
Content="Löschen"
|
||||
Width="100"
|
||||
Margin="5"
|
||||
Click="RüstungLöschen_Click" />
|
||||
<Button x:Name="RüstungLöschenAbbrechen"
|
||||
Content="Abbrechen"
|
||||
Width="100"
|
||||
Margin="5"
|
||||
Click="RüstungLöschenAbbrechen_Click"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</Window>
|
378
Aborea-Projekt/MainWindow.xaml.cs
Normal file
378
Aborea-Projekt/MainWindow.xaml.cs
Normal file
@ -0,0 +1,378 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
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.Xml.Linq;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using SQLitePCL;
|
||||
|
||||
namespace Aborea_Projekt
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private MainWindow_Controler controler;
|
||||
private ObservableCollection<KaufObjekt> KaufListe = new ObservableCollection<KaufObjekt>();
|
||||
private readonly Datenbank _Datenbank;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
ImageSource imageSource = ConvertByteArrayToImageSource(Properties.Resources.Handel);
|
||||
// Erstelle einen ImageBrush mit der ImageSource
|
||||
ImageBrush imageBrush = new ImageBrush(imageSource);
|
||||
|
||||
// Setze das Bild als Hintergrund des Fensters
|
||||
this.Background = imageBrush;
|
||||
|
||||
// Controller initialisieren
|
||||
controler = new MainWindow_Controler();
|
||||
|
||||
//DAtenbank erstellen
|
||||
_Datenbank = new();
|
||||
|
||||
// SQLite initialisieren
|
||||
SQLitePCL.Batteries.Init();
|
||||
|
||||
// Fenster beim Start maximieren
|
||||
this.WindowState = WindowState.Normal;
|
||||
|
||||
// Event-Handler für Window Loaded registrieren
|
||||
this.Loaded += Window_Loaded;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Event-Handler für das Window Loaded-Ereignis
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
// Initialisiere die ComboBox mit den Daten aus dem Controller
|
||||
Combo.ItemsSource = controler.GetComboboxInhalt();
|
||||
// Definiere, welcher Teil des Objekts angezeigt wird
|
||||
Combo.DisplayMemberPath = "Item1"; // Zeigt nur den Namen (Item1 im Tuple)
|
||||
|
||||
SelectionGrid.ItemsSource = KaufListe;
|
||||
|
||||
ObjektAuswahlCombo.ItemsSource = controler.GetObjektAuswahlCombo();
|
||||
}
|
||||
|
||||
|
||||
public static ImageSource? ConvertByteArrayToImageSource(byte[] byteArray)
|
||||
{
|
||||
if (byteArray == null || byteArray.Length == 0)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
// Erstelle einen MemoryStream aus dem Byte-Array
|
||||
using (MemoryStream stream = new MemoryStream(byteArray))
|
||||
{
|
||||
// Erstelle ein BitmapImage aus dem MemoryStream
|
||||
BitmapImage bitmapImage = new BitmapImage();
|
||||
bitmapImage.BeginInit();
|
||||
bitmapImage.StreamSource = stream;
|
||||
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
|
||||
bitmapImage.EndInit();
|
||||
|
||||
return bitmapImage;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Fehlerbehandlung
|
||||
MessageBox.Show($"Fehler beim Konvertieren des Byte-Arrays zu ImageSource: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void AddSelection_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
controler.AddSelection_Click(QuantityTextBox.Text, MerchantPercentageTextBox.Text, Combo.SelectedItem, KaufListe);
|
||||
RefreshSelectionGrid();
|
||||
}
|
||||
|
||||
|
||||
private void Combo_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
|
||||
controler.KeyUp(Combo.Text, Combo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void CalculateTotalPrice_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
TotalPriceDisplay.Text = "Gesamtpreis: " + controler.KomplettPreisBerechnen(KaufListe, MerchantGesPercentageTextBox.Text);
|
||||
TotalWightDisplay.Text = "Gesamtgewicht: " + controler.KompletGewichtBerechnen(KaufListe) + " kg";
|
||||
}
|
||||
|
||||
private void DeleteButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button button && button.Tag is KaufObjekt itemToRemove)
|
||||
{
|
||||
// Element aus der ObservableCollection löschen
|
||||
if (KaufListe.Contains(itemToRemove))
|
||||
{
|
||||
KaufListe.Remove(itemToRemove);
|
||||
RefreshSelectionGrid();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MinusMengeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button button && button.Tag is KaufObjekt itemToMinusMenge)
|
||||
{
|
||||
controler.MinusMenge(itemToMinusMenge);
|
||||
if (itemToMinusMenge.Menge == 0)
|
||||
{
|
||||
KaufListe.Remove(itemToMinusMenge);
|
||||
}
|
||||
RefreshSelectionGrid();
|
||||
// Entferne das Objekt, wenn die Menge 0 ist
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void PlusMengeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button button && button.Tag is KaufObjekt itemToPlusMenge)
|
||||
{
|
||||
controler.PlusMenge(itemToPlusMenge);
|
||||
RefreshSelectionGrid();
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshSelectionGrid()
|
||||
{
|
||||
SelectionGrid.ItemsSource = null;
|
||||
SelectionGrid.ItemsSource = KaufListe.OrderBy(k => k.Name).ToList();
|
||||
}
|
||||
|
||||
private void ObjektHinzufügenButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
if (ObjektAuswahlCombo.Text == "Rüstungsarten")
|
||||
{
|
||||
Rüstungsarten1.Visibility = Visibility.Visible;
|
||||
Rüstungsarten2.Visibility = Visibility.Visible;
|
||||
ObjektHinzufügen.Visibility = Visibility.Collapsed;
|
||||
GesamtpreisBerechnen.Visibility = Visibility.Collapsed;
|
||||
TotalPriceDisplay.Visibility = Visibility.Collapsed;
|
||||
TotalWightDisplay.Visibility = Visibility.Collapsed;
|
||||
HändlerGesamtProezent.Visibility = Visibility.Collapsed;
|
||||
Combo.Text = string.Empty;
|
||||
ObjektAuswahlCombo.Text = string.Empty;
|
||||
|
||||
|
||||
}
|
||||
if (ObjektAuswahlCombo.Text == "Gegenstände")
|
||||
{
|
||||
Gegenstände1.Visibility = Visibility.Visible;
|
||||
Gegenstände2.Visibility = Visibility.Visible;
|
||||
ObjektHinzufügen.Visibility = Visibility.Collapsed;
|
||||
GesamtpreisBerechnen.Visibility = Visibility.Collapsed;
|
||||
TotalPriceDisplay.Visibility = Visibility.Collapsed;
|
||||
TotalWightDisplay.Visibility = Visibility.Collapsed;
|
||||
HändlerGesamtProezent.Visibility = Visibility.Collapsed;
|
||||
Combo.Text = string.Empty;
|
||||
ObjektAuswahlCombo.Text = string.Empty;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void RüstungsartSpeichern_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
MainWindow_Controler.SpeichereRüstungsart(txtRüstungsartName.Text, txtRüstungsartMinStärke.Text, txtRüstungsartRüstungBonus.Text, txtRüstungsartManöver.Text, txtRüstungsartKostenTT.Text, txtGRüstungsartGewicht.Text);
|
||||
|
||||
// Sichtbarkeit der UI-Komponenten steuern
|
||||
GesamtpreisBerechnen.Visibility = Visibility.Visible;
|
||||
TotalPriceDisplay.Visibility = Visibility.Visible;
|
||||
TotalWightDisplay.Visibility = Visibility.Visible;
|
||||
HändlerGesamtProezent.Visibility = Visibility.Visible;
|
||||
Rüstungsarten1.Visibility = Visibility.Collapsed;
|
||||
Rüstungsarten2.Visibility = Visibility.Collapsed;
|
||||
ObjektHinzufügen.Visibility = Visibility.Visible;
|
||||
controler.ClearUserInputs(Rüstungsarten1);
|
||||
controler.ClearUserInputs(Rüstungsarten2 );
|
||||
|
||||
|
||||
ObjektAuswahlCombo.ItemsSource = controler.GetObjektAuswahlCombo();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void GegenstandSpeichern_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MainWindow_Controler.SpeichereGegenstand(txtGegenstandName.Text, txtGegenstandGewicht.Text, txtGegenstandKostenTT.Text, txtGegenstandHäufigkeit.Text, txtGegenstandFunktion.Text);
|
||||
|
||||
|
||||
// UI-Elemente anpassen
|
||||
GesamtpreisBerechnen.Visibility = Visibility.Visible;
|
||||
TotalPriceDisplay.Visibility = Visibility.Visible;
|
||||
TotalWightDisplay.Visibility = Visibility.Visible;
|
||||
HändlerGesamtProezent.Visibility = Visibility.Visible;
|
||||
Gegenstände1.Visibility = Visibility.Collapsed;
|
||||
Gegenstände2.Visibility = Visibility.Collapsed;
|
||||
ObjektHinzufügen.Visibility = Visibility.Visible;
|
||||
controler.ClearUserInputs(Gegenstände1);
|
||||
controler.ClearUserInputs(Gegenstände2);
|
||||
|
||||
ObjektAuswahlCombo.ItemsSource = controler.GetObjektAuswahlCombo();
|
||||
|
||||
}
|
||||
|
||||
private void RüstungsartAbbrechen_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
controler.ClearUserInputs(Rüstungsarten2);
|
||||
controler.ClearUserInputs(Rüstungsarten1);
|
||||
GesamtpreisBerechnen.Visibility = Visibility.Visible;
|
||||
TotalPriceDisplay.Visibility = Visibility.Visible;
|
||||
TotalWightDisplay.Visibility = Visibility.Visible;
|
||||
HändlerGesamtProezent.Visibility = Visibility.Visible;
|
||||
Rüstungsarten1.Visibility = Visibility.Collapsed;
|
||||
Rüstungsarten2.Visibility = Visibility.Collapsed;
|
||||
ObjektHinzufügen.Visibility = Visibility.Visible;
|
||||
|
||||
}
|
||||
|
||||
private void GegenstandAbbrechen_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
controler.ClearUserInputs(Gegenstände1);
|
||||
controler.ClearUserInputs(Gegenstände2);
|
||||
|
||||
GesamtpreisBerechnen.Visibility = Visibility.Visible;
|
||||
TotalPriceDisplay.Visibility = Visibility.Visible;
|
||||
TotalWightDisplay.Visibility = Visibility.Visible;
|
||||
HändlerGesamtProezent.Visibility = Visibility.Visible;
|
||||
Gegenstände1.Visibility = Visibility.Collapsed;
|
||||
Gegenstände2.Visibility = Visibility.Collapsed;
|
||||
ObjektHinzufügen.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
|
||||
private void ObjektLöschenButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (ObjektAuswahlCombo.Text == "Rüstungsarten")
|
||||
{
|
||||
Rüstung_Löschen.Visibility = Visibility.Visible;
|
||||
ObjektHinzufügen.Visibility = Visibility.Collapsed;
|
||||
GesamtpreisBerechnen.Visibility = Visibility.Collapsed;
|
||||
TotalPriceDisplay.Visibility = Visibility.Collapsed;
|
||||
TotalWightDisplay.Visibility = Visibility.Collapsed;
|
||||
HändlerGesamtProezent.Visibility = Visibility.Collapsed;
|
||||
Combo.Text = string.Empty;
|
||||
ObjektAuswahlCombo.Text = string.Empty;
|
||||
|
||||
|
||||
}
|
||||
if (ObjektAuswahlCombo.Text == "Gegenstände")
|
||||
{
|
||||
Gegenstand_Löschen.Visibility = Visibility.Visible;
|
||||
ObjektHinzufügen.Visibility = Visibility.Collapsed;
|
||||
GesamtpreisBerechnen.Visibility = Visibility.Collapsed;
|
||||
TotalPriceDisplay.Visibility = Visibility.Collapsed;
|
||||
TotalWightDisplay.Visibility = Visibility.Collapsed;
|
||||
HändlerGesamtProezent.Visibility = Visibility.Collapsed;
|
||||
Combo.Text = string.Empty;
|
||||
ObjektAuswahlCombo.Text= string.Empty;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void GegenstandLöschen_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
controler.GegenstandLöschen(NameObjektLöschenGegenstand.Text);
|
||||
|
||||
GesamtpreisBerechnen.Visibility = Visibility.Visible;
|
||||
TotalPriceDisplay.Visibility = Visibility.Visible;
|
||||
TotalWightDisplay.Visibility = Visibility.Visible;
|
||||
HändlerGesamtProezent.Visibility = Visibility.Visible;
|
||||
Gegenstand_Löschen.Visibility = Visibility.Collapsed;
|
||||
ObjektHinzufügen.Visibility = Visibility.Visible;
|
||||
|
||||
controler.ClearUserInputs(Gegenstand_Löschen);
|
||||
|
||||
ObjektAuswahlCombo.ItemsSource = controler.GetObjektAuswahlCombo();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void GegenstandLöschenAbbrechen_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
controler.ClearUserInputs(Gegenstand_Löschen);
|
||||
|
||||
GesamtpreisBerechnen.Visibility = Visibility.Visible;
|
||||
TotalPriceDisplay.Visibility = Visibility.Visible;
|
||||
TotalWightDisplay.Visibility = Visibility.Visible;
|
||||
HändlerGesamtProezent.Visibility = Visibility.Visible;
|
||||
Gegenstand_Löschen.Visibility = Visibility.Collapsed;
|
||||
ObjektHinzufügen.Visibility = Visibility.Visible;
|
||||
|
||||
}
|
||||
|
||||
private void RüstungLöschen_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
controler.RüstungLöschen(NameObjektLöschenRüstung.Text);
|
||||
|
||||
GesamtpreisBerechnen.Visibility = Visibility.Visible;
|
||||
TotalPriceDisplay.Visibility = Visibility.Visible;
|
||||
TotalWightDisplay.Visibility = Visibility.Visible;
|
||||
HändlerGesamtProezent.Visibility = Visibility.Visible;
|
||||
Rüstung_Löschen.Visibility = Visibility.Collapsed;
|
||||
ObjektHinzufügen.Visibility = Visibility.Visible;
|
||||
|
||||
controler.ClearUserInputs(Rüstung_Löschen);
|
||||
|
||||
ObjektAuswahlCombo.ItemsSource = controler.GetObjektAuswahlCombo();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void RüstungLöschenAbbrechen_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
controler.ClearUserInputs(Rüstung_Löschen);
|
||||
|
||||
GesamtpreisBerechnen.Visibility = Visibility.Visible;
|
||||
TotalPriceDisplay.Visibility = Visibility.Visible;
|
||||
TotalWightDisplay.Visibility = Visibility.Visible;
|
||||
HändlerGesamtProezent.Visibility = Visibility.Visible;
|
||||
Rüstung_Löschen.Visibility = Visibility.Collapsed;
|
||||
ObjektHinzufügen.Visibility = Visibility.Visible;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
442
Aborea-Projekt/MainWindow_Controler.cs
Normal file
442
Aborea-Projekt/MainWindow_Controler.cs
Normal file
@ -0,0 +1,442 @@
|
||||
|
||||
using Microsoft.Data.Sqlite;
|
||||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Aborea_Projekt
|
||||
{
|
||||
internal class MainWindow_Controler
|
||||
{
|
||||
internal List<Tuple<string, double, double, string>> GetComboboxInhalt()
|
||||
{
|
||||
// Ruft eine LinkedList (verkettete Liste) von Rüstungsarten aus der Datenbank ab.
|
||||
LinkedList<Rüstungsart> rList = Datenbank.GetRüstungsarten();
|
||||
// Ruft eine LinkedList (verkettete Liste) von Gegenständen aus der Datenbank ab.
|
||||
LinkedList<Gegenstände> gList = Datenbank.GetGegenstände();
|
||||
|
||||
// Erstellt eine Liste von Tuple-Objekten, um die Daten zu speichern.
|
||||
// Das Tuple speichert drei Werte: Name (string), Kosten (double), Gewicht (double).
|
||||
List<Tuple<string, double, double,string>> tList = new List<Tuple<string, double, double,string>>();
|
||||
|
||||
// Arbeitet sich durch die Liste von Rüstungsarten (rList).
|
||||
if (rList.First == null) throw new Exception("Das sollte nicht Null sein");
|
||||
|
||||
LinkedListNode< Rüstungsart > x = rList.First;// Start bei der ersten Rüstungsart.
|
||||
bool end = false; // Kontrollvariable für die Schleife.
|
||||
while (end == false)// Schleife läuft, bis alle Elemente durchgegangen sind.
|
||||
{
|
||||
// Holt das aktuelle Element aus der Liste.
|
||||
if (x.Value == null) throw new Exception("Das sollte nicht Null sein");
|
||||
Rüstungsart a = x.Value;
|
||||
|
||||
// Erstelle den String basierend auf den Werten der Rüstungsart.
|
||||
string funktion = $"Manöver Bonus: {a.Manöver}, Mindes Stärke: {a.minStärke}, Rüstungs Bonus: {a.RüstungBonus}";
|
||||
|
||||
// Fügt ein neues Tuple mit den Eigenschaften der Rüstungsart in die Liste ein.
|
||||
tList.Add(new Tuple<string, double, double, string>(a.Name, a.KostenTT, a.Gewicht,funktion));
|
||||
// Wenn nicht das letzte Element, gehe zum nächsten Element.
|
||||
if (x != rList.Last)
|
||||
{
|
||||
if (x.Next == null) throw new Exception("Das sollte nicht Null sein");
|
||||
x = x.Next;
|
||||
}
|
||||
else
|
||||
{
|
||||
end = true;// Schleife beenden, wenn das letzte Element erreicht wurde.
|
||||
}
|
||||
}
|
||||
|
||||
// Wiederholt denselben Prozess für die Liste von Gegenständen (gList)
|
||||
if (gList.First == null) throw new Exception("Das sollte nicht Null sein");
|
||||
LinkedListNode<Gegenstände> y = gList.First;
|
||||
end = false;// Kontrollvariable für die neue Schleife zurücksetzen.
|
||||
while (end == false)
|
||||
{
|
||||
Gegenstände a = y.Value;
|
||||
tList.Add(new Tuple<string, double, double,string>(a.Name, a.KostenTT, a.Gewicht,a.Funktion));
|
||||
if (y != gList.Last)
|
||||
{
|
||||
if (y.Next == null) throw new Exception("Das sollte nicht Null sein");
|
||||
y = y.Next;
|
||||
}
|
||||
else
|
||||
{
|
||||
end = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Sortiert die Liste nach den Tupel-Werten. (Die Standard-Sortierung von Tuple verwendet lexikographische Reihenfolge.)
|
||||
tList.Sort();
|
||||
// Gibt die sortierte Liste zurück.
|
||||
return tList;
|
||||
}
|
||||
internal void InitMainWindow()
|
||||
{
|
||||
// Platzhalter-Methode für die Initialisierung des Hauptfensters.
|
||||
throw new NotImplementedException(); // Bedeutet, dass die Methode noch nicht implementiert ist.
|
||||
}
|
||||
|
||||
public Tuple<double, double> AuswahlSpeichern( int MengeAuswahl, double artikelGewicht,double artikelKosten, double HändlerProzentsatz)
|
||||
{
|
||||
// Berechnung der Gesamtkosten
|
||||
double gesKosten = artikelKosten * MengeAuswahl;
|
||||
if (HändlerProzentsatz != 0)
|
||||
{
|
||||
double Aufschlag = gesKosten * HändlerProzentsatz /100;
|
||||
gesKosten += Aufschlag;
|
||||
}
|
||||
|
||||
// Berechnung des Gesamtgewichts
|
||||
double gesGewicht = artikelGewicht * MengeAuswahl;
|
||||
|
||||
|
||||
// Rückgabe eines Tuple-Objekts mit den berechneten Werten
|
||||
return Tuple.Create(Math.Round(gesKosten, 2), Math.Round(gesGewicht, 2));
|
||||
|
||||
}
|
||||
|
||||
internal string KomplettPreisBerechnen(ObservableCollection<KaufObjekt> liste, string MerchantProzentBox)
|
||||
{
|
||||
|
||||
// Überprüfen, ob der Prozentsatz eine gültige ganze Zahl ist
|
||||
bool isProzentsatzValid = int.TryParse(MerchantProzentBox, out int händlerGesProzentsatz);
|
||||
|
||||
// Wenn die Eingabe ungültig ist, Fehlermeldung anzeigen und Methode beenden
|
||||
if (!isProzentsatzValid)
|
||||
{
|
||||
MessageBox.Show("Bitte geben Sie einen gültigen Prozentsatz (ganze Zahl) ein.", "Ungültige Eingabe", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return $"0GF 0TT 0Kl 0Mu";
|
||||
}
|
||||
|
||||
|
||||
double komplettPreis = 0;
|
||||
foreach (var item in liste)
|
||||
{
|
||||
komplettPreis += item.gesPreis;
|
||||
}
|
||||
if (händlerGesProzentsatz != 0)
|
||||
{
|
||||
double Aufschlag = komplettPreis * händlerGesProzentsatz / 100;
|
||||
komplettPreis += Aufschlag;
|
||||
}
|
||||
|
||||
// Umrechnung in GF, TT, Kl, Mu
|
||||
var ergebniss = PreisZuWehrung(komplettPreis);
|
||||
|
||||
|
||||
|
||||
return $"{ergebniss.Item1}GF {ergebniss.Item2}TT {ergebniss.Item3}Kl {ergebniss.Item4}Mu";
|
||||
}
|
||||
|
||||
|
||||
internal void MinusMenge(KaufObjekt itemToMinusMenge)
|
||||
{
|
||||
if (itemToMinusMenge.Menge > 0)
|
||||
{
|
||||
// Berechne den Einzelpreis und das Einzelgewicht
|
||||
double einzelPreis = Math.Round(itemToMinusMenge.gesPreis / itemToMinusMenge.Menge,2);
|
||||
double einzelGewicht = Math.Round(itemToMinusMenge.Gewicht / itemToMinusMenge.Menge,2);
|
||||
|
||||
// Menge verringern
|
||||
itemToMinusMenge.Menge--;
|
||||
|
||||
// Aktualisiere Gesamtpreis und Gesamtgewicht
|
||||
itemToMinusMenge.gesPreis = Math.Round(einzelPreis * itemToMinusMenge.Menge,2);
|
||||
itemToMinusMenge.Gewicht = Math.Round(einzelGewicht * itemToMinusMenge.Menge,2);
|
||||
|
||||
// Umrechnung in GF, TT, Kl, Mu
|
||||
var ergebniss = PreisZuWehrung(itemToMinusMenge.gesPreis);
|
||||
|
||||
|
||||
itemToMinusMenge.gesPreisString = $"{ergebniss.Item1}GF {ergebniss.Item2}TT {ergebniss.Item3}Kl {ergebniss.Item4}Mu";
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
internal void PlusMenge(KaufObjekt itemToPlusMenge)
|
||||
{
|
||||
// Erhöhe die Menge
|
||||
itemToPlusMenge.Menge++;
|
||||
|
||||
|
||||
// Berechne den Einzelpreis und das Einzelgewicht basierend auf der vorherigen Menge
|
||||
double einzelPreis = Math.Round(itemToPlusMenge.gesPreis / (itemToPlusMenge.Menge - 1), 2);
|
||||
double einzelGewicht = Math.Round(itemToPlusMenge.Gewicht / (itemToPlusMenge.Menge - 1), 2);
|
||||
|
||||
// Aktualisiere Gesamtpreis und Gesamtgewicht
|
||||
itemToPlusMenge.gesPreis = Math.Round(einzelPreis * itemToPlusMenge.Menge, 2);
|
||||
itemToPlusMenge.Gewicht = Math.Round(einzelGewicht * itemToPlusMenge.Menge, 2);
|
||||
|
||||
// Umrechnung in GF, TT, Kl, Mu
|
||||
|
||||
var ergebniss = PreisZuWehrung(itemToPlusMenge.gesPreis);
|
||||
|
||||
|
||||
itemToPlusMenge.gesPreisString = $"{ergebniss.Item1}GF {ergebniss.Item2}TT {ergebniss.Item3}Kl {ergebniss.Item4}Mu";
|
||||
|
||||
}
|
||||
|
||||
internal double KompletGewichtBerechnen(ObservableCollection<KaufObjekt> kaufListe)
|
||||
{
|
||||
double KomplettGewicht = 0;
|
||||
foreach (var Item in kaufListe)
|
||||
{
|
||||
KomplettGewicht += Item.Gewicht;
|
||||
}
|
||||
|
||||
return Math.Round(KomplettGewicht, 2);
|
||||
}
|
||||
|
||||
internal string AuswahlPreisString(double item1)
|
||||
{
|
||||
// Umrechnung in GF, TT, Kl, Mu
|
||||
var ergebniss = PreisZuWehrung(item1);
|
||||
|
||||
|
||||
return $"{ergebniss.Item1}GF {ergebniss.Item2}TT {ergebniss.Item3}Kl {ergebniss.Item4}Mu";
|
||||
}
|
||||
|
||||
internal IEnumerable<string> GetObjektAuswahlCombo()
|
||||
{
|
||||
// Eine Liste der Tabellenüberschriften erstellen.
|
||||
return new List<string>
|
||||
{
|
||||
"Rüstungsarten",
|
||||
"Gegenstände"
|
||||
};
|
||||
}
|
||||
|
||||
internal static void SpeichereRüstungsart(string Name, string MinStärke, string RüstungsBonus, string Manöver, string Kosten, string Gewicht)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
// Werte aus den Textboxen auslesen
|
||||
string name = Name;
|
||||
int minStärke = int.TryParse(MinStärke, out int parsedMinStärke) ? parsedMinStärke : 0;
|
||||
int rüstungBonus = int.TryParse(RüstungsBonus, out int parsedRüstungBonus) ? parsedRüstungBonus : 0;
|
||||
int manöver = int.TryParse(Manöver, out int parsedManöver) ? parsedManöver : 0;
|
||||
double kostenTT = double.TryParse(Kosten, out double parsedKostenTT) ? parsedKostenTT : 0;
|
||||
double gewicht = double.TryParse(Gewicht, out double parsedGewicht) ? parsedGewicht : 0;
|
||||
|
||||
// Erstelle eine neue Rüstungsart-Instanz
|
||||
Rüstungsart neueRüstung = new Rüstungsart(name, minStärke, rüstungBonus, manöver, kostenTT, gewicht);
|
||||
|
||||
// Rüstungsart in die Datenbank speichern
|
||||
Datenbank.SpeichereRüstungsart(neueRüstung);
|
||||
|
||||
// Erfolgsmeldung anzeigen
|
||||
MessageBox.Show("Rüstung gespeichert: " + neueRüstung.Name);
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Fehler beim Speichern der Rüstung: " + ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal static void SpeichereGegenstand(string Name, string Gewicht, string Kosten, string Häufigkeit, string Funktion)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
// Werte aus den TextBoxen auslesen
|
||||
string name = Name;
|
||||
double gewicht = double.TryParse(Gewicht, out double parsedGewicht) ? parsedGewicht : 0;
|
||||
double kostenTT = double.TryParse(Kosten, out double parsedKostenTT) ? parsedKostenTT : 0;
|
||||
string häufigkeit = Häufigkeit;
|
||||
string funktion = Funktion;
|
||||
|
||||
// Erstelle ein neues Objekt der Klasse Gegenstände
|
||||
Gegenstände neuerGegenstand = new Gegenstände(name, gewicht, kostenTT, häufigkeit, funktion);
|
||||
|
||||
// Speichere den Gegenstand über den Controller
|
||||
Datenbank.SpeichereGegenstand(neuerGegenstand);
|
||||
|
||||
// Bestätigungsmeldung
|
||||
MessageBox.Show($"Gegenstand '{neuerGegenstand.Name}' gespeichert!");
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Fehlerbehandlung
|
||||
MessageBox.Show("Fehler: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
internal void AddSelection_Click(string QuantityTextBox, string MerchantPercentageTextBox, object selectedItem, ObservableCollection<KaufObjekt> kaufListe)
|
||||
{
|
||||
|
||||
|
||||
// Überprüfen, ob die Eingaben gültige ganze Zahlen sind
|
||||
bool isMengeValid = int.TryParse(QuantityTextBox, out int MengeAuswahl);
|
||||
bool isProzentsatzValid = int.TryParse(MerchantPercentageTextBox, out int HändlerProzentsatz);
|
||||
|
||||
// Falls eine der Eingaben ungültig ist, nichts tun
|
||||
if (!isMengeValid || !isProzentsatzValid)
|
||||
{
|
||||
// Optional: Eine Fehlermeldung anzeigen, falls gewünscht
|
||||
MessageBox.Show("Bitte geben Sie gültige ganze Zahlen für Menge und Händlerprozentsatz ein.", "Ungültige Eingabe", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
// Ausgewähltes Objekt aus der ComboBox abrufen
|
||||
var AusgewähltesObjekt = selectedItem as Tuple<string, double, double, string>;
|
||||
if (AusgewähltesObjekt == null)
|
||||
{
|
||||
MessageBox.Show("Bitte wählen Sie ein gültiges Objekt aus.", "Fehler", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
// Ausgewähltes Objekt aus der ComboBox abrufen
|
||||
|
||||
string artikelName = AusgewähltesObjekt.Item1;
|
||||
double artikelKosten = AusgewähltesObjekt.Item2;
|
||||
double artikelGewicht = AusgewähltesObjekt.Item3;
|
||||
string artikelFunktion = AusgewähltesObjekt.Item4;
|
||||
|
||||
// Berechnungen durchführen
|
||||
var ergebnisse = AuswahlSpeichern(MengeAuswahl, artikelGewicht, artikelKosten, HändlerProzentsatz);
|
||||
string gesPreisString = AuswahlPreisString(ergebnisse.Item1);
|
||||
|
||||
double gesamtKosten = ergebnisse.Item1;
|
||||
double gesamtGewicht = ergebnisse.Item2;
|
||||
|
||||
|
||||
|
||||
// Neues Item zur KaufListe hinzufügen
|
||||
kaufListe.Add(new KaufObjekt
|
||||
{
|
||||
Name = artikelName,
|
||||
Menge = MengeAuswahl,
|
||||
Gewicht = gesamtGewicht,
|
||||
gesPreis = gesamtKosten,
|
||||
gesPreisString = gesPreisString,
|
||||
HändlerProzentsatz = HändlerProzentsatz,
|
||||
Funktion = artikelFunktion
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
internal void KeyUp(string textInthalt, ComboBox combo)
|
||||
{
|
||||
// Das Eingabefeld aus der ComboBox-Template extrahieren
|
||||
var textBox = textInthalt;
|
||||
|
||||
if (textBox == null)
|
||||
{
|
||||
Console.WriteLine("TextBox ist null!");
|
||||
return;
|
||||
}
|
||||
|
||||
string filterText = textBox.ToLower() ?? string.Empty;
|
||||
|
||||
var allItems = GetComboboxInhalt();
|
||||
if (allItems == null)
|
||||
{
|
||||
Console.WriteLine("Die Liste ist null!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Sicherstellen, dass jedes Element in einen string konvertiert wird, falls möglich
|
||||
var filteredItems = allItems
|
||||
.Where(item =>
|
||||
{
|
||||
string stringItem = item.ToString(); // Objekt sicher zu einem String konvertieren
|
||||
return stringItem != null && stringItem.ToLower().Contains(filterText);
|
||||
})
|
||||
.ToList();
|
||||
|
||||
Console.WriteLine($"Filtertext: {filterText}");
|
||||
Console.WriteLine($"Gefilterte Items: {string.Join(", ", filteredItems)}");
|
||||
|
||||
combo.ItemsSource = filteredItems;
|
||||
combo.IsDropDownOpen = true;
|
||||
}
|
||||
|
||||
internal void ClearUserInputs(StackPanel stackPanel)
|
||||
{
|
||||
foreach (var control in stackPanel.Children)
|
||||
{
|
||||
if (control is TextBox textBox)
|
||||
{
|
||||
// Leere den Inhalt der TextBox
|
||||
textBox.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void GegenstandLöschen(string GegenstandName)
|
||||
{
|
||||
Datenbank.LöscheGegenstand(GegenstandName);
|
||||
}
|
||||
|
||||
internal void RüstungLöschen(string RüstungName)
|
||||
{
|
||||
Datenbank.LöscheRüstung(RüstungName);
|
||||
}
|
||||
|
||||
internal static Tuple<string, string, string, string> PreisZuWehrung(double Preis)
|
||||
{
|
||||
|
||||
|
||||
string TextPreis = Preis.ToString();
|
||||
int KommaPosition = TextPreis.IndexOf(",");
|
||||
|
||||
string gf;
|
||||
if (KommaPosition >= 2)
|
||||
{
|
||||
gf = TextPreis.Substring(0, KommaPosition - 1);
|
||||
}
|
||||
else if(KommaPosition == -1)
|
||||
{
|
||||
gf = TextPreis.Substring(0, TextPreis.Length - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gf = "0";
|
||||
}
|
||||
|
||||
string tt;
|
||||
if (KommaPosition >= 1)
|
||||
{
|
||||
tt = TextPreis.Substring(KommaPosition-1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
tt = TextPreis.Substring(TextPreis.Length - 1,1);
|
||||
}
|
||||
|
||||
string kl;
|
||||
if (KommaPosition == -1)
|
||||
{
|
||||
kl = "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
kl = TextPreis.Substring(KommaPosition + 1, 1);
|
||||
}
|
||||
|
||||
string mu;
|
||||
if (KommaPosition != -1 && TextPreis.Length - KommaPosition >= 3)
|
||||
{
|
||||
mu = TextPreis.Substring(KommaPosition + 2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mu = "0";
|
||||
}
|
||||
|
||||
return new Tuple<string, string, string, string>(gf, tt, kl, mu);
|
||||
}
|
||||
}
|
||||
}
|
83
Aborea-Projekt/Properties/Resources.Designer.cs
generated
Normal file
83
Aborea-Projekt/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,83 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Aborea_Projekt.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
/// </summary>
|
||||
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Aborea_Projekt.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] Aborea {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Aborea", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Ressource vom Typ System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] Handel {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Handel", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
127
Aborea-Projekt/Properties/Resources.resx
Normal file
127
Aborea-Projekt/Properties/Resources.resx
Normal file
@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="Aborea" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Aborea.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="Handel" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Handel.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
BIN
Aborea-Projekt/Resources/Aborea.png
Normal file
BIN
Aborea-Projekt/Resources/Aborea.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 736 KiB |
BIN
Aborea-Projekt/Resources/Handel.png
Normal file
BIN
Aborea-Projekt/Resources/Handel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 771 KiB |
30
Aborea-Projekt/Rüstungsart.cs
Normal file
30
Aborea-Projekt/Rüstungsart.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Aborea_Projekt
|
||||
{
|
||||
internal class Rüstungsart
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int minStärke { get; set; }
|
||||
public int RüstungBonus { get; set; }
|
||||
public int Manöver { get; set; }
|
||||
|
||||
public double KostenTT { get; set; }
|
||||
public double Gewicht { get; set; }
|
||||
|
||||
public Rüstungsart(string Name, int minStärke, int RüstungBonus, int Manöver, double KostenTT, double Gewicht)
|
||||
{
|
||||
this.Name = Name;
|
||||
this.minStärke = minStärke;
|
||||
this.RüstungBonus = RüstungBonus;
|
||||
this.Manöver = Manöver;
|
||||
this.KostenTT = KostenTT;
|
||||
this.Gewicht = Gewicht;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user