XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEWorkflow

【WinUI】XFE基于windows的工作流

公开
关注 0 Fork 0 Star 0
UTF-8
using Microsoft.UI.Xaml.Automation;
using XFEWorkflow.Abstractions;
using XFEWorkflow.Services;

namespace XFEWorkflow.Views;

public sealed partial class MainPage
{
    internal async Task SmokeWeComUpgradeAsync()
    {
        await ready.Task;
        var workflow = ViewModel.SelectedWorkflow ?? throw new InvalidOperationException("旧企微验收工作流未加载");
        ShowProperties(workflow.Graph.Nodes.Single(x => x.CapabilityId == "xfe.wecom.send"));
        await Task.Delay(100);
        var button = PropertyPanel.Children.OfType<Button>().Single(x => AutomationProperties.GetAutomationId(x) == "UpgradeWeComInterface");
        await UiSmokeTest.InvokeButtonAsync(button);
        for (var attempt = 0; attempt < 100 && !ViewModel.Status.StartsWith("已升级", StringComparison.Ordinal); attempt++) await Task.Delay(50);
        var saved = await services.Workflows.GetAsync(workflow.Id);
        if (saved.Enabled != false || saved.PluginVersions["xfe.wecom"] != "3.0.0" || workflow.Enabled != false)
            throw new InvalidOperationException("升级后没有持久化关闭工作流或没有更新版本:" + ViewModel.Status);
    }
}