diff --git a/Sources/Stim/AddGamePage.xaml b/Sources/Stim/AddGamePage.xaml
index ab1becb..f50ca06 100644
--- a/Sources/Stim/AddGamePage.xaml
+++ b/Sources/Stim/AddGamePage.xaml
@@ -41,7 +41,7 @@
-
+
@@ -62,6 +62,6 @@
-
+
\ No newline at end of file
diff --git a/Sources/Stim/AddGamePage.xaml.cs b/Sources/Stim/AddGamePage.xaml.cs
index c64ab19..88735d2 100644
--- a/Sources/Stim/AddGamePage.xaml.cs
+++ b/Sources/Stim/AddGamePage.xaml.cs
@@ -1,4 +1,6 @@
using Model;
+using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;
+using Application = Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific.Application;
namespace Stim;
@@ -9,12 +11,22 @@ public partial class AddGamePage : ContentPage
InitializeComponent();
}
- private void AddGame(object sender, EventArgs e)
+ private string? _ImgPath;
+
+
+ private void AddGame(object sender, EventArgs e)
{
int year;
- if (string.IsNullOrEmpty(NameEntry.Text) || string.IsNullOrEmpty(DescriptionEntry.Text) || string.IsNullOrEmpty(YearEntry.Text) || !int.TryParse(YearEntry.Text, out year) || string.IsNullOrWhiteSpace(LinkEntry.Text)) return;
-
- ((App)App.Current).Manager.AddGametoGamesList(new Game(NameEntry.Text, DescriptionEntry.Text, year, new List { TagEntry1.Text, TagEntry2.Text, TagEntry3.Text }, "nyancat.png", LinkEntry.Text));
+ if (string.IsNullOrEmpty(NameEntry.Text) || string.IsNullOrEmpty(DescriptionEntry.Text) || string.IsNullOrEmpty(YearEntry.Text) || !int.TryParse(YearEntry.Text, out year) || string.IsNullOrWhiteSpace(LinkEntry.Text) || _ImgPath is null) return;
+ string imgName = NameEntry.Text + ".png";
+ //System.IO.File.Copy(_ImgPath, /**/, true);
+ ((App)App.Current).Manager.AddGametoGamesList(new Game(NameEntry.Text, DescriptionEntry.Text, year, new List { TagEntry1.Text, TagEntry2.Text, TagEntry3.Text }, imgName, LinkEntry.Text));
Navigation.RemovePage(this);
}
+
+ private async void Button_Clicked(object sender, EventArgs e)
+ {
+ var ImgTask = await FilePicker.Default.PickAsync(null);
+ _ImgPath = ImgTask.FullPath;
+ }
}
\ No newline at end of file
diff --git a/Sources/Stim/MainPage.xaml.cs b/Sources/Stim/MainPage.xaml.cs
index a556c9d..445012a 100644
--- a/Sources/Stim/MainPage.xaml.cs
+++ b/Sources/Stim/MainPage.xaml.cs
@@ -3,7 +3,6 @@ using Model;
using StimPersistance;
using StimStub;
using Microsoft.Maui.Storage;
-using Windows.System;
public partial class MainPage : ContentPage
{