@@ -37,18 +37,9 @@ public class MainPlugin : ISharpPlugin
3737 } ;
3838 private DiscordRpcClient client ;
3939 private bool isRunning = true ;
40- public string DisplayName
41- {
42- get { return _displayName ; }
43- }
44- public bool HasGui
45- {
46- get { return true ; }
47- }
48- public UserControl Gui
49- {
50- get { return _controlPanel ; }
51- }
40+ public string DisplayName => _displayName ;
41+ public bool HasGui => true ;
42+ public UserControl Gui => _controlPanel ;
5243 public void Initialize ( ISharpControl control )
5344 {
5445 IConfigurationPanelProvider configurationPanelProvider ;
@@ -72,6 +63,7 @@ public void Initialize(ISharpControl control)
7263 {
7364 MessageBox . Show ( ex . ToString ( ) ) ;
7465 }
66+
7567 if ( Utils . GetBooleanSetting ( "EnableRPCInvite" , false ) )
7668 {
7769 presence . Secrets = new Secrets ( )
@@ -85,6 +77,7 @@ public void Initialize(ISharpControl control)
8577 Max = 100
8678 } ;
8779 }
80+
8881 if ( Utils . GetBooleanSetting ( "EnableRPCInvite" , false ) )
8982 {
9083 windowMessages . Show ( ) ;
@@ -128,8 +121,12 @@ public void Initialize(ISharpControl control)
128121 {
129122 Start = DateTime . UtcNow
130123 } ;
124+
131125 if ( Utils . GetBooleanSetting ( "EnableRPCInvite" , false ) )
126+ {
132127 client . SetSubscription ( EventType . Join | EventType . JoinRequest ) ;
128+ }
129+
133130 client . SetPresence ( presence ) ;
134131 client . Initialize ( ) ;
135132 try
@@ -148,7 +145,6 @@ public void Initialize(ISharpControl control)
148145 {
149146 _controlPanel . ChangeStatus = "RPC is disabled" ;
150147 }
151-
152148 LogWriter . WriteToFile ( "EOM Initialize" ) ;
153149 }
154150 private void Client_OnPresenceUpdate ( object sender , PresenceMessage args )
@@ -243,7 +239,7 @@ async Task MainLoop()
243239 }
244240 }
245241 LogWriter . WriteToFile ( "Waiting 500ms in loop..." ) ;
246- await Task . Delay ( 500 ) ;
242+ await Task . Delay ( 500 ) . ConfigureAwait ( false ) ;
247243 if ( _control . RdsRadioText != null )
248244 {
249245 if ( _control . IsPlaying )
@@ -287,7 +283,7 @@ async Task MainLoop()
287283 LogWriter . WriteToFile ( ex . ToString ( ) ) ;
288284 }
289285 /* presence.Secrets.JoinSecret = */
290- // TODO: _control.RegisterFrontControl(Gui, PluginPosition.Top);
286+ /* _control.RegisterFrontControl(Gui, PluginPosition.Top); */
291287 }
292288 try
293289 {
0 commit comments