Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<ComboBox Grid.Row="3" Grid.Column="1" Name="ProductRevision" DisplayMemberPath="RevisionAndLabel" SelectionChanged="ProductRevisionChanged" />

<TextBlock Grid.Row="0" Grid.Column="3" Text="Site Name: " VerticalAlignment="Center" HorizontalAlignment="Left" Width="77" Grid.RowSpan="2" Height="16" Margin="0,6" Grid.ColumnSpan="3" />
<TextBox Grid.Row="0" Grid.Column="5" Name="InstanceName" Text="{Binding ElementName=ProductRevision, Path=SelectedValue, Converter={x:Static converters:Product._DefaultInstanceName}, Mode=OneWay}" Grid.RowSpan="2" />
<TextBox Grid.Row="0" Grid.Column="5" Name="InstanceName" Text="{Binding ElementName=ProductRevision, Path=SelectedValue, Converter={x:Static converters:Product._DefaultInstanceName}, Mode=OneWay}" Grid.RowSpan="2" PreviewTextInput="InstanceName_PreviewTextInput" />

<TextBlock Grid.Column="3" Grid.Row="2" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" Width="30" Margin="0,5" Height="16"><Run Text="Solr:"/></TextBlock>
<Button Grid.Column="4" Grid.Row="2" Content="+" Margin="0,3,0,2" Click="AddSolr_Click" HorizontalAlignment="Right" Width="23" />
Expand Down
14 changes: 14 additions & 0 deletions src/SIM.Tool.Windows/UserControls/Install/Instance9Details.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public partial class Instance9Details : IWizardStep, IFlowControl
private Window owner;
private InstallWizardArgs _InstallParameters = null;
private IEnumerable<Product> _StandaloneProducts;
private char[] _InvalidChars;

// According to the following document the maximum length for a path in Windows systems is defined as 260 characters:
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
Expand All @@ -57,6 +58,7 @@ public partial class Instance9Details : IWizardStep, IFlowControl
public Instance9Details()
{
InitializeComponent();
_InvalidChars = Path.GetInvalidFileNameChars();
}

#endregion
Expand Down Expand Up @@ -762,5 +764,17 @@ private void AddSolr_Click(object sender, RoutedEventArgs e)
this.Solrs.SelectedItem = solr;
}
}

private void InstanceName_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
{
if (e.Text.Any(c => _InvalidChars.Contains(c)))
{
WindowHelper.ShowMessage($"The enetered '{e.Text}' character is invalid for the site name.",
messageBoxImage: MessageBoxImage.Warning,
messageBoxButton: MessageBoxButton.OK
);
e.Handled = true;
}
}
}
}