Skip to content

Commit

Permalink
Added SentClearMessage method and updated usage in `MainWindow.xaml…
Browse files Browse the repository at this point in the history
….cs`

Added a new public static asynchronous method `SentClearMessage` in `OSCSender.cs` that creates and sends an `OscMessage` object. Updated `MasterSwitch_Click` and `SaveDataToDisk` methods in `MainWindow.xaml.cs` to call `SentClearMessage` under specific conditions.
  • Loading branch information
BoiHanny committed Apr 8, 2024
1 parent 66c4fa6 commit df83253
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions vrcosc-magicchatbox/Classes/DataAndSecurity/OSCSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ public static async Task SendOSCMessage(bool FX, int delay = 0)
await SendMessageAsync(PrepareMessage(FX), delay);
}

public static async void SentClearMessage()
{
var clearMessage = new OscMessage(CHATBOX_INPUT, "", true, false);
await SendMessageAsync(clearMessage, 0);
}

public static async Task ToggleVoice(bool force = false)
{
if (!ShouldToggleVoice(force))
Expand Down
4 changes: 4 additions & 0 deletions vrcosc-magicchatbox/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,14 @@ private void MasterSwitch_Click(object sender, RoutedEventArgs e)
{
if (ViewModel.Instance.MasterSwitch == true)
{

backgroundCheck.Start();
}
else
{
backgroundCheck.Stop();
OSCSender.SentClearMessage();

}
}

Expand Down Expand Up @@ -784,6 +787,7 @@ public void SaveDataToDisk(object sender, System.ComponentModel.CancelEventArgs
{
try
{
OSCSender.SentClearMessage();
Hide();
FireExitSave();

Expand Down

0 comments on commit df83253

Please sign in to comment.