Skip to content

Commit

Permalink
GUI in verschiedenen Sprachen auswählbar
Browse files Browse the repository at this point in the history
  • Loading branch information
BexanderAlong committed Feb 15, 2024
1 parent 7bde3da commit 4af9cb2
Show file tree
Hide file tree
Showing 20 changed files with 1,845 additions and 25 deletions.
9 changes: 9 additions & 0 deletions IFCGeoRefCheckerGUI/IFCGeoRefCheckerGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.it.Designer.cs">
<DependentUpon>Resources.it.resx</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="Properties\Resources.pt.Designer.cs">
<DependentUpon>Resources.pt.resx</DependentUpon>
<DesignTime>True</DesignTime>
Expand Down Expand Up @@ -80,6 +85,10 @@
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.it.resx">
<LastGenOutput>Resources.it.Designer.cs</LastGenOutput>
<Generator>ResXFileCodeGenerator</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.pt.resx">
<LastGenOutput>Resources.pt.Designer.cs</LastGenOutput>
<Generator>ResXFileCodeGenerator</Generator>
Expand Down
31 changes: 23 additions & 8 deletions IFCGeoRefCheckerGUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:IFCGeoRefCheckerGUI"
xmlns:props="clr-namespace:IFCGeoRefCheckerGUI.Properties"
xmlns:vm="clr-namespace:IFCGeoRefCheckerGUI.ViewModels" x:Class="IFCGeoRefCheckerGUI.MainWindow"
mc:Ignorable="d"
Title="IfcGeoRefChecker" Height="750" Width="650" MinWidth="650" MinHeight="750"
>

<Window.Resources>
<local:ResxConverter x:Key="ResxConverter" />
</Window.Resources>


<Window.DataContext>
<vm:MainWindowViewModel></vm:MainWindowViewModel>
</Window.DataContext>
Expand Down Expand Up @@ -41,7 +48,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label x:Name="WorkingDirLabel" Content="working directory" Grid.Row="0" Grid.Column="0"/>
<Label x:Name="WorkingDirLabel" Content="Working directory" Grid.Row="0" Grid.Column="0"/>
<TextBox x:Name="PathTextBox" Grid.Row="1" Grid.ColumnSpan="2"
Text="{Binding workingDirViewModel.WorkingDirPath, TargetNullValue='Please choose path!'}"
Margin="0,5,0,5" Padding="0,5,0,5" VerticalScrollBarVisibility="Auto"
Expand All @@ -52,7 +59,7 @@

<!-- Status View Model -->
<Grid Grid.Row="1">
<GroupBox x:Name="InputIFCGroupBox" Header="Input IFC Files">
<GroupBox x:Name="InputIFCGroupBox" Header="Input IFC-Files">
<Grid Margin="5,5,5,5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
Expand Down Expand Up @@ -129,23 +136,31 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<Image Source="/IFCGeorefCheckerGUI;component/images/DD-BIM-LOGO.png" Margin="5,5,5,5"/>

<Button x:Name="SetWorkinDirBtn" Grid.Row="1"
Content="Set Working Directory" Margin="10,10,10,10"
<Label x:Name="LanguageLabel" Content="Select language:" Grid.Row="1" Margin="10,10,10,0"/>
<ComboBox x:Name="LanguageComboBox" IsEditable="False"
SelectionChanged="LanguageComboBox_SelectionChanged" Grid.Row="2"
Margin="10,0,10,10" Padding="1,5,1,5"/>


<Button x:Name="SetWorkinDirBtn" Grid.Row="3"
Content="Set working directory" Margin="10,10,10,10"
Padding="1,5,1,5" Click="SetWorkinDirBtn_Click"
/>



<Button x:Name="LoadFilesBtn" Grid.Row="2"
<Button x:Name="LoadFilesBtn" Grid.Row="4"
Content="Load IFC-Files" Margin="10,10,10,10"
Padding="1,5,1,5" Click="LoadFilesBtn_Click" />


<Button x:Name="CheckFileBtn" Grid.Row="3"
Content="Check Selected File" Margin="10,10,10,10"
<Button x:Name="CheckFileBtn" Grid.Row="5"
Content="Check selected file" Margin="10,10,10,10"
Padding="1,5,1,5" Command="{Binding checkViewModel.CheckIFC}" CommandParameter="{Binding filePanelViewModel.FilePaths}"
/>

