Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
rampaa committed Jan 21, 2024
1 parent 7bcf408 commit 7e80ccb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions JL.Core/Network/WebSocketUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public static class WebSocketUtils
{
private static Task? s_webSocketTask = null;
private static CancellationTokenSource? s_webSocketCancellationTokenSource = null;
public static bool Connected => !s_webSocketTask?.IsCompleted ?? false;

public static void HandleWebSocket()
{
Expand Down
20 changes: 12 additions & 8 deletions JL.Windows/GUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -720,15 +720,18 @@ public async Task HandleHotKey(KeyGesture keyGesture, KeyEventArgs? e)
{
handled = true;

CoreConfig.CaptureTextFromWebSocket = true;

if (!StatsUtils.StatsStopWatch.IsRunning)
if (!WebSocketUtils.Connected)
{
StatsUtils.StatsStopWatch.Start();
StatsUtils.StartStatsTimer();
}
CoreConfig.CaptureTextFromWebSocket = true;

WebSocketUtils.HandleWebSocket();
if (!StatsUtils.StatsStopWatch.IsRunning)
{
StatsUtils.StatsStopWatch.Start();
StatsUtils.StartStatsTimer();
}

WebSocketUtils.HandleWebSocket();
}
}

else if (KeyGestureUtils.CompareKeyGestures(keyGesture, ConfigManager.TextBoxIsReadOnlyKeyGesture))
Expand Down Expand Up @@ -1452,7 +1455,8 @@ private void Window_StateChanged(object sender, EventArgs e)
MainTextBox.Foreground = ConfigManager.MainWindowTextColor;
}

if (ConfigManager.StopIncreasingTimeStatWhenMinimized)
if (ConfigManager.StopIncreasingTimeStatWhenMinimized
&& (CoreConfig.CaptureTextFromClipboard || (CoreConfig.CaptureTextFromWebSocket && WebSocketUtils.Connected)))
{
StatsUtils.StatsStopWatch.Start();
}
Expand Down

0 comments on commit 7e80ccb

Please sign in to comment.