Commit 382fc841 authored by Kad Venku's avatar Kad Venku

Add items now supported.

parent 23dff09d
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="eaw_texteditor.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
</startup>
<userSettings>
<eaw_texteditor.Properties.Settings>
<setting name="USR_LOADED_LANGUAGE" serializeAs="String">
<value>ENGLISH</value>
</setting>
</eaw_texteditor.Properties.Settings>
</userSettings>
</configuration>
......@@ -22,5 +22,17 @@ namespace eaw_texteditor.Properties {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("ENGLISH")]
public global::ts.translation.common.typedefs.PGLanguage USR_LOADED_LANGUAGE {
get {
return ((global::ts.translation.common.typedefs.PGLanguage)(this["USR_LOADED_LANGUAGE"]));
}
set {
this["USR_LOADED_LANGUAGE"] = value;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="eaw_texteditor.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="USR_LOADED_LANGUAGE" Type="ts.translation.common.typedefs.PGLanguage" Scope="User">
<Value Profile="(Default)">ENGLISH</Value>
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
<simpleChildWindow:ChildWindow
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:eaw_texteditor.client.ui.dialogs.add"
xmlns:simpleChildWindow="clr-namespace:MahApps.Metro.SimpleChildWindow;assembly=MahApps.Metro.SimpleChildWindow"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" x:Class="eaw_texteditor.client.ui.dialogs.add.AddTextKeyWindow"
BorderBrush="{DynamicResource AccentBaseColorBrush}"
BorderThickness="1"
GlowBrush="{DynamicResource AccentColorBrush}"
mc:Ignorable="d"
ShowTitleBar="False"
HorizontalContentAlignment="Stretch"
EnableDropShadow="False"
CloseByEscape="False">
<simpleChildWindow:ChildWindow.OverlayBrush>
<SolidColorBrush Opacity="0.35" Color="{StaticResource BlackColor}" />
</simpleChildWindow:ChildWindow.OverlayBrush>
<Grid Margin="20, 30">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="_keyTextBox" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" Text="{Binding Key, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding IsKeyEditable, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Background="{Binding BackgroundColor}"/>
<Rectangle Fill="Crimson" Grid.Row="0" Grid.Column="2" Height="25" Width="15" Margin="5,0,0,0" Visibility="{Binding IsBoltVisible}">
<Rectangle.OpacityMask>
<VisualBrush Visual="{iconPacks:FontAwesome BoltSolid}"/>
</Rectangle.OpacityMask>
</Rectangle>
<TextBlock Grid.Row="1" Grid.Column="1" Foreground="Crimson" Text="The text key should only contain uppercase letters, numbers and underscores. Some hardcoded vanilla keys do not follow this convention, so the message can be disregarded for those keys." Visibility="{Binding IsBoltVisible}" Margin="0" TextWrapping="Wrap"/>
<TextBox x:Name="_valueTextBox" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Stretch" Margin="0,5" Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" SpellCheck.IsEnabled="True" MinLines="5"/>
<UniformGrid Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" Columns="2">
<Button Content="Add" Margin="5" Click="OnAddClick" IsEnabled="{Binding IsValidKey, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
<Button Content="Cancel" IsDefault="True" Margin="5" Click="OnCancelClick"/>
</UniformGrid>
</Grid>
</simpleChildWindow:ChildWindow>
using System.Windows;
using eaw_texteditor.shared.data.dialogs.edit;
using MahApps.Metro.SimpleChildWindow;
using ts.translation.data.holder.observables;
namespace eaw_texteditor.client.ui.dialogs.add
{
/// <summary>
/// Interaction logic for AddTextKeyWindow.xaml
/// </summary>
public partial class AddTextKeyWindow : ChildWindow
{
internal EditTextKeyWindowData FormData { get; set; }
public AddTextKeyWindow(ObservableTranslationData translation)
{
InitializeComponent();
FormData = new EditTextKeyWindowData() { Translation = translation };
DataContext = FormData;
FormData.IsKeyEditable = true;
FormData.IsValidKey = false;
FormData.IsBoltVisible = Visibility.Visible;
}
private void OnAddClick(object sender, RoutedEventArgs e)
{
this.Close(true);
}
private void OnCancelClick(object sender, RoutedEventArgs e)
{
this.Close(false);
}
}
}
......@@ -14,11 +14,11 @@
ShowTitleBar="False"
HorizontalContentAlignment="Stretch"
EnableDropShadow="False"
CloseOnOverlay="True">
CloseOnOverlay="True" ClosingFinished="OnClosingFinished">
<simpleChildWindow:ChildWindow.OverlayBrush>
<SolidColorBrush Opacity="0.35" Color="{StaticResource BlackColor}" />
</simpleChildWindow:ChildWindow.OverlayBrush>
<Grid>
<Grid Margin="20, 50">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
......@@ -30,14 +30,13 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="_keyTextBox" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" Margin="0,20,0,0" Text="{Binding Key, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding IsKeyEditable, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Background="{Binding BackgroundColor}"/>
<Rectangle Fill="Crimson" Grid.Row="0" Grid.Column="2" Height="25" Width="15" Margin="5,20,0,0" Visibility="{Binding IsBoltVisible}">
<TextBox x:Name="_keyTextBox" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" Text="{Binding Key, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding IsKeyEditable, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Background="{Binding BackgroundColor}"/>
<Rectangle Fill="Crimson" Grid.Row="0" Grid.Column="2" Height="25" Width="15" Margin="5,0,0,0" Visibility="{Binding IsBoltVisible}">
<Rectangle.OpacityMask>
<VisualBrush Visual="{iconPacks:FontAwesome BoltSolid}"/>
</Rectangle.OpacityMask>
</Rectangle>
<TextBlock Grid.Row="1" Grid.Column="1" Foreground="Crimson" Text="The text key should only contain uppercase letters, numbers and underscores. Some hardcoded vanilla keys do not follow this convention, so the message can be disregarded for those keys." Visibility="{Binding IsBoltVisible}" Margin="0"/>
<TextBlock Grid.Row="1" Grid.Column="1" Foreground="Crimson" Text="The text key should only contain uppercase letters, numbers and underscores. Some hardcoded vanilla keys do not follow this convention, so the message can be disregarded for those keys." Visibility="{Binding IsBoltVisible}" Margin="0" TextWrapping="Wrap"/>
<TextBox x:Name="_valueTextBox" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Stretch" Margin="0,5" Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" SpellCheck.IsEnabled="True" MinLines="5"/>
<CheckBox x:Name="_editKeyCheckBox" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,0,20" Content="Edit Key" IsChecked="{Binding IsKeyEditable, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</simpleChildWindow:ChildWindow>
using eaw_texteditor.shared.data.dialogs.edit;
using eaw_texteditor.Properties;
using eaw_texteditor.shared.data.dialogs.edit;
using MahApps.Metro.SimpleChildWindow;
using ts.translation;
using ts.translation.data.holder.observables;
namespace eaw_texteditor.client.ui.dialogs.edit
......@@ -9,11 +11,22 @@ namespace eaw_texteditor.client.ui.dialogs.edit
/// </summary>
public partial class EditTextKeyWindow : ChildWindow
{
internal EditTextKeyWindowData FormData { get; set; }
public EditTextKeyWindow(ObservableTranslationData translation)
{
InitializeComponent();
DataContext = new EditTextKeyWindowData() {Translation = translation};
FormData = new EditTextKeyWindowData() {Translation = translation};
if (FormData.Key == string.Empty && FormData.Value == string.Empty)
{
FormData.IsKeyEditable = true;
FormData.IsValidKey = false;
}
DataContext = FormData;
}
private void OnClosingFinished(object sender, System.Windows.RoutedEventArgs e)
{
PGTEXTS.SetText(FormData.Key, FormData.Value, Settings.Default.USR_LOADED_LANGUAGE);
}
}
}
<simpleChildWindow:ChildWindow
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:eaw_texteditor.client.ui.dialogs.edit"
xmlns:simpleChildWindow="clr-namespace:MahApps.Metro.SimpleChildWindow;assembly=MahApps.Metro.SimpleChildWindow"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" x:Class="eaw_texteditor.client.ui.dialogs.settings.SettingsWindow"
BorderBrush="{DynamicResource AccentBaseColorBrush}"
BorderThickness="1"
GlowBrush="{DynamicResource AccentColorBrush}"
mc:Ignorable="d"
ShowTitleBar="False"
HorizontalContentAlignment="Stretch"
EnableDropShadow="False"
CloseOnOverlay="True">
<simpleChildWindow:ChildWindow.OverlayBrush>
<SolidColorBrush Opacity="0.35" Color="{StaticResource BlackColor}" />
</simpleChildWindow:ChildWindow.OverlayBrush>
<Grid Margin="0,50,0,50" MaxWidth="400">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="1" Content="Language:"/>
<ComboBox Grid.Row="0" Grid.Column="2" HorizontalAlignment="Stretch" IsReadOnly="True" ItemsSource="{Binding Languages}" SelectedItem="{Binding SelectedLanguage}"/>
</Grid>
</simpleChildWindow:ChildWindow>
using System.Collections.Generic;
using eaw_texteditor.shared.data.dialogs.settings;
using MahApps.Metro.SimpleChildWindow;
using ts.translation;
using ts.translation.common.typedefs;
namespace eaw_texteditor.client.ui.dialogs.settings
{
public partial class SettingsWindow : ChildWindow
{
internal SettingsWindowData FormData { get; set; }
public SettingsWindow()
{
InitializeComponent();
FormData = new SettingsWindowData(PGTEXTS.GetLoadedLanguages() as List<PGLanguage>);
DataContext = FormData;
}
}
}
......@@ -28,15 +28,22 @@
<RowDefinition Height="3*"/>
<RowDefinition Height="1*" MinHeight="150"/>
</Grid.RowDefinitions>
<!--<ScrollViewer Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">-->
<!--<DataGrid x:Name="_basicEditorDataGrid" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0" BindingGroup="{Binding ObservableTranslationData}" AutoGenerateColumns="False" CanUserReorderColumns="False" SelectionUnit="FullRow" MouseDoubleClick="_basicEditorDataGrid_OnDoubleClick" EnableColumnVirtualization="True" >-->
<DataGrid x:Name="_basicEditorDataGrid" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0" ItemsSource="{Binding ListItemCollection}" AutoGenerateColumns="False" CanUserReorderColumns="False" SelectionUnit="FullRow" MouseDoubleClick="_basicEditorDataGrid_OnDoubleClick" EnableColumnVirtualization="True" >
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Key}" CanUserReorder="False" Header="Text Key" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Value}" CanUserReorder="False" Header="Translation" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
<!--</ScrollViewer>-->
<DataGrid x:Name="_basicEditorDataGrid" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0" ItemsSource="{Binding ListItemCollection}" AutoGenerateColumns="False" CanUserReorderColumns="False" SelectionUnit="FullRow" MouseDoubleClick="_basicEditorDataGrid_OnDoubleClick" EnableColumnVirtualization="True" IsReadOnly="True" >
<DataGrid.ContextMenu>
<ContextMenu>
<MenuItem Header="Copy">
</MenuItem>
<Separator />
<MenuItem Header="New" Click="OnMenuNew">
</MenuItem>
<MenuItem Header="Delete"></MenuItem>
</ContextMenu>
</DataGrid.ContextMenu>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Key}" CanUserReorder="False" Header="Text Key" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Value}" CanUserReorder="False" Header="Translation" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
<GroupBox x:Name="_searchFormGroupBox" Grid.Column="0" Grid.Row="1" Header="Search">
<Grid>
<Grid.ColumnDefinitions>
......
using System;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using eaw_texteditor.client.ui.dialogs.add;
using eaw_texteditor.client.ui.dialogs.edit;
using eaw_texteditor.client.ui.dialogs.settings;
using eaw_texteditor.shared.common.util.ui;
using eaw_texteditor.shared.data.main;
using MahApps.Metro.Controls;
......@@ -44,6 +47,9 @@ namespace eaw_texteditor.client.ui.main
private async void _settingsExecuteButton_Click(object sender, RoutedEventArgs e)
{
SettingsWindow childWindow = new SettingsWindow() {IsModal = true};
await this.ShowChildWindowAsync<bool>(childWindow, ChildWindowManager.OverlayFillBehavior.FullWindow);
FormData.SelectedLanguage = childWindow.FormData.SelectedLanguage;
}
private async void _basicEditorDataGrid_OnDoubleClick(object sender, MouseButtonEventArgs e)
......@@ -57,24 +63,28 @@ namespace eaw_texteditor.client.ui.main
DependencyObject source = (DependencyObject)e.OriginalSource;
DataGridRow row = UiUtility.TryFindParent<DataGridRow>(source);
if (row == null) return;
Console.WriteLine("Click Event!");
if (!(row.Item is ObservableTranslationData translationItem))
{
e.Handled = true;
return;
}
Console.WriteLine($"{translationItem.Key} = {translationItem.Value}");
var result = await this.ShowChildWindowAsync<bool>(new EditTextKeyWindow(translationItem) { IsModal = true }, ChildWindowManager.OverlayFillBehavior.FullWindow);
await this.ShowChildWindowAsync<bool>(new EditTextKeyWindow(translationItem) { IsModal = true }, ChildWindowManager.OverlayFillBehavior.FullWindow);
e.Handled = true;
}
private void _importExecuteButton_Click(object sender, RoutedEventArgs e)
{
PGTEXTS.LoadFromFile("I:\\Workspace\\eaw-texteditor\\test\\TranslationManifest.xml");
CollectionViewSource collectionViewSource = new CollectionViewSource {Source = ObservableTranslationUtility.GetTranslationDataAsObservable()};
FormData.ListItemCollection = collectionViewSource.View;
foreach (PGLanguage loadedLanguage in PGTEXTS.GetLoadedLanguages())
{
if (FormData.Sources.ContainsKey(loadedLanguage))
{
FormData.Sources.Remove(loadedLanguage);
}
FormData.Sources.Add(loadedLanguage, new CollectionViewSource() {Source = ObservableTranslationUtility.GetTranslationDataAsObservable(loadedLanguage)});
}
FormData.SelectedLanguage = Properties.Settings.Default.USR_LOADED_LANGUAGE;
}
private void _exportExecuteButton_Click(object sender, RoutedEventArgs e)
......@@ -92,5 +102,17 @@ namespace eaw_texteditor.client.ui.main
{
FormData.SearchTerm = string.Empty;
}
private async void OnMenuNew(object sender, RoutedEventArgs e)
{
AddTextKeyWindow editWindow = new AddTextKeyWindow(new ObservableTranslationData(string.Empty, string.Empty)) {IsModal = true};
if (!await this.ShowChildWindowAsync<bool>(editWindow, ChildWindowManager.OverlayFillBehavior.FullWindow)) return;
PGTEXTS.SetText(editWindow.FormData.Key, editWindow.FormData.Value, FormData.SelectedLanguage);
if (FormData.Sources[FormData.SelectedLanguage].Source is ObservableCollection<ObservableTranslationData> src)
{
src.Add(editWindow.FormData.Translation);
}
}
}
}
......@@ -102,20 +102,35 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="client\ui\dialogs\add\AddTextKeyWindow.xaml.cs">
<DependentUpon>AddTextKeyWindow.xaml</DependentUpon>
</Compile>
<Compile Include="client\ui\dialogs\edit\EditTextKeyWindow.xaml.cs">
<DependentUpon>EditTextKeyWindow.xaml</DependentUpon>
</Compile>
<Compile Include="client\ui\dialogs\settings\SettingsWindow.xaml.cs">
<DependentUpon>SettingsWindow.xaml</DependentUpon>
</Compile>
<Compile Include="ObservableTranslationDataHolder.xaml.cs">
<DependentUpon>ObservableTranslationDataHolder.xaml</DependentUpon>
</Compile>
<Compile Include="shared\common\util\ui\UiUtility.cs" />
<Compile Include="shared\data\dialogs\edit\EditTextKeyWindowData.cs" />
<Compile Include="shared\data\AWindowData.cs" />
<Compile Include="shared\data\dialogs\settings\SettingsWindowData.cs" />
<Compile Include="shared\data\main\MainWindowData.cs" />
<Page Include="client\ui\dialogs\add\AddTextKeyWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="client\ui\dialogs\edit\EditTextKeyWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="client\ui\dialogs\settings\SettingsWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="client\ui\main\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......@@ -151,6 +166,7 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="ClassDiagram1.cd" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
......
......@@ -28,7 +28,7 @@ namespace eaw_texteditor.shared.data.dialogs.edit
set
{
if (_translation == null) return;
_translation.Key = DoValidate(value); ;
_translation.Key = DoValidate(value);
OnPropertyChanged(nameof(Key));
}
}
......@@ -96,6 +96,11 @@ namespace eaw_texteditor.shared.data.dialogs.edit
private string DoValidate(string value)
{
if (string.IsNullOrEmpty(value))
{
IsValidKey = false;
return string.Empty;
}
string newValue = value.TrimEnd();
Regex regEx = new Regex("^[A-Z0-9_]*$");
IsValidKey = regEx.Match(newValue).Success;
......@@ -114,7 +119,6 @@ namespace eaw_texteditor.shared.data.dialogs.edit
}
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
......@@ -122,7 +126,5 @@ namespace eaw_texteditor.shared.data.dialogs.edit
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
using System.Collections.Generic;
using ts.translation.common.typedefs;
namespace eaw_texteditor.shared.data.dialogs.settings
{
class SettingsWindowData : AWindowData
{
private List<PGLanguage> _languages = new List<PGLanguage>();
public List<PGLanguage> Languages
{
get => _languages;
set
{
_languages = value;
OnPropertyChanged(nameof(Languages));
}
}
private PGLanguage _selectedLanguage = Properties.Settings.Default.USR_LOADED_LANGUAGE;
public PGLanguage SelectedLanguage
{
get => _selectedLanguage;
set
{
_selectedLanguage = value;
OnPropertyChanged(nameof(SelectedLanguage));
}
}
public SettingsWindowData(List<PGLanguage> languages)
{
if (languages != null)
{
Languages = languages;
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Data;
using ts.translation.Annotations;
using ts.translation.common.typedefs;
using ts.translation.common.util.observable;
using ts.translation.data.holder.observables;
namespace eaw_texteditor.shared.data.main
......@@ -187,12 +191,37 @@ namespace eaw_texteditor.shared.data.main
}
}
private PGLanguage _selectedLanguage = Properties.Settings.Default.USR_LOADED_LANGUAGE;
public PGLanguage SelectedLanguage
{
get => _selectedLanguage;
set
{
if (!Sources.ContainsKey(value)) return;
_selectedLanguage = value;
ListItemCollection = Sources[value].View;
Properties.Settings.Default.USR_LOADED_LANGUAGE = value;
OnPropertyChanged(nameof(SelectedLanguage));
}
}
public void TryRefresh()
{
string t = SearchTerm;
SearchTerm = t;
}
Dictionary<PGLanguage, CollectionViewSource> _sources = new Dictionary<PGLanguage, CollectionViewSource>();
public Dictionary<PGLanguage, CollectionViewSource> Sources { get => _sources;
set
{
_sources = value;
OnPropertyChanged(nameof(Sources));
}
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment