add NET4 constant. Use Task.Delay in Utils.Delay

This commit is contained in:
Bitl 2022-10-31 13:20:56 -07:00
parent 19f64afaee
commit 619708b815
6 changed files with 9 additions and 4 deletions

View File

@ -27,7 +27,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;BASICLAUNCHER;NOVETUS_APPS</DefineConstants>
<DefineConstants>TRACE;BASICLAUNCHER;NOVETUS_APPS;NET4</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

View File

@ -17,7 +17,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;TESTER;NOVETUS_APPS</DefineConstants>
<DefineConstants>TRACE;DEBUG;TESTER;NOVETUS_APPS;NET4</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

View File

@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;PREPARER</DefineConstants>
<DefineConstants>TRACE;DEBUG;PREPARER;NET4</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

View File

@ -558,9 +558,13 @@ public static class Util
//http://stevenhollidge.blogspot.com/2012/06/async-taskdelay.html
public static Task Delay(int milliseconds)
{
#if NET4
var tcs = new TaskCompletionSource<object>();
new System.Threading.Timer(_ => tcs.SetResult(null)).Change(milliseconds, -1);
return tcs.Task;
#elif NET6_0_OR_GREATER
return Task.Delay(milliseconds);
#endif
}
public static void LogPrint(string text, int type = 1)

View File

@ -74,6 +74,7 @@
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
<DefineConstants>TRACE;LAUNCHER;NOVETUS_APPS;NET4</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>

View File

@ -32,7 +32,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;URI;NOVETUS_APPS</DefineConstants>
<DefineConstants>TRACE;URI;NOVETUS_APPS;NET4</DefineConstants>
<ErrorReport>none</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>