Skip to content

Commit

Permalink
Add a beta websocket interface for API (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarbonNeuron authored Dec 9, 2020
1 parent c1bf122 commit ce22321
Show file tree
Hide file tree
Showing 7 changed files with 1,344 additions and 139 deletions.
3 changes: 3 additions & 0 deletions AUCapture-WPF/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public interface IAppSettings : INotifyPropertyChanged
[Option(DefaultValue = "")]
string discordToken { get; set; }

[Option(DefaultValue = false)]
bool ApiServer { get; set; }

[Option(DefaultValue = false)]
bool ranBefore { get; set; }

Expand Down
3 changes: 0 additions & 3 deletions AUCapture-WPF/FodyWeavers.xml

This file was deleted.

136 changes: 0 additions & 136 deletions AUCapture-WPF/FodyWeavers.xsd

This file was deleted.

3 changes: 3 additions & 0 deletions AUCapture-WPF/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
<mah:ToggleSwitch x:Name="Darkmode_toggleswitch" Header="Dark mode"
IsOn="{Binding Settings.DarkMode, Mode=TwoWay}"
Toggled="Darkmode_Toggled" />
<mah:ToggleSwitch x:Name="APIserver_toggleswitch" Header="API server"
IsOn="{Binding Settings.ApiServer, Mode=TwoWay}"
Toggled="APIServerToggleSwitch_Toggled" />
<mah:ToggleSwitch x:Name="TokenFocus_ToggleSwitch" Header="Focus window on connect" IsOn="{Binding Settings.FocusOnToken, Mode=TwoWay}"/>
<mah:MetroHeader Header="Font size">
<Slider Name="FontSlider" Maximum="72" Minimum="1"
Expand Down
15 changes: 15 additions & 0 deletions AUCapture-WPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -466,5 +466,20 @@ private void ConsoleTextBox_OnCopying(object sender, DataObjectCopyingEventArgs
{
e.CancelCommand();
}

private void APIServerToggleSwitch_Toggled(object sender, RoutedEventArgs e)
{
if (!(sender is ToggleSwitch toggleSwitch)) return;
if (config.ApiServer)
{
WriteConsoleLineFormatted("APIServer", Color.Brown, "Starting server");
ServerSocket.instance.Start();
}
else
{
WriteConsoleLineFormatted("APIServer", Color.Brown, "Stopping server");
ServerSocket.instance.Stop();
}
}
}
}
Loading

0 comments on commit ce22321

Please sign in to comment.