Skip to content

Commit c96f9a4

Browse files
committed
Fix scan text tooltip
1 parent 204d10b commit c96f9a4

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

Telegram/Controls/Gallery/GalleryWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@
112112
TabIndex="1" />
113113

114114
<controls:GlyphButton x:Name="Recognize"
115+
x:Load="{x:Bind ViewModel.SelectedItem.CanRecognizeText, Mode=OneWay}"
115116
Click="Recognize_Click"
116117
Loaded="Recognize_Loaded"
117-
Visibility="{x:Bind (Visibility)ViewModel.SelectedItem.CanRecognizeText, Mode=OneWay}"
118118
AutomationProperties.Name="{CustomResource AccDescrScanText}"
119119
ToolTipService.ToolTip="{CustomResource AccDescrScanText}"
120120
Glyph="&#xEAD6;"

Telegram/Controls/Gallery/GalleryWindow.xaml.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,11 +1235,19 @@ private void Recognize_Click(object sender, RoutedEventArgs e)
12351235
container.RecognizeText();
12361236
}
12371237

1238+
private bool _recognizeLoaded;
1239+
12381240
private void Recognize_Loaded(object sender, RoutedEventArgs e)
12391241
{
1240-
if (SettingsService.Current.ToolTip.Required("TextRecognizer"))
1242+
if (_recognizeLoaded)
1243+
{
1244+
return;
1245+
}
1246+
1247+
_recognizeLoaded = true;
1248+
1249+
if (SettingsService.Current.ToolTip.Increment("TextRecognizer"))
12411250
{
1242-
SettingsService.Current.ToolTip.Increment("TextRecognizer");
12431251
ToastPopup.Show(Recognize, Strings.ScanTextFirstTime, Microsoft.UI.Xaml.Controls.TeachingTipPlacementMode.Top, dismissAfter: TimeSpan.FromSeconds(3));
12441252
}
12451253
}

Telegram/Services/Settings/ToolTipSettings.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,21 @@ public bool Required(string key)
2020
return count < 3;
2121
}
2222

23-
public void Increment(string key)
23+
public bool Increment(string key)
2424
{
2525
var count = GetValueOrDefault(key, 0);
2626
if (count < 3)
2727
{
2828
AddOrUpdateValue(key, count + 1);
29+
return true;
2930
}
31+
32+
return false;
33+
}
34+
35+
public void Reset()
36+
{
37+
_container.Values.Clear();
3038
}
3139
}
3240
}

Telegram/Views/DiagnosticsPage.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@
111111
Style="{StaticResource SettingsCheckBoxStyle}" />
112112
</controls:HeaderedControl>
113113

114+
<controls:HeaderedControl>
115+
<controls:SettingsButton Click="{x:Bind services:SettingsService.Current.ToolTip.Reset}"
116+
Content="Reset Tool Tips"
117+
Foreground="{ThemeResource DangerButtonBackground}" />
118+
</controls:HeaderedControl>
119+
114120
<controls:HeaderedControl Header="Crash Mitigation">
115121
<CheckBox IsChecked="{x:Bind ViewModel.LegacyScrollBars, Mode=TwoWay}"
116122
Content="Legacy ScrollBar Style"

0 commit comments

Comments
 (0)