This commit is contained in:
EnderIce2 2021-04-30 02:27:41 +03:00
parent 4913bb45c4
commit 4753a7849b
3 changed files with 12 additions and 18 deletions

View File

@ -37,18 +37,9 @@ namespace EnderIce2.SDRSharpPlugin
};
private DiscordRpcClient client;
private bool isRunning = true;
public string DisplayName
{
get { return _displayName; }
}
public bool HasGui
{
get { return true; }
}
public UserControl Gui
{
get { return _controlPanel; }
}
public string DisplayName => _displayName;
public bool HasGui => true;
public UserControl Gui => _controlPanel;
public void Initialize(ISharpControl control)
{
IConfigurationPanelProvider configurationPanelProvider;
@ -72,6 +63,7 @@ namespace EnderIce2.SDRSharpPlugin
{
MessageBox.Show(ex.ToString());
}
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
{
presence.Secrets = new Secrets()
@ -85,6 +77,7 @@ namespace EnderIce2.SDRSharpPlugin
Max = 100
};
}
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
{
windowMessages.Show();
@ -128,8 +121,12 @@ namespace EnderIce2.SDRSharpPlugin
{
Start = DateTime.UtcNow
};
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
{
client.SetSubscription(EventType.Join | EventType.JoinRequest);
}
client.SetPresence(presence);
client.Initialize();
try
@ -148,7 +145,6 @@ namespace EnderIce2.SDRSharpPlugin
{
_controlPanel.ChangeStatus = "RPC is disabled";
}
LogWriter.WriteToFile("EOM Initialize");
}
private void Client_OnPresenceUpdate(object sender, PresenceMessage args)
@ -243,7 +239,7 @@ namespace EnderIce2.SDRSharpPlugin
}
}
LogWriter.WriteToFile("Waiting 500ms in loop...");
await Task.Delay(500);
await Task.Delay(500).ConfigureAwait(false);
if (_control.RdsRadioText != null)
{
if (_control.IsPlaying)
@ -287,7 +283,7 @@ namespace EnderIce2.SDRSharpPlugin
LogWriter.WriteToFile(ex.ToString());
}
/* presence.Secrets.JoinSecret = */
// TODO: _control.RegisterFrontControl(Gui, PluginPosition.Top);
/* _control.RegisterFrontControl(Gui, PluginPosition.Top); */
}
try
{

View File

@ -59,7 +59,7 @@ namespace EnderIce2.SDRSharpPlugin
Utils.SaveSetting("EnableRPC", checkBox1.Checked);
label1.Text = "Restart required";
LogWriter.WriteToFile($"checkbox on SettingsPanel clicked {checkBox1.Checked}");
// TODO: implement Utils.GetBooleanSetting("EnableRPC");
/* Utils.GetBooleanSetting("EnableRPC"); */
}
private void Button1_Click(object sender, EventArgs e)

View File

@ -46,9 +46,7 @@ namespace EnderIce2.SDRSharpPlugin
AnswerD = false;
button1.Visible = false;
button2.Visible = false;
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
SetDefaultTextInLabel(tmpansw);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
return tmpansw;
}
private async Task SetDefaultTextInLabel(bool accepted)