Skip to content

Commit

Permalink
Save the setting for ShowExperimental.
Browse files Browse the repository at this point in the history
Up version to 2.7.3.
  • Loading branch information
chriswendt1 committed Sep 7, 2020
1 parent fefd8d0 commit 61ee1fb
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

<?define ProductVersion="2.7.2" ?>
<?define ProductVersion="2.7.3" ?>
<!--<?define ProductInstallationDirVersion="1.0.0" ?>-->
<?define ProductInstallationDir="Microsoft Document Translator"?>
<?define UpgradeCode="{69CB62B3-53BB-4BF5-9E53-B5677940AB8E}"?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<StackPanel MinWidth="200">
<TextBlock Text="{x:Static p:Resources.DocumentTranslator_name}" Margin="0,0,0,8" TextWrapping="Wrap" Style="{StaticResource Heading1}" />
<TextBlock Text="" Margin="0,0,0,8" TextWrapping="Wrap" Style="{StaticResource Heading2}" />
<TextBlock Text="Version 2.7.2" Margin="0,0,0,8" TextWrapping="Wrap" Style="{StaticResource Heading2}" />
<TextBlock Text="Version 2.7.3" Margin="0,0,0,8" TextWrapping="Wrap" Style="{StaticResource Heading2}" />
<TextBlock Text="Microsoft Corporation" Style="{StaticResource Heading2}" />

<TextBlock Style="{StaticResource Heading2}" >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@
</Button>
</Grid>
<TextBlock Grid.Column="0" Grid.Row="2" Text="{x:Static p:Resources.Translate_FromLanguage}" Width="Auto" />
<ComboBox Grid.Column="1" Grid.Row="2" Width="300" AllowDrop="True" x:Name="cbSourceLanguages" ItemsSource="{Binding SourceLanguageList, UpdateSourceTrigger=PropertyChanged}" SelectedIndex="0" SelectedItem="{Binding SelectedSourceLanguage}" />
<ComboBox Grid.Column="1" Grid.Row="2" Width="300" AllowDrop="True" x:Name="cbSourceLanguages" ItemsSource="{Binding SourceLanguageList, UpdateSourceTrigger=Default}" SelectedIndex="0" SelectedItem="{Binding SelectedSourceLanguage}" />
<TextBlock Grid.Column="0" Grid.Row="4" Text="{x:Static p:Resources.Translate_ToLanguage}" Width="Auto" />
<ComboBox Grid.Column="1" Grid.Row="4" Width="300" AllowDrop="True" x:Name="cbTargetLanguages" ItemsSource="{Binding TargetLanguageList, UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding SelectedTargetLanguage}" />
<ComboBox Grid.Column="1" Grid.Row="4" Width="300" AllowDrop="True" x:Name="cbTargetLanguages" ItemsSource="{Binding TargetLanguageList, UpdateSourceTrigger=Default}" SelectedItem="{Binding SelectedTargetLanguage}" />
</Grid>
<CheckBox ToolTip="{x:Static p:Resources.Translate_HiddenTooltip}" Height="40" Width="582" Content="{x:Static p:Resources.Translate_Hidden}" x:Name="chkHiddenContent" IsChecked="{Binding IgnoreHiddenContent}"/>
<StackPanel Margin="0,0,0,0" Width="582">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
</Grid.RowDefinitions>
<StackPanel Grid.Column="0" Grid.Row="0" Orientation="Horizontal" Width="680" Height="Auto">
<TextBlock Grid.Column="0" Grid.Row="0" Text="{x:Static p:Resources.Translate_FromLanguage}" Width="Auto" Margin="0,0,0,0" VerticalAlignment="Center"/>
<ComboBox Grid.Column="0" Grid.Row="0" AllowDrop="True" x:Name="cbSourceLanguages" ItemsSource="{Binding SourceLanguageList, UpdateSourceTrigger=PropertyChanged}" SelectedIndex="0" SelectedItem="{Binding SelectedSourceLanguage}" Margin="10,0,0,0" VerticalAlignment="Center" SelectionChanged="CbSourceLanguages_SelectionChanged"/>
<ComboBox Grid.Column="0" Grid.Row="0" AllowDrop="True" x:Name="cbSourceLanguages" ItemsSource="{Binding SourceLanguageList,UpdateSourceTrigger=Default}" SelectedIndex="0" SelectedItem="{Binding SelectedSourceLanguage}" Margin="10,0,0,0" VerticalAlignment="Center" SelectionChanged="CbSourceLanguages_SelectionChanged"/>
<TextBlock Grid.Column="0" Grid.Row="0" Text="{x:Static p:Resources.Translate_ToLanguage}" Width="Auto" Margin="15,0,0,0" VerticalAlignment="Center"/>
<ComboBox Grid.Column="0" AllowDrop="True" x:Name="cbTargetLanguages" ItemsSource="{Binding TargetLanguageList, UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding SelectedTargetLanguage}" Margin="10,0,0,0" VerticalAlignment="Center" SelectionChanged="CbTargetLanguages_SelectionChanged"/>
<ComboBox Grid.Column="0" AllowDrop="True" x:Name="cbTargetLanguages" ItemsSource="{Binding TargetLanguageList, UpdateSourceTrigger=Default}" SelectedItem="{Binding SelectedTargetLanguage}" Margin="10,0,0,0" VerticalAlignment="Center" SelectionChanged="CbTargetLanguages_SelectionChanged"/>
<TextBlock Grid.Column="0" Grid.Row="0" Text="{x:Static p:Resources.Translate_Mode}" Width="Auto" Margin="15,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<ComboBox Grid.Column="0" AllowDrop="True" x:Name="cbTranslateMode" ItemsSource="{Binding TranslateModeList, UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding SelectedTranslateMode}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0" SelectionChanged="CbTranslateMode_SelectionChanged" />
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace TranslationAssistant.DocumentTranslationInterface.Pages
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading.Tasks;
Expand All @@ -38,6 +39,16 @@ public ImmediateWindow()
{
this.InitializeComponent();
this.Loaded += ImmediateWindow_Loaded;
this.GotFocus += ImmediateWindow_GotFocus;
}