Expand Down
55 changes: 42 additions & 13 deletions IFCGeoRefCheckerGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
using OSGeo.OGR;
using IFCGeorefShared;
using IFCGeorefShared.Levels;
using System.Globalization;
using System.Threading;

namespace IFCGeoRefCheckerGUI
{
Expand All @@ -35,19 +37,16 @@ public MainWindow()
{
InitializeComponent();

SetWorkinDirBtn.Content = Properties.Resources.SET_WORKING_DIRECTORY;
LoadFilesBtn.Content = Properties.Resources.LOAD_IFC_FILES;
CheckFileBtn.Content = Properties.Resources.CHECK_SELECTED_FILE;
SetWorkDirGroupBox.Header = Properties.Resources.SET_WORKING_DIRECTORY;
WorkingDirLabel.Content = Properties.Resources.WORKING_DIRECTORY_LABEL;
PathTextBox.Text = Properties.Resources.PATH_TEXTBOX;
InputIFCGroupBox.Header = Properties.Resources.INPUT_IFC_FILES;
StatusLabel.Content = Properties.Resources.STATUS_LABEL;
LoadedIFCFilesLabel.Content = Properties.Resources.LOADED_IFC_FILES;
StatusReportGroupBox.Header = Properties.Resources.STATUS_REPORT;
ShowProtocolBtn.Content = Properties.Resources.SHOW_PROTOCOL;
LogOutputGroupBox.Header = Properties.Resources.LOG_OUTPUT;

// Fügen Sie die unterstützten Kulturen hinzu
LanguageComboBox.Items.Add(new ComboBoxItem { Content = "English", Tag = new CultureInfo("en-US") });
LanguageComboBox.Items.Add(new ComboBoxItem { Content = "Deutsch", Tag = new CultureInfo("de-DE") });
LanguageComboBox.Items.Add(new ComboBoxItem { Content = "Español", Tag = new CultureInfo("es-ES") });
LanguageComboBox.Items.Add(new ComboBoxItem { Content = "Français", Tag = new CultureInfo("fr-FR") });
LanguageComboBox.Items.Add(new ComboBoxItem { Content = "Italiano", Tag = new CultureInfo("it-IT") });
LanguageComboBox.Items.Add(new ComboBoxItem { Content = "Português", Tag = new CultureInfo("pt-PT") });

// Setzen Sie die anfängliche Auswahl auf die aktuelle Kultur
LanguageComboBox.SelectedIndex = 0;

((MainWindowViewModel)DataContext).checkViewModel.NoFileSelected += NoFileSelectedMessageBox;
((MainWindowViewModel)DataContext).checkViewModel.NoWorkingDirSelected += NoWorkingDirSelectedMessageBox;
Expand All @@ -63,6 +62,36 @@ public MainWindow()

}

public void LanguageComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var comboBox = (ComboBox)sender;
var comboBoxItem = (ComboBoxItem)comboBox.SelectedItem;
if(comboBoxItem.Tag is CultureInfo culture)
{
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
}

UpdateUITexts();
}

public void UpdateUITexts()
{
LanguageLabel.Content = Properties.Resources.LANGUAGE_LABEL;
SetWorkinDirBtn.Content = Properties.Resources.SET_WORKING_DIRECTORY;
LoadFilesBtn.Content = Properties.Resources.LOAD_IFC_FILES;
CheckFileBtn.Content = Properties.Resources.CHECK_SELECTED_FILE;
SetWorkDirGroupBox.Header = Properties.Resources.SET_WORKING_DIRECTORY;
WorkingDirLabel.Content = Properties.Resources.WORKING_DIRECTORY_LABEL;
//PathTextBox.Text = Properties.Resources.PATH_TEXTBOX;
InputIFCGroupBox.Header = Properties.Resources.INPUT_IFC_FILES;
StatusLabel.Content = Properties.Resources.STATUS_LABEL;
LoadedIFCFilesLabel.Content = Properties.Resources.LOADED_IFC_FILES;
StatusReportGroupBox.Header = Properties.Resources.STATUS_REPORT;
ShowProtocolBtn.Content = Properties.Resources.SHOW_PROTOCOL;
LogOutputGroupBox.Header = Properties.Resources.LOG_OUTPUT;
}

public void NoFileSelectedMessageBox(object? sender, EventArgs args)
{
MessageBox.Show("No file was selected!", "Missing file", MessageBoxButton.OK, MessageBoxImage.Error);
Expand Down
198 changes: 198 additions & 0 deletions IFCGeoRefCheckerGUI/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4af9cb2

Please sign in to comment.