Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion Text-Grab/Controls/PreviousGrabWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,30 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Text_Grab.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpfui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="PreviousGrabWindow"
Width="800"
Height="450"
AllowsTransparency="True"
Background="Transparent"
BorderBrush="{StaticResource Teal}"
BorderThickness="3"
IsHitTestVisible="False"
Topmost="True"
WindowStyle="None"
mc:Ignorable="d">
<Grid />
<Grid>
<Viewbox
x:Name="SuccessViewbox"
MaxWidth="60"
Margin="8"
d:Visibility="Visible"
Visibility="Collapsed">
<wpfui:SymbolIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{StaticResource Teal}"
Symbol="ScanTypeCheckmark24" />
</Viewbox>
</Grid>
</Window>
10 changes: 9 additions & 1 deletion Text-Grab/Controls/PreviousGrabWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Threading;

namespace Text_Grab.Controls;
Expand All @@ -9,7 +10,7 @@ namespace Text_Grab.Controls;
/// </summary>
public partial class PreviousGrabWindow : Window
{
public PreviousGrabWindow(Rect rect)
public PreviousGrabWindow(Rect rect, bool showSuccess = false)
{
InitializeComponent();

Expand All @@ -20,6 +21,13 @@ public PreviousGrabWindow(Rect rect)
Left = rect.Left - borderThickness;
Top = rect.Top - borderThickness;

if (showSuccess)
{
SuccessViewbox.Visibility = Visibility.Visible;
}



DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMilliseconds(500);
timer.Tick += (s, e) => { timer.Stop(); Close(); };
Expand Down
8 changes: 8 additions & 0 deletions Text-Grab/Views/FullscreenGrab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using Text_Grab.Controls;
using Text_Grab.Interfaces;
using Text_Grab.Models;
using Text_Grab.Properties;
Expand Down Expand Up @@ -614,6 +615,13 @@ private async void RegionClickCanvas_MouseUp(object sender, MouseButtonEventArgs
EditTextWindow etw = WindowUtilities.OpenOrActivateWindow<EditTextWindow>();
destinationTextBox = etw.PassedTextControl;
}
Rect selectBorderRect = new(
Canvas.GetLeft(selectBorder),
Canvas.GetTop(selectBorder),
selectBorder.Width,
selectBorder.Height);
PreviousGrabWindow previousGrab = new(selectBorderRect, true);
previousGrab.Show();

OutputUtilities.HandleTextFromOcr(
grabbedText,
Expand Down