diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..a0fc7a0 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + "version": "0.2.0", + "configurations": [ + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/dealer/bin/Debug/net8.0-windows/dealer.dll", + "args": [], + "cwd": "${workspaceFolder}/dealer", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..3c01c35 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/dealer/dealer.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/dealer/dealer.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/dealer/dealer.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/dealer/App.xaml b/dealer/App.xaml index 3c9ecaf..ad83905 100644 --- a/dealer/App.xaml +++ b/dealer/App.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:dealer" - StartupUri="MainWindow.xaml"> + StartupUri="windows/MainWindow.xaml"> diff --git a/dealer/App.xaml.cs b/dealer/App.xaml.cs index 28e6a80..1fe67fd 100644 --- a/dealer/App.xaml.cs +++ b/dealer/App.xaml.cs @@ -1,14 +1,12 @@ using System.Configuration; using System.Data; -using System.Windows; namespace dealer { /// /// Interaction logic for App.xaml /// - public partial class App : Application + public partial class App : System.Windows.Application { } - } diff --git a/dealer/DataManager.cs b/dealer/DataManager.cs new file mode 100644 index 0000000..822dbad --- /dev/null +++ b/dealer/DataManager.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace dealer +{ + public class DataManager + { + private List vehicles = new List(); + + public void AddVehicle(Vehicle vehicle) + { + vehicles.Add(vehicle); + } + + public IEnumerable GetAllVehicles() + { + return vehicles; + } + + public void RemoveVehicle(Vehicle vehicle) + { + vehicles.Remove(vehicle); + } + + public void Save() + { + // Implementace ukládání dat do souboru - JSON + var json = System.Text.Json.JsonSerializer.Serialize(vehicles); + System.IO.File.WriteAllText("vehicles.json", json); + } + + public void Load() + { + string path = "vehicles.json"; + + // Implementace načítání dat ze souboru - JSON + if (System.IO.File.Exists(path)) + { + var json = System.IO.File.ReadAllText(path); + vehicles = System.Text.Json.JsonSerializer.Deserialize>(json) ?? new List(); + } + } + } +} diff --git a/dealer/MainWindow.xaml b/dealer/MainWindow.xaml deleted file mode 100644 index d38fe50..0000000 --- a/dealer/MainWindow.xaml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - diff --git a/dealer/MainWindow.xaml.cs b/dealer/MainWindow.xaml.cs deleted file mode 100644 index c9b7cea..0000000 --- a/dealer/MainWindow.xaml.cs +++ /dev/null @@ -1,24 +0,0 @@ -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; - -namespace dealer -{ - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : Window - { - public MainWindow() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/dealer/Vehicle.cs b/dealer/Vehicle.cs new file mode 100644 index 0000000..04d2650 --- /dev/null +++ b/dealer/Vehicle.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace dealer +{ + public class Vehicle + { + public string? Spz { get; set; } + public string? Model { get; set; } + public string? Barva { get; set; } + public int? RokVyroby { get; set; } + public int? NajeteKm { get; set; } + public decimal? Cena { get; set; } + public string? Fotografie { get; set; } + } +} diff --git a/dealer/dealer.csproj b/dealer/dealer.csproj index e3e33e3..4adf208 100644 --- a/dealer/dealer.csproj +++ b/dealer/dealer.csproj @@ -6,6 +6,7 @@ enable enable true + true diff --git a/dealer/windows/AddVehicleWindow.xaml b/dealer/windows/AddVehicleWindow.xaml new file mode 100644 index 0000000..1d3462e --- /dev/null +++ b/dealer/windows/AddVehicleWindow.xaml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + +