mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-02-05 19:40:03 +08:00
Update TODO.md
This commit is contained in:
154
Import/TODO.md
154
Import/TODO.md
@@ -27,6 +27,16 @@
|
||||
* **TabTemplate**.(Header|Dropdown|Menu|MenuItem)Template
|
||||
* GacGen.exe
|
||||
* Add G4, Retire G2 [(reference)](http://www.gaclib.net/#~/Tutorial)
|
||||
* Regenerate G2 tutorials using G4
|
||||
* **HelloWorlds**: CppXml, MVVM
|
||||
* **Layout**: Alignment, Flow, Stack, Table, TableSplitter, RichTextEmbedding
|
||||
* **Controls**: ContainersAndButtons, TextEditor, ColorPicker, AddressBook
|
||||
* **ControlTemplates**: BlackSkin
|
||||
* **Xml**:
|
||||
* Binding_(Bind|Eval|Format|Uri|ViewModel)
|
||||
* Event_(Cpp|Script|ViewModel)
|
||||
* Instance_(Control|WIndow|MultipleWindows)
|
||||
* Member_(Field|Parameter|Property)
|
||||
|
||||
## Wait For A Few Releases
|
||||
* GacUI Resource
|
||||
@@ -50,9 +60,153 @@
|
||||
* InstanceStyle:Replace
|
||||
* Visual State, State Machine, Animation
|
||||
* ev.Event-(eval|async|delayed)
|
||||
* `<ref.Members>`, `<ref.CtorBefore>`, `<ref.CtorAfter>`, `<ref.Dtor>`
|
||||
* Non-standard event handler name: `arg1`, `arg2`, ...
|
||||
* Instead of `<argument>1`, `<argument>2`, ...
|
||||
* GacUI
|
||||
* Make ItemSource from constructor argument to property
|
||||
* Embedded Languages: Colorizer, AutoComplete
|
||||
* Abstract Graphics API
|
||||
* Chart, Ribbon, Dock Container
|
||||
* GacStudio.exe
|
||||
|
||||
## Proposal (Workflow State Machine)
|
||||
|
||||
### Goal
|
||||
To implement
|
||||
* Async operations
|
||||
* Delayed operations
|
||||
* State machine (visual state, animation)
|
||||
|
||||
### State Machine Interface
|
||||
```
|
||||
namespace system
|
||||
{
|
||||
interface IStateMachine
|
||||
{
|
||||
func Start() : void; /* Call to restart, will raise exception during execution */
|
||||
func Stop(ex : string) : void; /* Call to stop, will raise exception if not started. */
|
||||
|
||||
func GetIsExecuting() : bool;
|
||||
event IsExecutingChanged();
|
||||
prop IsExecuting : bool {GetIsExecuting : IsExecutingChanged}
|
||||
|
||||
event OnError(Exception^); /* The current step goes wrong and continue to wait for more inputs */
|
||||
event OnFatal(Exception^); /* The whole state machine goes wrong and has to stop */
|
||||
event OnStart();
|
||||
event OnExit();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Syntax
|
||||
```
|
||||
stateinput <Name>(<Argument>, ...);
|
||||
raise statefatal "exception"; /* stop the state machine with a fatal error */
|
||||
raise stateerror "exception"; /* redo the current stateinput statement with an error, only available in stateinput statement */
|
||||
return; /* stop the state machine normally */
|
||||
|
||||
/* wait until received expected input */
|
||||
stateinput
|
||||
{
|
||||
case <Name>(<Argument-Name>, ...):
|
||||
{
|
||||
<Statements>
|
||||
}
|
||||
default:
|
||||
{
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Sample (Workflow Script)
|
||||
```
|
||||
module test;
|
||||
using system::*;
|
||||
using presentation::controls::Gui*;
|
||||
|
||||
interface ICountDown : IStateMachine
|
||||
{
|
||||
stateinput BeginCountDown();
|
||||
/* Equivalent to */
|
||||
func BeginCountDown() : void;
|
||||
func GetBeginCountDownEnabled() : bool;
|
||||
event BeginCountDownEnabledChanged() : bool;
|
||||
prop BeginCountDownEnabled : bool {GetBeginCountDownEnabled : BeginCountDownEnabledChanged}
|
||||
|
||||
stateinput CountDown();
|
||||
stateinput DoNotCall();
|
||||
|
||||
event OnRemains(int);
|
||||
}
|
||||
```
|
||||
|
||||
### Sample (Xml)
|
||||
```xml
|
||||
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow">
|
||||
<ref.Property Name="Remains" Type="int"/>
|
||||
<ref.Property Name="CountDown" Type="ICountDown^"/>
|
||||
<Window ref.Name="self" Text="State Machine" ClientSize="x:480 y:320">
|
||||
<att.BoundsComposition-set PreferredMinSize="x:480 y:320"/>
|
||||
<att.CountDown-set ev.OnRemains-eval="self.Remains = arg1"/>
|
||||
<!-- ignore layout settings -->
|
||||
<Button Enabled-bind="self.CountDown.BeginCountDownEnabled">
|
||||
<ev.Clicked-eval>{self.CountDown.Start(); self.CountDown.BeginCountDown();}</ev.Clicked-eval>
|
||||
</Button>
|
||||
<Button Enabled-bind="self.CountDown.CountDownEnabled">
|
||||
<ev.Clicked-eval>self.CountDown.CountDown();</ev.Clicked-eval>
|
||||
</Button>
|
||||
<Button Enabled-bind="self.CountDown.IsExecuting">
|
||||
<ev.Clicked-eval>self.CountDown.Stop();</ev.Clicked-eval>
|
||||
</Button>
|
||||
<Label Text-format="Remains: $(self.Remains)"/>
|
||||
</Window>
|
||||
<ref.CtorBefore>
|
||||
<![CDATA[
|
||||
self.CountDown = CreateCountDown();
|
||||
]]>
|
||||
</ref.CtorBefore>
|
||||
<ref.Members>
|
||||
<![CDATA[
|
||||
/* Compiled to: func CreateCountDown() : ICountDown^ */
|
||||
statemachine(ICountDown) CreateCountDown(countDown)
|
||||
{
|
||||
stateinput
|
||||
{
|
||||
case BeginCountDown():{} /* If there are arguments, specify names only */
|
||||
/*
|
||||
Automatically updated before waiting:
|
||||
BeginCountDownEnabled = true;
|
||||
CountDownEnabled = false;
|
||||
DoNotCallEnabled = false;
|
||||
*/
|
||||
}
|
||||
|
||||
var remains = 10;
|
||||
while (true)
|
||||
{
|
||||
countDown.OnRemains(remains);
|
||||
|
||||
if (remains > 0)
|
||||
{
|
||||
stateinput
|
||||
{
|
||||
case CountDown():
|
||||
{
|
||||
remains = remains - 1;
|
||||
}
|
||||
/*
|
||||
Automatically updated before waiting:
|
||||
BeginCountDownEnabled = false;
|
||||
CountDownEnabled = true;
|
||||
DoNotCallEnabled = false;
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</ref.Members>
|
||||
</Instance>
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user