创建一个允许用户自动执行任务的UI [英] Create a UI that allows users to automate tasks

查看:55
本文介绍了创建一个允许用户自动执行任务的UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我试着寻找答案但找不到任何相关内容。如果过去已回答过这个问题,请指出正确的方向。



我目前正在开展小型BMS(楼宇管理系统)项目。我有一个Windows窗体应用程序(C#,.NET),它通过USB与主硬件设备通信,后者又读取/更改各种其他硬件设备的状态。 UI显示不同的动画SWF,每个被查询的设备一个,并允许用户查看设备的状态,以及在需要时启动/停止/更改状态。



我所追求的是一种允许用户动态地对设备进行某种编程的方法。换句话说,用户应该能够创建如下逻辑:



Hello all,

I tried searching for an answer but cannot find anything relevant. If this question has been answered in the past, please point me to the right direction.

I am currently working on a small BMS (Building Management System) project. I have a Windows Forms application (C#, .NET) that communicates with a main hardware device via USB, which in turn reads/changes states of diverse other hardware devices. The UI shows different animated SWFs, one for each device that is being interrogated, and allows the users to see the states of the devices, and also to start/stop/change the state where required.

What I am after is a way to allow the user to do some kind of programming of the devices dynamically. In other words, the user should be able to create logic like below:

If (device1.Temperature > threshold)
{
    Stop(Device1);
    Start(Device3);
    Device3.Speed = 10;
}






Or

If (DateTime.Now >= someStartTime && Device2.IsStopped)
{
     Start(Device2);
}





以上只是提供我想要实现的想法的例子。实际上他们需要能够做到这样的事情:





The above are just examples to provide an idea on what I want to achieve. Practically they need to be able to do stuff like:

- Start some device at specific hour/day (for example start the heading system in the morning, stop it in the afternoon)
- Do some actions (start/stop/change state of different devices) if specific thresholds are being reached (for example if the temperature in a specific room is above 25 degrees Celcius, start Fan no 1 and 2 )
- Send alerts if different thresholds are being reached (for example when the smoke detector started)





我不希望这太复杂,但需要100%可靠。任何帮助/想法将不胜感激。



提前致谢,

Mihai



I don't want this to be too complicated, but needs to be 100% reliable. Any help/ideas will be much appreciated.

Thanks in advance,
Mihai

推荐答案

我不希望这太复杂,但需要100%可靠。



这是难以实现的要求。 :)



我认为你对目前的if if else梯形结构有了良好的开端。我所做的大多数表单应用程序中最困难的部分不是功能部分,而是UI,用户看到的内容以及它们如何与之交互。根据我的理解,C#中的梯形图编程并不是最简单的事情,请示例 [ ^ ]。



我首先要创建代表你想要控制的设备的类,类似下面的类,为你想要的逻辑函数提供一个接口容器控制。

"I don't want this to be too complicated, but needs to be 100% reliable."

That's hard request to fulfill. :)

I think you have good start with what you have so far with the if then else ladder structure. The hardest part of most of the forms application I do is not the functional part but the UI, what the user sees and how they interact with it. From what I understand ladder programming in C# is not the easiest thing to do, example[^].

I would start out by creating classes that represent the devices you wish to control with something like the class below that provides an interface container for the logical functions you wish to control.
public class BlowerType
{
    public bool on;
    public DateTime StratTime;
    public DateTime EndTIme;
    public Int16 spped;
    public Int16 Temperature;
}





然后我会为每个设备创建一个实例,并使用可用的接口动态填充表单,用户可以在选择或添加设备并设置其属性。至于如何将这些功能转移到你已经拥有的代码中,我无法告诉你。



祝你好运。



Then I would create an instance for each device and dynamically populate a form with the available interfaces where the user can select or add a device and set it's attributes. As far as how to transfer these functions to the code you already have, I couldn't tell you.

Good luck.


这篇关于创建一个允许用户自动执行任务的UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