From b6abd9f931ee4ce702de06c9c7fe33ffb9d576cc Mon Sep 17 00:00:00 2001
From: hovo-hakobyan <88614889+hovo-hakobyan@users.noreply.github.com>
Date: Thu, 1 Feb 2024 11:13:09 +0100
Subject: [PATCH 1/3] Textboxes have placeholder text instead of regular text
---
.../Converter/TextToVisibilityConverter.cs | 20 +++++++++++++++++++
SquadForger/SquadForger.csproj | 5 ++++-
SquadForger/View/SquadView.xaml | 18 +++++++++++++++--
SquadForger/ViewModel/SquadVM.cs | 3 +--
4 files changed, 41 insertions(+), 5 deletions(-)
create mode 100644 SquadForger/Converter/TextToVisibilityConverter.cs
diff --git a/SquadForger/Converter/TextToVisibilityConverter.cs b/SquadForger/Converter/TextToVisibilityConverter.cs
new file mode 100644
index 0000000..6f0a79f
--- /dev/null
+++ b/SquadForger/Converter/TextToVisibilityConverter.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace SquadForger.Converter
+{
+ public class TextToVisibilityConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return string.IsNullOrEmpty(value as string) ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/SquadForger/SquadForger.csproj b/SquadForger/SquadForger.csproj
index c4c8b61..6d8e9d1 100644
--- a/SquadForger/SquadForger.csproj
+++ b/SquadForger/SquadForger.csproj
@@ -126,6 +126,7 @@
MSBuild:Compile
Designer
+
@@ -197,7 +198,9 @@
-
+
+ PreserveNewest
+
diff --git a/SquadForger/View/SquadView.xaml b/SquadForger/View/SquadView.xaml
index adcb47d..90b1256 100644
--- a/SquadForger/View/SquadView.xaml
+++ b/SquadForger/View/SquadView.xaml
@@ -5,12 +5,16 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SquadForger.View"
xmlns:vm="clr-namespace:SquadForger.ViewModel"
+ xmlns:converter="clr-namespace:SquadForger.Converter"
mc:Ignorable="d"
d:DesignWidth="800" d:DesignHeight="450"
Title="Squad View">
+
+
+
@@ -25,7 +29,12 @@
-
+
+
+
+
@@ -34,7 +43,12 @@
-
+
+
+
+
diff --git a/SquadForger/ViewModel/SquadVM.cs b/SquadForger/ViewModel/SquadVM.cs
index a48b528..210dc57 100644
--- a/SquadForger/ViewModel/SquadVM.cs
+++ b/SquadForger/ViewModel/SquadVM.cs
@@ -28,14 +28,13 @@ public class SquadVM : ObservableObject
private LeagueVersion _lastVersionUsed;
public RelayCommand CustomGenerateCommand { get; private set; }
- public string LeagueVersionText { get; set; } = "Enter valid season and patch (ie 14.1.1)";
+ public string LeagueVersionText { get; set; }
public SquadVM()
{
SelectFileCommand = new RelayCommand(ReadTeamsFromCsv);
AddTeamsCommand = new RelayCommand(AddTeams);
ClearTeamsCommand = new RelayCommand(ClearTeams);
- TeamsInput = "Enter team names, separated by commas";
CustomGenerateCommand = new RelayCommand(CustomGenerate);
GetFallBackChampionNames();
From 1b214d0e25f0acf83c1e072cbdd44dd9908a4994 Mon Sep 17 00:00:00 2001
From: hovo-hakobyan <88614889+hovo-hakobyan@users.noreply.github.com>
Date: Thu, 1 Feb 2024 12:12:18 +0100
Subject: [PATCH 2/3] Removed visualize V and VM
---
SquadForger/MainWindow.xaml | 3 ---
SquadForger/SquadForger.csproj | 5 -----
SquadForger/SquadForger.sln | 1 +
SquadForger/View/VisualizeView.xaml | 24 ------------------------
SquadForger/View/VisualizeView.xaml.cs | 12 ------------
SquadForger/ViewModel/MainVM.cs | 1 -
SquadForger/ViewModel/VisualizeVM.cs | 7 -------
7 files changed, 1 insertion(+), 52 deletions(-)
delete mode 100644 SquadForger/View/VisualizeView.xaml
delete mode 100644 SquadForger/View/VisualizeView.xaml.cs
delete mode 100644 SquadForger/ViewModel/VisualizeVM.cs
diff --git a/SquadForger/MainWindow.xaml b/SquadForger/MainWindow.xaml
index 8e60cf8..dff0cbe 100644
--- a/SquadForger/MainWindow.xaml
+++ b/SquadForger/MainWindow.xaml
@@ -19,9 +19,6 @@
-
-
-
diff --git a/SquadForger/SquadForger.csproj b/SquadForger/SquadForger.csproj
index 6d8e9d1..7195c9b 100644
--- a/SquadForger/SquadForger.csproj
+++ b/SquadForger/SquadForger.csproj
@@ -138,16 +138,12 @@
-
DiscordView.xaml
SquadView.xaml
-
- VisualizeView.xaml
-
MSBuild:Compile
Designer
@@ -165,7 +161,6 @@
MSBuild:Compile
-
diff --git a/SquadForger/SquadForger.sln b/SquadForger/SquadForger.sln
index b645042..5a6b31c 100644
--- a/SquadForger/SquadForger.sln
+++ b/SquadForger/SquadForger.sln
@@ -15,6 +15,7 @@ Global
{B390DD8F-015F-483E-9913-B7EF1B10A89E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B390DD8F-015F-483E-9913-B7EF1B10A89E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B390DD8F-015F-483E-9913-B7EF1B10A89E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B390DD8F-015F-483E-9913-B7EF1B10A89E}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/SquadForger/View/VisualizeView.xaml b/SquadForger/View/VisualizeView.xaml
deleted file mode 100644
index bdda9c9..0000000
--- a/SquadForger/View/VisualizeView.xaml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SquadForger/View/VisualizeView.xaml.cs b/SquadForger/View/VisualizeView.xaml.cs
deleted file mode 100644
index 973b5cb..0000000
--- a/SquadForger/View/VisualizeView.xaml.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Windows.Controls;
-
-namespace SquadForger.View
-{
- public partial class VisualizeView : Page
- {
- public VisualizeView()
- {
- InitializeComponent();
- }
- }
-}
\ No newline at end of file
diff --git a/SquadForger/ViewModel/MainVM.cs b/SquadForger/ViewModel/MainVM.cs
index c4fd40d..60f1e11 100644
--- a/SquadForger/ViewModel/MainVM.cs
+++ b/SquadForger/ViewModel/MainVM.cs
@@ -10,7 +10,6 @@ public class MainVM : ObservableObject
public string WindowTitle { get; private set; } = $"Squad Forger v0.0.1";
public RelayCommand OpenGithubRepoCommand { get; private set; }
public SquadView SquadPage { get; private set; } = new SquadView();
- public VisualizeView VisualizePage { get; private set; } = new VisualizeView();
public DiscordView DiscordPage { get; private set; } = new DiscordView();
public MainVM()
diff --git a/SquadForger/ViewModel/VisualizeVM.cs b/SquadForger/ViewModel/VisualizeVM.cs
deleted file mode 100644
index 53cc031..0000000
--- a/SquadForger/ViewModel/VisualizeVM.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace SquadForger.ViewModel
-{
- public class VisualizeVM
- {
-
- }
-}
\ No newline at end of file
From 4d6f18584cdb5e5d7144ad17d285df5b7ddc0368 Mon Sep 17 00:00:00 2001
From: hovo-hakobyan <88614889+hovo-hakobyan@users.noreply.github.com>
Date: Thu, 1 Feb 2024 12:18:32 +0100
Subject: [PATCH 3/3] Fix crash when pressing 'Add' with an empty textbox
---
SquadForger/ViewModel/SquadVM.cs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/SquadForger/ViewModel/SquadVM.cs b/SquadForger/ViewModel/SquadVM.cs
index b5c9548..0038d3a 100644
--- a/SquadForger/ViewModel/SquadVM.cs
+++ b/SquadForger/ViewModel/SquadVM.cs
@@ -164,6 +164,8 @@ private void ReadTeamsFromCsv()
private void AddTeams()
{
+ if (TeamsInput == null) return;
+ if (!TeamsInput.Any()) return;
// Split the input by commas and remove empty entries
List teamNames = TeamsInput.Split(',').Select(s => s.Trim()).Where(s => !string.IsNullOrWhiteSpace(s)).ToList();