Skip to content

Commit d8d5569

Browse files
committed
fix(patch): patched version 2.9.4.1
- Trying to fix screen reader announcement on the progress dialog - Fixed an issue with exception report crashing because of background thread being non STA - Improved addin logger to also retrieve additionnal informations for debugging - Improving job cancellation - Minor improvements in WPFEventsHandler Also applied csharpier reformat on "Connect" class
1 parent 6459df7 commit d8d5569

32 files changed

Lines changed: 1961 additions & 847 deletions

Common/DaisyAddinLib/Controls/EnumControl.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,6 @@
181181
<value>EnumControl</value>
182182
</data>
183183
<data name="&gt;&gt;$this.Type" xml:space="preserve">
184-
<value>Daisy.SaveAsDAISY.Forms.Controls.BaseUserControl, DaisyAddinLib, Version=2.9.4.0, Culture=neutral, PublicKeyToken=b32eb409b38936d8</value>
184+
<value>Daisy.SaveAsDAISY.Forms.Controls.BaseUserControl, DaisyAddinLib, Version=2.9.4.1.0, Culture=neutral, PublicKeyToken=b32eb409b38936d8</value>
185185
</data>
186186
</root>

Common/DaisyAddinLib/Controls/StrUserControl.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,6 @@
211211
<value>StrUserControl</value>
212212
</data>
213213
<data name="&gt;&gt;$this.Type" xml:space="preserve">
214-
<value>Daisy.SaveAsDAISY.Forms.Controls.BaseUserControl, DaisyAddinLib, Version=2.9.4.0, Culture=neutral, PublicKeyToken=b32eb409b38936d8</value>
214+
<value>Daisy.SaveAsDAISY.Forms.Controls.BaseUserControl, DaisyAddinLib, Version=2.9.4.1.0, Culture=neutral, PublicKeyToken=b32eb409b38936d8</value>
215215
</data>
216216
</root>

Common/DaisyAddinLib/ConversionParametersForm.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ your document with the Word Accessibility Checker.
909909
<value>DestinationControl</value>
910910
</data>
911911
<data name="&gt;&gt;DestinationControl.Type" xml:space="preserve">
912-
<value>Daisy.SaveAsDAISY.Forms.Controls.PathControl, DaisyAddinLib, Version=2.9.4.0, Culture=neutral, PublicKeyToken=b32eb409b38936d8</value>
912+
<value>Daisy.SaveAsDAISY.Forms.Controls.PathControl, DaisyAddinLib, Version=2.9.4.1.0, Culture=neutral, PublicKeyToken=b32eb409b38936d8</value>
913913
</data>
914914
<data name="&gt;&gt;DestinationControl.Parent" xml:space="preserve">
915915
<value>$this</value>

Common/DaisyAddinLib/GraphicalEventsHandler.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,5 +363,15 @@ public void onConversionWarning(string message)
363363
public void onPostProcessingInfo(string message)
364364
{
365365
}
366+
367+
public void RequestCancellation()
368+
{
369+
throw new NotImplementedException();
370+
}
371+
372+
public bool IsCancellationRequested()
373+
{
374+
throw new NotImplementedException();
375+
}
366376
}
367377
}

Common/DaisyAddinLib/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@
5959
//
6060
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de révision et de build par défaut
6161
// en utilisant '*', comme indiqué ci-dessous :
62-
[assembly: AssemblyVersion("2.9.4.0")]
63-
[assembly: AssemblyFileVersion("2.9.4.0")]
62+
[assembly: AssemblyVersion("2.9.4.1")]
63+
[assembly: AssemblyFileVersion("2.9.4.1")]

Common/DaisyAddinWPFLib/ConversionProgress.xaml

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,58 @@
66
xmlns:local="clr-namespace:Daisy.SaveAsDAISY.WPF"
77
mc:Ignorable="d"
88
Title="Progression"
9-
Width="450"
9+
Width="477"
1010
SizeToContent="Height"
1111
Closing="Window_Closing">
12-
<StackPanel>
13-
<ProgressBar x:Name="ProgressionTracker"
14-
Height="20"
12+
<DockPanel Height="Auto" VerticalAlignment="Stretch">
13+
<StackPanel DockPanel.Dock="Top">
14+
<ProgressBar x:Name="ProgressionTracker"
15+
Height="20"
16+
Margin="5,5,5,0"
17+
Minimum="0"
18+
Maximum="100"
19+
Value="0"
20+
IsIndeterminate="False" />
21+
22+
23+
<TextBox x:Name="CurrentAction"
1524
Margin="5,5,5,0"
16-
Minimum="0"
17-
Maximum="100"
18-
Value="0"
19-
IsIndeterminate="False"/>
20-
<TextBox x:Name="CurrentAction"
21-
Margin="5,5,5,0"
22-
Text=""
23-
AutomationProperties.Name="Progress"
24-
AutomationProperties.HelpText=""
25-
IsReadOnly="True"/>
26-
<Expander Header="Details"
25+
Text=""
26+
AutomationProperties.Name="Progress"
27+
AutomationProperties.HelpText=""
28+
AutomationProperties.LiveSetting="Assertive"
29+
IsReadOnly="True" />
30+
</StackPanel>
31+
32+
<Expander HorizontalAlignment="Stretch"
33+
Header="Details"
2734
ExpandDirection="Down"
2835
IsExpanded="True"
2936
BorderThickness="1"
3037
BorderBrush="Black"
31-
Margin="5,5,5,0">
38+
Margin="5,5,5,0"
39+
Height="Auto"
40+
DockPanel.Dock="Top" >
3241
<StackPanel>
3342
<TextBox TextWrapping="Wrap"
3443
Margin="5"
3544
x:Name="MessageTextArea"
36-
Height="200"
45+
Height="250"
3746
VerticalScrollBarVisibility="Auto"
3847
IsReadOnly="True" />
3948
</StackPanel>
4049
</Expander>
4150
<StackPanel Orientation="Horizontal"
42-
HorizontalAlignment="Right">
51+
HorizontalAlignment="Right"
52+
VerticalAlignment="Bottom"
53+
DockPanel.Dock="Bottom">
4354
<Button Width="61"
4455
Margin="5"
45-
Click="CancelButton_Click">Cancel</Button>
56+
Click="CancelButton_Click"
57+
x:Name="CancelButton">Cancel</Button>
4658
<Button Width="61"
4759
Margin="5"
4860
Click="CloseButton_Click">Close</Button>
4961
</StackPanel>
50-
</StackPanel>
62+
</DockPanel>
5163
</Window>

