perf.界面部分按钮异步化

This commit is contained in:
MistEO
2021-09-29 14:06:45 +08:00
parent 2e9f5fc14f
commit d60ff2bb77
2 changed files with 31 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
using Stylet;
using StyletIoC;
using System.Threading.Tasks;
namespace MeoAsstGui
{
public class MainFunctionViewModel : Screen
@@ -264,10 +265,14 @@ namespace MeoAsstGui
CreditShoppingCheckBoxIsEnable = true;
}
public void StartSanity()
public async void StartSanity()
{
var asstProxy = _container.Get<AsstProxy>();
bool catched = asstProxy.AsstCatchDefault();
var asstProxy = _container.Get<AsstProxy>();
var task = Task.Run(() =>
{
return asstProxy.AsstCatchDefault();
});
bool catched = await task;
CatchStatus = "捕获模拟器窗口:" + catched;
if (!asstProxy.AsstStartSanity())
{
@@ -284,10 +289,15 @@ namespace MeoAsstGui
}
}
public void Visit()
public async void Visit()
{
var asstProxy = _container.Get<AsstProxy>();
bool catched = asstProxy.AsstCatchDefault();
var asstProxy = _container.Get<AsstProxy>();
var task = Task.Run(() =>
{
return asstProxy.AsstCatchDefault();
});
bool catched = await task;
CatchStatus = "捕获模拟器窗口:" + catched;
if (!asstProxy.AsstStartVisit(CreditShopping))
{

View File

@@ -1,7 +1,9 @@
using Stylet;
using StyletIoC;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace MeoAsstGui
{
public class RecruitViewModel : Screen
@@ -98,12 +100,18 @@ namespace MeoAsstGui
}
}
public void StartCalc()
public async void StartCalc()
{
var asstProxy = _container.Get<AsstProxy>();
if (!asstProxy.AsstCatchDefault())
{
return;
var asstProxy = _container.Get<AsstProxy>();
var task = Task.Run(() =>
{
return asstProxy.AsstCatchDefault();
});
bool catchd = await task;
if (!catchd)
{
RecruitInfo = "捕获模拟器窗口失败";
return;
}
RecruitInfo = "正在识别……";
RecruitResult = "";