Skip to content

Commit

Permalink
叶UI基础演示
Browse files Browse the repository at this point in the history
  • Loading branch information
zsh2401 committed Aug 11, 2020
1 parent a436bc3 commit b60bbcc
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Extensions\EDeviceRebooter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\EDonateCardRegister.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\EEnableCurrentDeviceNetDebugging.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\ELeafUIDemo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\ENetDeviceConnecter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\ENetDeviceDisconnecter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\EPSLauncher.cs" />
Expand All @@ -37,4 +38,10 @@
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Resources\Icons\ps.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="$(MSBuildThisFileDirectory)Resources\Icons\icon.ico" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Resources\Icons\icon.ico" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@
<PropertyGroup />
<Import Project="AutumnBox.Extensions.Essentials.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
<ItemGroup>
<Resource Remove="Resources\Icons\icon.ico" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* ==============================================================================
*
* Filename: ELeafUIDemo
* Description: 
*
* Version: 1.0
* Created: 2020/8/12 4:59:50
* Compiler: Visual Studio 2019
*
* Author: zsh2401
*
* ==============================================================================
*/
using AutumnBox.OpenFramework.Extension;
using AutumnBox.OpenFramework.Extension.Leaf;
using AutumnBox.OpenFramework.Open.LKit;

namespace AutumnBox.Extensions.Essentials.Extensions
{
[ExtDeveloperMode]
[ExtName("Leaf UI Demo", "zh-cn:叶之界面基础演示")]
[ExtIcon("Resources.Icons.icon.ico")]
class ELeafUIDemo : LeafExtensionBase
{
[LMain]
public void Main(ILeafUI _ui)
{
//确保UI资源能够正确释放
using var ui = _ui;

//显示窗口
ui.Show();
//ui.Title = "自定义"; //默认标题为拓展模块名称
ui.StatusInfo = "执行中"; //拓展模块执行状态信息

//单选
var selectResult = ui.SelectOne("秋之盒的开发主要使用了什么语言?", "A: C#", "B: Java", "C: Python");
ui.ShowMessage("你选择了" + selectResult);
ui.Println("你选择了" + selectResult);

switch (selectResult)
{
case "A":
ui.ShowMessage("正确");
break;
case "B":
case "C":
default:
ui.ShowMessage("答错啦!");
break;
}

//询问是否设置进度条
if (ui.DoYN("是否设置进度条?不设置进度条则进度条一直循环"))
{
int? progress = null;
while (true)
{
try
{
//解析ui.InputString输入的数字
progress = int.Parse(ui.InputString("输入1-100的数字", "30"));
if (progress > 0 && progress < 100)
{
break;
}
}
catch { }
}
}

ui.Finish();
//ui.Shutdown(); 不显示结果画面直接关闭窗口
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ namespace AutumnBox.Essentials.Extensions
class ETest : LeafExtensionBase
{
[LMain]
public void EntryPoint(ILeafUI _ui, IDevice device,ISoundService soundService)
public void EntryPoint(ILeafUI ui)
{
soundService.OK();
ui.Show();
ui.StatusInfo = "少女祈祷中...";
ui.ShowMessage("你好!秋之盒");
ui.Println("测试信息");
ui.Finish();
}
}
}
Binary file not shown.

0 comments on commit b60bbcc

Please sign in to comment.