diff options
author | Ian Toal <iantoal@microsoft.com> | 2020-01-22 20:25:02 +0300 |
---|---|---|
committer | Ian Toal <iantoal@microsoft.com> | 2020-01-23 20:02:25 +0300 |
commit | a73f1918a332453d726693ba795329c4761b9c34 (patch) | |
tree | ea1779e0535d044074b861c61a0868980dda25f7 | |
parent | 12cb4a9b6d4917c12181fa0810729875db416b78 (diff) |
Fix up display strings
4 files changed, 41 insertions, 28 deletions
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/GtkDotNetCoreProjectTemplateWizardPageWidget.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/GtkDotNetCoreProjectTemplateWizardPageWidget.cs index 932a1e852a..66d5bc0f10 100644 --- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/GtkDotNetCoreProjectTemplateWizardPageWidget.cs +++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/GtkDotNetCoreProjectTemplateWizardPageWidget.cs @@ -71,7 +71,6 @@ namespace MonoDevelop.DotNetCore.Gui // Do not use a width request for the configuration box so the left hand side of the // wizard page can expand to fit its contents. configurationVBox.WidthRequest = -1; - targetFrameworkLabel.WidthRequest = -1; backgroundImage = Xwt.Drawing.Image.FromResource ("preview-netcore.png"); backgroundImageView = new ImageView (backgroundImage); @@ -87,11 +86,13 @@ namespace MonoDevelop.DotNetCore.Gui backgroundLargeImageEventBox.ModifyBg (StateType.Normal, backgroundColor); if (wizardPage.TargetFrameworks.Count > 1) { + targetFrameworkLabel.WidthRequest = -1; PopulateTargetFrameworks (); targetFrameworkComboBox.Changed += TargetFrameworkComboBoxChanged; } if (wizardPage.SupportedAuthentications.Count > 0) { + authenticationLabel.WidthRequest = -1; PopulateAuthentications (); authenticationComboBox.Changed += AuthenticationsComboBoxChanged; } @@ -118,11 +119,13 @@ namespace MonoDevelop.DotNetCore.Gui } authenticationComboBox.Active = wizardPage.SelectedAuthenticationIndex; + authenticationInformationLabel.LabelProp = wizardPage.SupportedAuthentications [wizardPage.SelectedAuthenticationIndex].Information; } void AuthenticationsComboBoxChanged (object sender, EventArgs e) { wizardPage.SelectedAuthenticationIndex = authenticationComboBox.Active; + authenticationInformationLabel.LabelProp = wizardPage.SupportedAuthentications [wizardPage.SelectedAuthenticationIndex].Information; } protected virtual void Build () @@ -276,7 +279,6 @@ namespace MonoDevelop.DotNetCore.Gui authenticationInformationLabel.Name = "authenticationInformationLabel"; authenticationInformationLabel.Xpad = 5; authenticationInformationLabel.Xalign = 0F; - authenticationInformationLabel.LabelProp = GettextCatalog.GetString ("Select authentication options for your project."); authenticationInformationLabel.Justify = (Justification)1; configurationTable.Add (authenticationInformationLabel); diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateParameters.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateParameters.cs index d4f82b589e..a2d6e91c3d 100644 --- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateParameters.cs +++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateParameters.cs @@ -26,40 +26,52 @@ using System; using System.Collections.Generic; using System.Linq; +using MonoDevelop.Core; using MonoDevelop.Ide; using MonoDevelop.Ide.Templates; namespace MonoDevelop.DotNetCore.Templating { - public class AuthenticationParameter + class AuthenticationParameter { static readonly string [] supportedParameters = new string [] { "None", "Individual" }; public static readonly string ParameterName = "auth"; - public string Name { get; private set; } + public string Name { get; } - public string Description { get; private set; } + public string Description => Name switch + { + "None" => GettextCatalog.GetString ("No Authentication"), + "Individual" => GettextCatalog.GetString ("Individual Authentication (in\u2013app)"), + _ => throw new ArgumentException ("Invalid auth parameter"), + }; + + public string Information => Name switch + { + "None" => GettextCatalog.GetString ("Select this option for applications that do not require any authentication."), + "Individual" => GettextCatalog.GetString ("Select this option to create a project that includes a local user account store."), + _ => throw new ArgumentException ("Invalid auth parameter"), + }; - public AuthenticationParameter(string name, string description) + public AuthenticationParameter (string name) { Name = name; - Description = description; } - public static IList<AuthenticationParameter> CreateSupportedParameterList(IReadOnlyDictionary<string, string> parameterChoices) + public static IList<AuthenticationParameter> CreateSupportedParameterList (IReadOnlyDictionary<string, string> parameterChoices) { - return parameterChoices.Where(choice => supportedParameters.Contains(choice.Key)) - .Select(parameter => new AuthenticationParameter(parameter.Key, parameter.Value)) + return parameterChoices.Where (choice => supportedParameters.Contains (choice.Key)) + .Select (parameter => new AuthenticationParameter (parameter.Key)) .ToList (); } } - public class DotNetCoreProjectTemplateParameters + class DotNetCoreProjectTemplateParameters { - public static IList<AuthenticationParameter> GetAuthenticationParameters (string templateId) + public static IList<AuthenticationParameter> GetAuthenticationParameters (string templateId) { - if (IdeServices.TemplatingService.GetSolutionTemplate (templateId) is MicrosoftTemplateEngineSolutionTemplate template){ + if (IdeServices.TemplatingService.GetSolutionTemplate (templateId) is MicrosoftTemplateEngineSolutionTemplate template) { if (template.IsSupportedParameter (AuthenticationParameter.ParameterName)) { var supportedAuth = template.GetParameterChoices (AuthenticationParameter.ParameterName); return AuthenticationParameter.CreateSupportedParameterList (supportedAuth); diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizard.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizard.cs index 6d213a5823..61e94bf0e9 100644 --- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizard.cs +++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizard.cs @@ -52,21 +52,21 @@ namespace MonoDevelop.DotNetCore.Templating internal IList<TargetFramework> TargetFrameworks => targetFrameworks; - internal IList<AuthenticationParameter> SupportedAuthentications { get; private set; } - - /// <summary> - /// When only .NET Core 2.0 is installed there is only one option in the drop down - /// list for the target framework for .NET Core projects so there is no point in displaying - /// the wizard since nothing can be changed. If .NET Core 1.0 is installed then there is at - /// least two options available. If the .NET Standard project template is selected then there - /// are multiple options available. So here a check is made to see if more than one target - /// framework is available. If not then the wizard will not be displayed. - /// </summary> - int GetTotalPages () + internal IList<AuthenticationParameter> SupportedAuthentications { get; private set; } + + /// <summary> + /// When only .NET Core 2.0 is installed there is only one option in the drop down + /// list for the target framework for .NET Core projects so there is no point in displaying + /// the wizard since nothing can be changed. If .NET Core 1.0 is installed then there is at + /// least two options available. If the .NET Standard project template is selected then there + /// are multiple options available. So here a check is made to see if more than one target + /// framework is available. If not then the wizard will not be displayed. + /// </summary> + int GetTotalPages () { - GetSupportedAuthentifications (); + GetSupportedAuthentications (); GetTargetFrameworks (); - if (targetFrameworks.Count > 1 || SupportedAuthentications.Any()) + if (targetFrameworks.Count > 1 || SupportedAuthentications.Any ()) return 1; ConfigureDefaultParameters (); @@ -74,7 +74,7 @@ namespace MonoDevelop.DotNetCore.Templating return 0; } - void GetSupportedAuthentifications () + void GetSupportedAuthentications () { var templateId = Parameters ["TemplateId"]; SupportedAuthentications = DotNetCoreProjectTemplateParameters.GetAuthenticationParameters (templateId); diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizardPage.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizardPage.cs index 50a25d7ccd..04f2bb7bba 100644 --- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizardPage.cs +++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizardPage.cs @@ -30,7 +30,6 @@ using MonoDevelop.Core; using MonoDevelop.Core.Assemblies; using MonoDevelop.DotNetCore.Gui; using MonoDevelop.Ide.Templates; -using MonoDevelop.Projects; namespace MonoDevelop.DotNetCore.Templating { |