From 6c8a44309b6a732d2746dadc9a9b762dbeeb2b66 Mon Sep 17 00:00:00 2001 From: grzybeek Date: Mon, 1 Apr 2024 01:55:17 +0200 Subject: [PATCH] simple project name validation --- grzyClothTool/Views/BuildWindow.xaml | 12 ++++----- grzyClothTool/Views/BuildWindow.xaml.cs | 33 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/grzyClothTool/Views/BuildWindow.xaml b/grzyClothTool/Views/BuildWindow.xaml index cdf48fd..ad5c5c5 100644 --- a/grzyClothTool/Views/BuildWindow.xaml +++ b/grzyClothTool/Views/BuildWindow.xaml @@ -38,12 +38,12 @@ + x:Name="name" + Label="Project name" + Margin="15,15,15,0" + VerticalAlignment="Top" + HorizontalAlignment="Stretch" + Text="{Binding ProjectName}" /> 50) + { + result = "Project name cannot be longer than 50 characters"; + } + else if (!Regex.IsMatch(ProjectName, @"^[a-z0-9_]+$")) + { + result = "Project name can only contain lowercase letters, numbers, and underscores"; + + } + + return result; + } } }