本文整理汇总了C#中FSM.OnTrigger方法的典型用法代码示例。如果您正苦于以下问题:C# FSM.OnTrigger方法的具体用法?C# FSM.OnTrigger怎么用?C# FSM.OnTrigger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSM
的用法示例。
在下文中一共展示了FSM.OnTrigger方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
static void Init()
{
c = new FSM();
c.OnTrigger("NULL.connect", args =>
{
if (args.Length != 0 && args[0] is Library.SerialNumber)
{
Target = Z.CopySerialNumber((Library.SerialNumber) args[0]);
}
else
{
Target = new Library.SerialNumber();
Target.Part = new byte[8];
}
V.Navigate("Connect");
V.ConnectTrigger("connecting", Target);
Z.Connect();
c.Move("connect");
});
c.OnTrigger("connect.connect", args =>
{
V.ConnectTrigger("connecting", Target);
Z.Connect();
});
c.OnTrigger("connect.connected", args =>
{
if (Target.Part != null && Z.IsNullSerialNumber(Target) == false && Z.IsSerialNumber(Target) == false)
{
V.ConnectTrigger("unexpected_serial", Target);
Library.Disconnect(Z.Handle);
return;
}
V.ConnectTrigger("connected");
T.Trigger("connected");
});
c.OnTrigger("connect.booted", args =>
{
V.ConnectTrigger("booted");
});
c.OnTrigger("connect.not_connected", args =>
{
V.ConnectTrigger("not_connected");
T.Trigger("not_connected");
});
c.OnTrigger("connect.not_still", args =>
{
V.ConnectTrigger("not_still");
T.Trigger("not_still");
});
c.OnTrigger("connect.need_to_update", args =>
{
V.ConnectTrigger("need_to_update");
T.Trigger("need_to_update");
});
c.OnTrigger("connect.drone_not_associated", args =>
{
V.ConnectTrigger("drone_not_associated");
T.Trigger("drone_not_associated");
});
c.OnTrigger("connect.bad_update", args =>
{
V.ConnectTrigger("bad_update");
T.Trigger("bad_update");
});
c.OnTrigger("connect.firmware_upgrade_start", args =>
{
if (Z.IgnoreConnecting == false)
V.ConnectTrigger("firmware_upgrade_start");
T.Trigger("firmware_upgrade_start");
});
c.OnTrigger("connect.firmware_upgrade_in_progress", args =>
{
int percentage = LibZano.Library.GetFirmwareUploadProgress(Z.Handle);
if (Z.IgnoreConnecting == false)
V.ConnectTrigger("firmware_upgrade_in_progress", percentage);
T.Trigger("firmware_upgrade_in_progress", percentage);
});
c.OnTrigger("connect.firmware_upgrade_start_complete", args =>
{
if (Z.IgnoreConnecting == false)
V.ConnectTrigger("firmware_upgrade_start_complete");
T.Trigger("firmware_upgrade_start_complete");
});
c.OnTrigger("connect.firmware_upgrade_start_failed", args =>
{
//.........这里部分代码省略.........