Common/DaisyAddinWPFLib/ConversionProgress.xaml.cs

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Daisy.SaveAsDAISY.Conversion.Pipeline.Pipeline2;
22
using System;
3+
using System.Text.RegularExpressions;
34
using System.Threading;
45
using System.Windows;
56
using System.Windows.Automation;
@@ -14,7 +15,7 @@ public partial class ConversionProgress : Window
1415
{
1516
public string CurrentProgressMessage { get; set; } = "";
1617

17-
18+
1819

1920
private int StepIncrement = 1;
2021
public ConversionProgress()
@@ -23,7 +24,7 @@ public ConversionProgress()
2324
DataContext = this;
2425
}
2526

26-
27+
private static readonly Regex EndsWithProgress = new Regex(@"(\d+)\s*\/\s*(\d+)\s*$");
2728

2829
// For external thread calls
2930
public delegate void DelegatedAddMessage(string message, bool isProgress = true);
@@ -34,21 +35,40 @@ public void AddMessage(string message, bool isProgress = true)
3435
this.Dispatcher.Invoke(new DelegatedAddMessage(AddMessage), message, isProgress);
3536
return;
3637
}
38+
CurrentAction.Focus();
39+
// unpractical
40+
//if (isProgress) {
41+
// this.Activate();
42+
//}
3743
string[] lines = message.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
3844
foreach (string line in lines) {
3945
if (isProgress) {
4046
CurrentProgressMessage = line;
47+
//CurrentAction.Text = CurrentProgressMessage;
4148
CurrentAction.Text = CurrentProgressMessage;
42-
ProgressionTracker.Value += StepIncrement;
49+
AutomationProperties.SetHelpText(CurrentAction, CurrentProgressMessage);
4350

51+
if (EndsWithProgress.IsMatch(line)) {
52+
Match match = EndsWithProgress.Match(line);
53+
if(match.Groups.Count == 3) {
54+
if(int.TryParse(match.Groups[2].Value, out int maximum)) {
55+
ProgressionTracker.Maximum = maximum;
56+
}
57+
if(int.TryParse(match.Groups[1].Value, out int value)) {
58+
ProgressionTracker.Value = value;
59+
}
60+
}
61+
} else {
62+
ProgressionTracker.Value += StepIncrement;
63+
}
4464
} else {
4565
CurrentAction.Text = CurrentProgressMessage + " - " + line;
66+
AutomationProperties.SetHelpText(CurrentAction, CurrentProgressMessage);
4667
}
4768
MessageTextArea.AppendText(line + "\r\n");
4869
}
49-
CurrentAction.Focus();
50-
AutomationProperties.SetHelpText(CurrentAction, CurrentProgressMessage);
51-
var peer = UIElementAutomationPeer.CreatePeerForElement(CurrentAction);
70+
71+
var peer = UIElementAutomationPeer.FromElement(CurrentAction) as TextElementAutomationPeer;
5272
if (peer != null) {
5373
peer.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged);
5474
}
@@ -71,14 +91,15 @@ public void InitializeProgress(string message = "", int maximum = 1, int step =
7191
this.Dispatcher.Invoke(new DelegatedInitializeProgress(InitializeProgress), message, maximum, step);
7292
return;
7393
}
94+
this.Activate();
95+
CurrentAction.Focus();
7496
CurrentProgressMessage = message;
7597
CurrentAction.Text = CurrentProgressMessage;
76-
98+
//Title = "Progress - " + message;
7799
this.MessageTextArea.AppendText((message.EndsWith("\n") ? message : message + "\r\n"));
78100
ProgressionTracker.Maximum = maximum;
79101
StepIncrement = step;
80102
ProgressionTracker.Value = 0;
81-
CurrentAction.Focus();
82103
AutomationProperties.SetHelpText(CurrentAction, CurrentProgressMessage);
83104
var peer = UIElementAutomationPeer.CreatePeerForElement(CurrentAction);
84105
if (peer != null) {
@@ -120,10 +141,17 @@ public void setCancelClickListener(CancelClickListener cancelAction)
120141
cancelButtonClicked = cancelAction;
121142
}
122143

144+
public void Resume()
145+
{
146+
CancelButton.IsEnabled = true;
147+
}
148+
123149
private void CancelButton_Click(object sender, RoutedEventArgs e)
124150
{
151+
125152
if (cancelButtonClicked != null) cancelButtonClicked();
126-
this.Close();
153+
CancelButton.IsEnabled = false;
154+
//this.Close();
127155
}
128156

129157
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)

Common/DaisyAddinWPFLib/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@
4848
// Numéro de build
4949
// Révision
5050
//
51-
[assembly: AssemblyVersion("2.9.4.0")]
52-
[assembly: AssemblyFileVersion("2.9.4.0")]
51+
[assembly: AssemblyVersion("2.9.4.1")]
52+
[assembly: AssemblyFileVersion("2.9.4.1")]

0 commit comments

Comments
 (0)