Throw exception when a not multiple instance template has been renamed
This commit is contained in:
Родитель
1897fce569
Коммит
2636e00095
|
@ -58,9 +58,7 @@ namespace Microsoft.Templates.Wizard.Steps.ConsumerFeatures.NewConsumerFeature
|
|||
{
|
||||
SetProperty(ref _itemName, value);
|
||||
|
||||
var validationResult = Naming.Validate(_selectedNames, value);
|
||||
|
||||
HandleValidation(validationResult);
|
||||
Validate(value);
|
||||
|
||||
OnPropertyChanged(nameof(OkCommand));
|
||||
}
|
||||
|
@ -126,6 +124,19 @@ namespace Microsoft.Templates.Wizard.Steps.ConsumerFeatures.NewConsumerFeature
|
|||
}
|
||||
}
|
||||
|
||||
private void Validate(string value)
|
||||
{
|
||||
//TODO: CREATE VALIDATION ERROR CLASS
|
||||
if (!TemplateSelected.MultipleInstances)
|
||||
{
|
||||
throw new Exception(Strings.ValidationError_RenameNotAllowed);
|
||||
}
|
||||
|
||||
var validationResult = Naming.Validate(_selectedNames, value);
|
||||
|
||||
HandleValidation(validationResult);
|
||||
}
|
||||
|
||||
private bool IsValid() => _isValid;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,6 +159,15 @@ namespace Microsoft.Templates.Wizard.Steps.ConsumerFeatures {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cannot set a custom name.
|
||||
/// </summary>
|
||||
public static string ValidationError_RenameNotAllowed {
|
||||
get {
|
||||
return ResourceManager.GetString("ValidationError_RenameNotAllowed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Name is reserved.
|
||||
/// </summary>
|
||||
|
|
|
@ -150,6 +150,9 @@
|
|||
<data name="ValidationError_Empty" xml:space="preserve">
|
||||
<value>Name cannot be empty</value>
|
||||
</data>
|
||||
<data name="ValidationError_RenameNotAllowed" xml:space="preserve">
|
||||
<value>Cannot set a custom name</value>
|
||||
</data>
|
||||
<data name="ValidationError_ReservedName" xml:space="preserve">
|
||||
<value>Name is reserved</value>
|
||||
</data>
|
||||
|
|
|
@ -58,9 +58,7 @@ namespace Microsoft.Templates.Wizard.Steps.DevFeatures.NewDevFeature
|
|||
{
|
||||
SetProperty(ref _itemName, value);
|
||||
|
||||
var validationResult = Naming.Validate(_selectedNames, value);
|
||||
|
||||
HandleValidation(validationResult);
|
||||
Validate(value);
|
||||
|
||||
OnPropertyChanged(nameof(OkCommand));
|
||||
}
|
||||
|
@ -125,6 +123,19 @@ namespace Microsoft.Templates.Wizard.Steps.DevFeatures.NewDevFeature
|
|||
}
|
||||
}
|
||||
|
||||
private void Validate(string value)
|
||||
{
|
||||
//TODO: CREATE VALIDATION ERROR CLASS
|
||||
if (!TemplateSelected.MultipleInstances)
|
||||
{
|
||||
throw new Exception(Strings.ValidationError_RenameNotAllowed);
|
||||
}
|
||||
|
||||
var validationResult = Naming.Validate(_selectedNames, value);
|
||||
|
||||
HandleValidation(validationResult);
|
||||
}
|
||||
|
||||
private bool IsValid() => _isValid;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,6 +159,15 @@ namespace Microsoft.Templates.Wizard.Steps.DevFeatures {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cannot set a custom name.
|
||||
/// </summary>
|
||||
public static string ValidationError_RenameNotAllowed {
|
||||
get {
|
||||
return ResourceManager.GetString("ValidationError_RenameNotAllowed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Name is reserved.
|
||||
/// </summary>
|
||||
|
|
|
@ -150,6 +150,9 @@
|
|||
<data name="ValidationError_Empty" xml:space="preserve">
|
||||
<value>Name cannot be empty</value>
|
||||
</data>
|
||||
<data name="ValidationError_RenameNotAllowed" xml:space="preserve">
|
||||
<value>Cannot set a custom name</value>
|
||||
</data>
|
||||
<data name="ValidationError_ReservedName" xml:space="preserve">
|
||||
<value>Name is reserved</value>
|
||||
</data>
|
||||
|
|
|
@ -56,9 +56,7 @@ namespace Microsoft.Templates.Wizard.Steps.Pages.NewPage
|
|||
{
|
||||
SetProperty(ref _itemName, value);
|
||||
|
||||
var validationResult = Naming.Validate(_selectedNames, value);
|
||||
|
||||
HandleValidation(validationResult);
|
||||
Validate(value);
|
||||
|
||||
OnPropertyChanged(nameof(OkCommand));
|
||||
}
|
||||
|
@ -114,6 +112,19 @@ namespace Microsoft.Templates.Wizard.Steps.Pages.NewPage
|
|||
}
|
||||
}
|
||||
|
||||
private void Validate(string value)
|
||||
{
|
||||
//TODO: CREATE VALIDATION ERROR CLASS
|
||||
if (!TemplateSelected.MultipleInstances)
|
||||
{
|
||||
throw new Exception(Strings.ValidationError_RenameNotAllowed);
|
||||
}
|
||||
|
||||
var validationResult = Naming.Validate(_selectedNames, value);
|
||||
|
||||
HandleValidation(validationResult);
|
||||
}
|
||||
|
||||
private bool IsValid() => _isValid;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,6 +150,15 @@ namespace Microsoft.Templates.Wizard.Steps.Pages {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cannot set a custom name.
|
||||
/// </summary>
|
||||
public static string ValidationError_RenameNotAllowed {
|
||||
get {
|
||||
return ResourceManager.GetString("ValidationError_RenameNotAllowed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Name is reserved.
|
||||
/// </summary>
|
||||
|
|
|
@ -147,6 +147,9 @@
|
|||
<data name="ValidationError_Empty" xml:space="preserve">
|
||||
<value>Name cannot be empty</value>
|
||||
</data>
|
||||
<data name="ValidationError_RenameNotAllowed" xml:space="preserve">
|
||||
<value>Cannot set a custom name</value>
|
||||
</data>
|
||||
<data name="ValidationError_ReservedName" xml:space="preserve">
|
||||
<value>Name is reserved</value>
|
||||
</data>
|
||||
|
|
Загрузка…
Ссылка в новой задаче