💥 集成everything 开发
This commit is contained in:
34
Util/DelayHelper.cs
Normal file
34
Util/DelayHelper.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
public class DelayHelper
|
||||
{
|
||||
public event EventHandler Idled = delegate { };
|
||||
public int WaitingMilliSeconds { get; set; }
|
||||
|
||||
public object Source { get; set; }
|
||||
|
||||
readonly System.Threading.Timer waitingTimer;
|
||||
|
||||
public DelayHelper(int waitingMilliSeconds = 600)
|
||||
{
|
||||
WaitingMilliSeconds = waitingMilliSeconds;
|
||||
waitingTimer = new System.Threading.Timer(p =>
|
||||
{
|
||||
Idled(this, EventArgs.Empty);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void DelayExecute(object source)
|
||||
{
|
||||
this.Source = source;
|
||||
waitingTimer.Change(WaitingMilliSeconds, System.Threading.Timeout.Infinite);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Util/DelayHelperFlyoutMenuItem.cs
Normal file
20
Util/DelayHelperFlyoutMenuItem.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
public class DelayHelperFlyoutMenuItem
|
||||
{
|
||||
public DelayHelperFlyoutMenuItem()
|
||||
{
|
||||
TargetType = typeof(DelayHelperFlyoutMenuItem);
|
||||
}
|
||||
public int Id { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
public Type TargetType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace GeekDesk.Util
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogUtil.WriteErrorLog(e, "获取启动参数失败! filePath=" + filePath);
|
||||
//LogUtil.WriteErrorLog(e, "获取启动参数失败! filePath=" + filePath);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace GeekDesk.Util
|
||||
/// <returns></returns>
|
||||
public static BitmapImage ByteArrToImage(byte[] array)
|
||||
{
|
||||
if (array == null) return null;
|
||||
using (var ms = new System.IO.MemoryStream(array))
|
||||
{
|
||||
BitmapImage image = new BitmapImage();
|
||||
@@ -39,6 +40,7 @@ namespace GeekDesk.Util
|
||||
/// <returns></returns>
|
||||
public static byte[] BitmapImageToByte(BitmapImage bi)
|
||||
{
|
||||
if (bi == null) return null;
|
||||
using (MemoryStream memStream = new MemoryStream())
|
||||
{
|
||||
PngBitmapEncoder encoder = new PngBitmapEncoder();
|
||||
|
||||
Reference in New Issue
Block a user