This commit is contained in:
EnderIce2 2021-04-29 23:48:16 +03:00
parent 59fda87954
commit 7d2a7d3dc0
5 changed files with 23 additions and 9 deletions

View File

@ -8,7 +8,10 @@ namespace EnderIce2.SDRSharpPlugin
public static void WriteToFile(string Message)
{
if (!SDRSharp.Radio.Utils.GetBooleanSetting("LogRPC", false))
{
return;
}
string path = AppDomain.CurrentDomain.BaseDirectory + "\\RPCLogs\\";
if (!Directory.Exists(path))
{

View File

@ -20,9 +20,8 @@ namespace EnderIce2.SDRSharpPlugin
bool RPCalreadyLoaded = false;
private ISharpControl _control;
bool playedBefore = false;
private IConfigurationPanelProvider configurationPanelProvider;
private SDRSharp.FrontEnds.SpyServer.ControllerPanel controllerPanel;
public TopWindowMessages windowMessages;
private TopWindowMessages windowMessages;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>")]
private RichPresence presence = new RichPresence()
{
@ -37,7 +36,7 @@ namespace EnderIce2.SDRSharpPlugin
}
};
private static DiscordRpcClient client;
private static bool isRunning = true;
private bool isRunning = true;
public string DisplayName
{
get { return _displayName; }
@ -52,6 +51,8 @@ namespace EnderIce2.SDRSharpPlugin
}
public void Initialize(ISharpControl control)
{
IConfigurationPanelProvider configurationPanelProvider;
if (Utils.GetBooleanSetting("ShowWelcomePage", true))
{
new WelcomeForm().ShowDialog();
@ -63,7 +64,9 @@ namespace EnderIce2.SDRSharpPlugin
try
{
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
{
_control.RegisterFrontControl(windowMessages, PluginPosition.Top);
}
}
catch (Exception ex)
{
@ -139,7 +142,10 @@ namespace EnderIce2.SDRSharpPlugin
_ = MainLoop();
}
else
{
_controlPanel.ChangeStatus = "RPC is disabled";
}
LogWriter.WriteToFile("EOM Initialize");
}
private void Client_OnPresenceUpdate(object sender, PresenceMessage args)
@ -214,7 +220,7 @@ namespace EnderIce2.SDRSharpPlugin
{
try
{
await Task.Delay(2000);
await Task.Delay(2000).ConfigureAwait(false);
isRunning = true;
LogWriter.WriteToFile($"MainLoop called {isRunning} {client.IsInitialized}");
while (client != null && isRunning)

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

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}");
//Utils.GetBooleanSetting("EnableRPC");
// TODO: implement Utils.GetBooleanSetting("EnableRPC");
}
private void Button1_Click(object sender, EventArgs e)
@ -75,9 +75,14 @@ namespace EnderIce2.SDRSharpPlugin
private void TextBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '.'))
{
e.Handled = true;
}
if ((e.KeyChar == '.') && ((sender as TextBox).Text.IndexOf('.') > -1))
{
e.Handled = true;
}
}
private async void TextBox1_KeyDown(object sender, KeyEventArgs e)
@ -87,7 +92,7 @@ namespace EnderIce2.SDRSharpPlugin
Utils.SaveSetting("ClientID", textBox1.Text);
e.Handled = true;
e.SuppressKeyPress = true;
await Task.Delay(200);
await Task.Delay(200).ConfigureAwait(false);
textBox1.Text = Utils.GetStringSetting("ClientID");
label1.Text = "Saved.";
}

View File

@ -37,7 +37,7 @@ namespace EnderIce2.SDRSharpPlugin
{
LogWriter.WriteToFile("waiting...");
Application.DoEvents();
await Task.Delay(200);
await Task.Delay(200).ConfigureAwait(false);
}
bool tmpansw = AnswerA;
LogWriter.WriteToFile($"Client sent an answer. {tmpansw}");