💥 集成everything 开发

This commit is contained in:
BookerLiu
2023-03-27 18:10:39 +08:00
parent 300fcb78da
commit d0547da214
25 changed files with 2070 additions and 30 deletions

34
Util/DelayHelper.cs Normal file
View 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);
}
}
}

View 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; }
}
}

View File

@@ -53,7 +53,7 @@ namespace GeekDesk.Util
}
catch (Exception e)
{
LogUtil.WriteErrorLog(e, "获取启动参数失败! filePath=" + filePath);
//LogUtil.WriteErrorLog(e, "获取启动参数失败! filePath=" + filePath);
return "";
}
}

View File

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