Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
Send MessageComplete
Browse files Browse the repository at this point in the history
  • Loading branch information
I5UCC committed Jan 24, 2023
1 parent 13975fb commit f93c78d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public partial class MainWindow : Window
private IniData iniData;

private bool isEnabled;
private bool isFirstMessage;

private readonly string CONFIGPATH = "config.ini";

Expand All @@ -39,7 +40,9 @@ public MainWindow()
catch (Exception) { }

isEnabled = true;

isFirstMessage = true;


HotkeyManager.Current.AddOrReplace("FocusHotkey", Key.A, ModifierKeys.Alt, FocusHotkey); // hotkey window focusing feature.

iniParser = new();
Expand Down Expand Up @@ -91,7 +94,7 @@ private void Textbox_KeyDown(object s, KeyEventArgs e)
{
if (e.Key == Key.Enter && CbxModes.SelectedIndex == 1)
{
SendMessage();
SendMessage(true);
isEnabled = false;
TbxMain.Clear();
isEnabled = true;
Expand All @@ -101,14 +104,20 @@ private void Textbox_KeyDown(object s, KeyEventArgs e)
SendMessage();
ClearMessage();
}

if (TbxMain.Text.Length == 0)
{
isFirstMessage = true;
}
}

private void SendMessage()
private void SendMessage(bool notif = false)
{
Dispatcher.Invoke(() =>
{
oscSender.Send(new OscMessage("/chatbox/typing", false));
oscSender.Send(new OscMessage("/chatbox/input", TbxMain.Text, true));
oscSender.Send(new OscMessage("/chatbox/input", TbxMain.Text, true, notif || isFirstMessage));
isFirstMessage = false;
intervalTimer.Stop();
});
}
Expand Down

0 comments on commit f93c78d

Please sign in to comment.