diff --git a/ShiftOS.WinForms/ScriptingTestFunctions.cs b/ShiftOS.WinForms/ScriptingTestFunctions.cs new file mode 100644 index 0000000..745f0ca --- /dev/null +++ b/ShiftOS.WinForms/ScriptingTestFunctions.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Engine.Scripting; + +namespace ShiftOS.WinForms +{ + [Exposed("scriptingtests")] + public class ScriptingTestFunctions + { + public int testVar = 127; + + public void testFunction() + { + Console.WriteLine("testFunction() called."); + } + + public string testFunctionWithReturn(string arg) + { + return arg + "!"; + } + + public event Action testEvent; + + public string testProperty { get; set; } + + public void invokeTestEvent() + { + testEvent?.Invoke(); + } + } +} diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 3cc9541..61174dc 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -256,6 +256,7 @@ True Resources.resx + diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 70910d8..42fe2c2 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -171,15 +171,22 @@ namespace ShiftOS.WinForms public void HideScreensaver() { - this.Invoke(new Action(() => + if (ResetDesktop == true) { - this.TopMost = false; - pnlscreensaver.Hide(); - Cursor.Show(); - SetupDesktop(); - })); + this.Invoke(new Action(() => + { + this.TopMost = false; + pnlscreensaver.Hide(); + Cursor.Show(); + SetupDesktop(); + ResetDesktop = false; + + })); + } } + private bool ResetDesktop = false; + private void ShowScreensaver() { if (Shiftorium.UpgradeInstalled("screensavers")) @@ -215,6 +222,7 @@ namespace ShiftOS.WinForms Thread.Sleep(5000); } + ResetDesktop = true; }); t.IsBackground = true; t.Start();