.vscode | ||
MinLong | ||
ModelingMusic | ||
MODS | ||
Tanchishe | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
App.config | ||
Chouka.cs | ||
Debug.csproj | ||
Debug.dtd | ||
Debug.sln | ||
Debug.xsd | ||
image.png | ||
Program.cs | ||
ProxySettingsHelper.cs | ||
README.md | ||
SearchFile.cs | ||
zidonghua.cs |
ModelingDebug
C#-Net控制台程序
模块继承
如果一个类继承了Activity那么使用GetTypesInheritingFrom把他们全部获取 如果继承了请在里面加入一些可被识别的变量类型
public static Title = "模块选择器";
public const Title = "模块选择器";
string Title 是模块的标题 int Priority 是优先级,数字越小越靠前展示
规范使用
继承了Activity的类的方法并且同时使用了模块选择器的 类 里面要有 Title Priority
选择器
string[] str = ["模块", "模块", "模块", "模块"];
var modeSwitch = new ModeSwitch("请选择你要执行的操作:", str, (a) =>
{
switch (a)
{
case 0:
//需要执行的方法模块
break;
case 1:
break;
default:
printfLine("还没有这个功能");
break;
}
});
模块选择器
正确的说是加载所有Activity的一个选择器
显示到页面中(如图)
选择器的使用
内置选择模式
可自由添加模块
PgUp/W 上选择
PgDn/S 下选择
1···9快捷数字选择
Enter(回车) 确定执行
Esc 选择退出 Enter(回车) 返回选择器
如果选择器被传入了一个类型,则选择器会返回这一个类
public ModeSwitch(object class_, string title, string[] a, Action<int> Enter, string message)
打包和运行
Visual Studio Code
Visual Studio 2022
其他能运行C# Net8.0的程序
方法
- 模块选择器
public ModeSwitch(object class_, string title, string[] a, Action Enter, string message) 可选的是class_,message class_是标记我可以用Esc返回这个类 message是底部的提示信息你可以在这里标注每个功能的使用方法 - Activity
自动获取被他继承子类的Title方法 - TypeHelper
获取所有被这个父类继承的子类 var ActivityType = new TypeHelper<类>();
自定义 获取子类的静态标题和优先级的变量定义 public TypeHelper(string title, string Priority)
GetTitles()获取所有子类的标题
GetTypesInheritingFrom() 获取所有子类 这个默认在创建的时候就执行了
如果你要获取被获取的类的列表可以使用ActivityType.result这个就是列表