Optimize screensavers

This commit is contained in:
Michael 2017-03-02 08:52:55 -05:00
parent 85068729a6
commit 6fa7a08373
3 changed files with 49 additions and 6 deletions

View file

@ -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();
}
}
}

View file

@ -256,6 +256,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="ScriptingTestFunctions.cs" />
<Compile Include="ShiftOSAudioProvider.cs" />
<Compile Include="ShiftOSConfigFile.cs" />
<Compile Include="Tools\ColorPickerDataBackend.cs" />

View file

@ -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();