Skip to content

Commit

Permalink
Merge pull request #69 from MicrosoftTranslator/Heartbeat
Browse files Browse the repository at this point in the history
Show a heartbeat while server-side is running.
  • Loading branch information
chriswendt1 authored Oct 26, 2021
2 parents 8d346da + ca2cd40 commit f0dbd38
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions DocumentTranslation.GUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<Button x:Name="ThereWereErrorsButton" Content="{x:Static resx:Resources.button_ShowErrors}" HorizontalAlignment="Right" BorderBrush="Red" BorderThickness="2" Padding="10,2" Visibility="Hidden" Margin="0,0,10,0" Click="ThereWereErrorsButton_Click"/>
<Button x:Name="translateDocumentsButton" Content="{x:Static resx:Resources.button_TranslateDocuments}" Click="DocumentsTranslateButton_Click" Padding="10,2" IsEnabled="False" HorizontalAlignment="Right" />
</StackPanel>
<Label Grid.Row="1" x:Name="Heartbeat" Content="" Visibility="Hidden" HorizontalAlignment="Left" Foreground="Red" />
<StatusBar Grid.Row="2" VerticalAlignment="Bottom">
<StackPanel Orientation="Horizontal">
<Grid>
Expand Down
9 changes: 8 additions & 1 deletion DocumentTranslation.GUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ private void DocumentsTranslateButton_Click(object sender, RoutedEventArgs e)
documentTranslationBusiness.OnFinalResults += DocumentTranslationBusiness_OnFinalResults;
documentTranslationBusiness.OnThereWereErrors += DocumentTranslationBusiness_OnThereWereErrors;
documentTranslationBusiness.OnFileReadError += DocumentTranslationBusiness_OnFileReadError;
documentTranslationBusiness.OnHeartBeat += DocumentTranslationBusiness_OnHeartBeat;
List<string> filestotranslate = new();
foreach (var document in ViewModel.FilesToTranslate) filestotranslate.Add(document);
List<string> glossariestouse = new();
Expand All @@ -340,6 +341,13 @@ private void DocumentsTranslateButton_Click(object sender, RoutedEventArgs e)
ProgressBar.Value = 3;
}

private async void DocumentTranslationBusiness_OnHeartBeat(object sender, EventArgs e)
{
Heartbeat.Visibility = Visibility.Visible;
await Task.Delay(300);
Heartbeat.Visibility = Visibility.Hidden;
}

private void DocumentTranslationBusiness_OnFileReadError(object sender, string e)
{
ProgressBar.Value = 0;
Expand All @@ -349,7 +357,6 @@ private void DocumentTranslationBusiness_OnFileReadError(object sender, string e
CancelButton.Visibility = Visibility.Hidden;
translateDocumentsButton.Visibility = Visibility.Visible;
SetTranslateDocumentsButtonStatus();

}

private void DocumentTranslationBusiness_OnUploadStart(object sender, EventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion DocumentTranslation.Setup/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<?define doctr_TargetDir=$(var.doctr.TargetDir)?>
<?define DocumentTranslationService_TargetDir=$(var.DocumentTranslationService.TargetDir)?>
<?define DocumentTranslation.GUI_TargetDir=$(var.DocumentTranslation.GUI.TargetDir)?>
<Product Id="*" Name="Document Translation" Language="1033" Version="0.8.6.1" Manufacturer="Microsoft" UpgradeCode="cc63954a-c510-49da-af5f-dc82af6502e1">
<Product Id="*" Name="Document Translation" Language="1033" Version="0.8.6.2" Manufacturer="Microsoft" UpgradeCode="cc63954a-c510-49da-af5f-dc82af6502e1">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

<MajorUpgrade DowngradeErrorMessage="A newer version of Document Translation is already installed." />
Expand Down

0 comments on commit f0dbd38

Please sign in to comment.