private void ImmediateWindow_GotFocus(object sender, RoutedEventArgs e)
{
Debug.WriteLine("ImmediateWindow.xaml.cs: Available Languages: {0}", TranslationServices.Core.TranslationServiceFacade.AvailableLanguages.Count);
documentTranslation.PopulateAvailableLanguages();
cbSourceLanguages.GetBindingExpression(ComboBox.ItemsSourceProperty).UpdateTarget();
cbTargetLanguages.GetBindingExpression(ComboBox.ItemsSourceProperty).UpdateTarget();

}

private void ImmediateWindow_Loaded(object sender, RoutedEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,24 +522,25 @@ private void NavigateToTargetFolderClick()
/// <summary>
/// Populate available source and target languages.
/// </summary>
private void PopulateAvailableLanguages()
public void PopulateAvailableLanguages()
{
this.SourceLanguageList.Clear();
this.TargetLanguageList.Clear();
if (!TranslationServiceFacade.UseCustomEndpoint) this.SourceLanguageList.Add(Properties.Resources.Common_AutoDetect);
this.sourceLanguageList.Clear();
this.targetLanguageList.Clear();
if (!TranslationServiceFacade.UseCustomEndpoint) this.sourceLanguageList.Add(Properties.Resources.Common_AutoDetect);
try
{
this.TargetLanguageList.AddRange(TranslationServiceFacade.AvailableLanguages.Values);
this.targetLanguageList.AddRange(TranslationServiceFacade.AvailableLanguages.Values);
}
catch {
this.StatusText = Properties.Resources.Error_LanguageList;
this.NotifyPropertyChanged("StatusText");
return;
};
this.TargetLanguageList.Sort();
this.SourceLanguageList.AddRange(this.TargetLanguageList);
this.targetLanguageList.Sort();
this.sourceLanguageList.AddRange(this.targetLanguageList);
this.NotifyPropertyChanged("SourceLanguageList");
this.NotifyPropertyChanged("TargetLanguageList");
Debug.WriteLine("DocumentTranslation.cs: targetLanguageList.Count: {0}", targetLanguageList.Count);
}

private void PopulateTranslateMode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ public MainWindowViewModel()
{
TranslationServices.Core.TranslationServiceFacade.Initialize();
}
catch
catch (TranslationServices.Core.CredentialsMissingException ex)
{

StatusText = String.Format("{0}\n{1}", Properties.Resources.Error_PleaseSubscribe, ex.Message);
ShowStatus();
return;
}
StatusText = string.Empty;
ShowStatus();
Expand Down
2 changes: 2 additions & 0 deletions TranslationServices.Core/LoadSaveCredentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static void LoadCredentials()
AzureKey = Properties.Settings.Default.AzureKey;
CategoryID = Properties.Settings.Default.CategoryID;
AppId = Properties.Settings.Default.AppId;
ShowExperimental = Properties.Settings.Default.ShowExperimental;
UseAdvancedSettings = Properties.Settings.Default.UseAdvancedSettings;
AzureCloud = Properties.Settings.Default.AzureCloud;
AzureRegion = Properties.Settings.Default.SubscriptionRegion;
Expand All @@ -30,6 +31,7 @@ public static void SaveCredentials()
Properties.Settings.Default.AzureKey = AzureKey;
Properties.Settings.Default.CategoryID = CategoryID;
Properties.Settings.Default.AppId = AppId;
Properties.Settings.Default.ShowExperimental = ShowExperimental;
Properties.Settings.Default.UseAdvancedSettings = UseAdvancedSettings;
Properties.Settings.Default.AzureCloud = AzureCloud;
EndPointAddress = SetEndPointAddress(AzureCloud);
Expand Down
9 changes: 5 additions & 4 deletions TranslationServices.Core/TranslationServiceFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,14 @@ static TranslationServiceFacade()
public static async void Initialize(bool force = false)
{
Task t = GetLanguages(Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName);
if (IsInitialized && !force) return;
if (IsInitialized && (!force) && (AvailableLanguages.Count>2)) return;
LoadCredentials();
if (String.IsNullOrEmpty(AzureKey))
{
if (UseCustomEndpoint == false)
if (!UseCustomEndpoint)
{
Exception CredentialsMissingException = new CredentialsMissingException(Properties.Resources.NotConnectError);
throw CredentialsMissingException;
//throw CredentialsMissingException; //Code stopped working in the debugger with credential ssettings missing. Don't know why.
}
authMode = AuthMode.Disconnected;
}
Expand All @@ -327,8 +327,9 @@ public static async void Initialize(bool force = false)
}
else return;
}
await t.ConfigureAwait(false);
await t.ConfigureAwait(true);
IsInitialized = true;
Debug.WriteLine("Facade: Number of available Languages: {0}", AvailableLanguages.Count);
}


Expand Down

0 comments on commit 61ee1fb

Please sign in to comment.