Created
April 3, 2016 11:24
-
-
Save vczh/fb5a6554d68c1333f4d314f678d0b658 to your computer and use it in GitHub Desktop.
Dynamic Window (workflow)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
================================(1/2)================================ | |
using presentation::controls::Gui*; | |
using presentation::elements::Gui*Element; | |
using presentation::compositions::Gui*Composition; | |
using presentation::compositions::Gui*; | |
using presentation::templates::Gui*; | |
using system::*; | |
using system::reflection::*; | |
using presentation::*; | |
using presentation::Gui*; | |
using presentation::controls::*; | |
using presentation::controls::list::*; | |
using presentation::controls::tree::*; | |
using presentation::elements::*; | |
using presentation::elements::Gui*; | |
using presentation::elements::text*; | |
using presentation::compositions::*; | |
using presentation::templates::*; | |
namespace demo | |
{ | |
class MainWindow<Ctor> | |
{ | |
var ViewModel : ::IViewModel^ = null; | |
var textBoxA : ::presentation::controls::GuiSinglelineTextBox* = null; | |
var textBoxB : ::presentation::controls::GuiSinglelineTextBox* = null; | |
var <precompile>0 : ::demo::MainWindow* = null; | |
var <precompile>1 : ::presentation::compositions::GuiTableComposition* = null; | |
var <precompile>2 : ::presentation::compositions::GuiCellComposition* = null; | |
var <precompile>3 : ::presentation::controls::GuiLabel* = null; | |
var <precompile>4 : ::presentation::compositions::GuiCellComposition* = null; | |
var <precompile>5 : ::presentation::compositions::GuiBoundsComposition* = null; | |
var <precompile>6 : ::presentation::compositions::GuiCellComposition* = null; | |
var <precompile>7 : ::presentation::controls::GuiLabel* = null; | |
var <precompile>8 : ::presentation::compositions::GuiCellComposition* = null; | |
var <precompile>9 : ::presentation::compositions::GuiBoundsComposition* = null; | |
var <precompile>10 : ::presentation::compositions::GuiCellComposition* = null; | |
var <precompile>11 : ::presentation::controls::GuiLabel* = null; | |
var <precompile>12 : ::presentation::compositions::GuiCellComposition* = null; | |
var <precompile>13 : ::presentation::controls::GuiSinglelineTextBox* = null; | |
var <precompile>14 : ::presentation::compositions::GuiBoundsComposition* = null; | |
var <precompile>15 : ::IViewModel^ = null; | |
var <precompile>16 : ::presentation::compositions::GuiBoundsComposition* = null; | |
func <initialize-instance>(<this> : ::demo::MainWindow*, <resolver> : ::presentation::GuiResourcePathResolver*) : (::system::Void) | |
{ | |
(<precompile>0 = <this>); | |
(ViewModel = <this>.ViewModel); | |
(<precompile>16 = <precompile>0.BoundsComposition); | |
{ | |
(<precompile>16.PreferredMinSize = (cast (::presentation::Size) "x:480 y:320")); | |
} | |
{ | |
(<precompile>0.ClientSize = (cast (::presentation::Size) "x:480 y:320")); | |
} | |
(<precompile>15 = <precompile>0.ViewModel); | |
{ | |
(<precompile>0.Text = "MainWindow"); | |
} | |
(<precompile>1 = new (::presentation::compositions::GuiTableComposition*)()); | |
{ | |
(<precompile>1.MinSizeLimitation = (cast (::presentation::compositions::GuiGraphicsComposition::MinSizeLimitation) "LimitToElementAndChildren")); | |
} | |
{ | |
(<precompile>1.AlignmentToParent = (cast (::presentation::Margin) "left:0 top:0 right:0 bottom:0")); | |
} | |
{ | |
(<precompile>1.CellPadding = (cast (::system::Int32) "5")); | |
} | |
{ | |
<precompile>1.SetRowsAndColumns(4, 3); | |
<precompile>1.SetRowOption(0, (cast (::presentation::compositions::GuiCellOption) "composeType:MinSize")); | |
<precompile>1.SetRowOption(1, (cast (::presentation::compositions::GuiCellOption) "composeType:MinSize")); | |
<precompile>1.SetRowOption(2, (cast (::presentation::compositions::GuiCellOption) "composeType:MinSize")); | |
<precompile>1.SetRowOption(3, (cast (::presentation::compositions::GuiCellOption) "composeType:Percentage percentage:1.0")); | |
<precompile>1.SetColumnOption(0, (cast (::presentation::compositions::GuiCellOption) "composeType:MinSize")); | |
<precompile>1.SetColumnOption(1, (cast (::presentation::compositions::GuiCellOption) "composeType:Absolute absolute:200")); | |
<precompile>1.SetColumnOption(2, (cast (::presentation::compositions::GuiCellOption) "composeType:Percentage percentage:1.0")); | |
} | |
(<precompile>2 = new (::presentation::compositions::GuiCellComposition*)()); | |
{ | |
<precompile>2.SetSite(0, 0, 1, 1); | |
} | |
{ | |
var <controlStyle> = ::presentation::theme::ITheme::GetCurrentTheme().CreateLabelStyle(); | |
(<precompile>3 = new (::presentation::controls::GuiLabel*)(<controlStyle>)); | |
} | |
{ | |
(<precompile>3.Text = "A ="); | |
} | |
{ | |
<precompile>2.AddChild(<precompile>3.BoundsComposition); | |
} | |
{ | |
<precompile>1.AddChild(<precompile>2); | |
} | |
(<precompile>4 = new (::presentation::compositions::GuiCellComposition*)()); | |
{ | |
<precompile>4.SetSite(0, 1, 1, 1); | |
} | |
{ | |
var <controlStyle> = ::presentation::theme::ITheme::GetCurrentTheme().CreateTextBoxStyle(); | |
(textBoxA = new (::presentation::controls::GuiSinglelineTextBox*)(<controlStyle>)); | |
} | |
(<precompile>5 = textBoxA.BoundsComposition); | |
{ | |
(<precompile>5.PreferredMinSize = (cast (::presentation::Size) "y:24")); | |
} | |
{ | |
(<precompile>5.AlignmentToParent = (cast (::presentation::Margin) "left:0 top:0 right:0 bottom:0")); | |
} | |
{ | |
(textBoxA.Text = "1"); | |
} | |
{ | |
<precompile>4.AddChild(textBoxA.BoundsComposition); | |
} | |
{ | |
<precompile>1.AddChild(<precompile>4); | |
} | |
(<precompile>6 = new (::presentation::compositions::GuiCellComposition*)()); | |
{ | |
<precompile>6.SetSite(1, 0, 1, 1); | |
} | |
{ | |
var <controlStyle> = ::presentation::theme::ITheme::GetCurrentTheme().CreateLabelStyle(); | |
(<precompile>7 = new (::presentation::controls::GuiLabel*)(<controlStyle>)); | |
} | |
{ | |
(<precompile>7.Text = "B ="); | |
} | |
{ | |
<precompile>6.AddChild(<precompile>7.BoundsComposition); | |
} | |
{ | |
<precompile>1.AddChild(<precompile>6); | |
} | |
(<precompile>8 = new (::presentation::compositions::GuiCellComposition*)()); | |
{ | |
<precompile>8.SetSite(1, 1, 1, 1); | |
} | |
{ | |
var <controlStyle> = ::presentation::theme::ITheme::GetCurrentTheme().CreateTextBoxStyle(); | |
(textBoxB = new (::presentation::controls::GuiSinglelineTextBox*)(<controlStyle>)); | |
} | |
(<precompile>9 = textBoxB.BoundsComposition); | |
{ | |
(<precompile>9.PreferredMinSize = (cast (::presentation::Size) "y:24")); | |
} | |
{ | |
(<precompile>9.AlignmentToParent = (cast (::presentation::Margin) "left:0 top:0 right:0 bottom:0")); | |
} | |
{ | |
(textBoxB.Text = "2"); | |
} | |
{ | |
<precompile>8.AddChild(textBoxB.BoundsComposition); | |
} | |
{ | |
<precompile>1.AddChild(<precompile>8); | |
} | |
(<precompile>10 = new (::presentation::compositions::GuiCellComposition*)()); | |
{ | |
<precompile>10.SetSite(2, 0, 1, 1); | |
} | |
{ | |
var <controlStyle> = ::presentation::theme::ITheme::GetCurrentTheme().CreateLabelStyle(); | |
(<precompile>11 = new (::presentation::controls::GuiLabel*)(<controlStyle>)); | |
} | |
{ | |
(<precompile>11.Text = "A + B ="); | |
} | |
{ | |
<precompile>10.AddChild(<precompile>11.BoundsComposition); | |
} | |
{ | |
<precompile>1.AddChild(<precompile>10); | |
} | |
(<precompile>12 = new (::presentation::compositions::GuiCellComposition*)()); | |
{ | |
<precompile>12.SetSite(2, 1, 1, 1); | |
} | |
{ | |
var <controlStyle> = ::presentation::theme::ITheme::GetCurrentTheme().CreateTextBoxStyle(); | |
(<precompile>13 = new (::presentation::controls::GuiSinglelineTextBox*)(<controlStyle>)); | |
} | |
(<precompile>14 = <precompile>13.BoundsComposition); | |
{ | |
(<precompile>14.PreferredMinSize = (cast (::presentation::Size) "y:24")); | |
} | |
{ | |
(<precompile>14.AlignmentToParent = (cast (::presentation::Margin) "left:0 top:0 right:0 bottom:0")); | |
} | |
{ | |
<precompile>12.AddChild(<precompile>13.BoundsComposition); | |
} | |
{ | |
<precompile>1.AddChild(<precompile>12); | |
} | |
{ | |
<precompile>0.ContainerComposition.AddChild(<precompile>1); | |
} | |
{ | |
var <created-subscription> = <this>.AddSubscription(new (::system::Subscription^) | |
{ | |
var <bind-cache>1 : ::IViewModel^ = null of (::IViewModel^); | |
var <bind-handler>1_0 : ::system::reflection::EventHandler^ = null of (::system::reflection::EventHandler^); | |
var <bind-opened> : ::system::Boolean = (cast (::system::Boolean) "false"); | |
var <bind-closed> : ::system::Boolean = (cast (::system::Boolean) "false"); | |
var <bind-listeners> : func (::system::Object) : (::system::Void)[::system::Listener^] = {}; | |
func <bind-activator>() : (::system::Void) | |
{ | |
var <bind-activator-result> = <bind-cache>1.Z; | |
for (<bind-callback> in <bind-listeners>.Values) | |
{ | |
(cast (func (::system::Object) : (::system::Void)) <bind-callback>)(<bind-activator-result>); | |
} | |
} | |
func <bind-callback>1_0() : (::system::Void) | |
{ | |
<bind-activator>(); | |
} | |
func <bind-initialize>() : (::system::Void) | |
{ | |
(<bind-cache>1 = ViewModel); | |
(<bind-handler>1_0 = attach(<bind-cache>1.ZChanged, <bind-callback>1_0)); | |
} | |
override func Subscribe(<bind-callback> : func (::system::Object) : (::system::Void)) : (::system::Listener^) | |
{ | |
if ((!<bind-opened>)) | |
{ | |
(<bind-opened> = true); | |
<bind-initialize>(); | |
} | |
var <subscription> : ::system::Subscription* = this; | |
var <listener-shared> = new (::system::Listener^) | |
{ | |
override func GetSubscription() : (::system::Subscription*) | |
{ | |
return <subscription>; | |
} | |
override func GetStopped() : (::system::Boolean) | |
{ | |
return (!<bind-listeners>.Keys.Contains(this)); | |
} | |
override func StopListening() : (::system::Boolean) | |
{ | |
if (<bind-listeners>.Keys.Contains(this)) | |
{ | |
<bind-listeners>.Remove(this); | |
return true; | |
} | |
return false; | |
} | |
}; | |
<bind-listeners>.Set(<listener-shared>, <bind-callback>); | |
return <listener-shared>; | |
} | |
override func Update() : (::system::Boolean) | |
{ | |
if ((!<bind-closed>)) | |
{ | |
<bind-activator>(); | |
return true; | |
} | |
return false; | |
} | |
override func Close() : (::system::Boolean) | |
{ | |
if ((!<bind-closed>)) | |
{ | |
(<bind-closed> = true); | |
detach(<bind-handler>1_0); | |
(<bind-cache>1 = null of (::IViewModel^)); | |
(<bind-handler>1_0 = null of (::system::reflection::EventHandler^)); | |
<bind-listeners>.Clear(); | |
return true; | |
} | |
return false; | |
} | |
}); | |
<created-subscription>.Subscribe(func (<value> : ::system::Object) : (::system::Void) | |
{ | |
var <old> = <precompile>13.Text; | |
var <new> = (cast (::system::String) <value>); | |
if ((<old> == <new>)) | |
{ | |
return; | |
} | |
(<precompile>13.Text = <new>); | |
}); | |
<created-subscription>.Update(); | |
} | |
{ | |
var <created-subscription> = <this>.AddSubscription(new (::system::Subscription^) | |
{ | |
var <bind-cache>1 : ::presentation::controls::GuiSinglelineTextBox* = null of (::presentation::controls::GuiSinglelineTextBox*); | |
var <bind-handler>1_0 : ::system::reflection::EventHandler^ = null of (::system::reflection::EventHandler^); | |
var <bind-opened> : ::system::Boolean = (cast (::system::Boolean) "false"); | |
var <bind-closed> : ::system::Boolean = (cast (::system::Boolean) "false"); | |
var <bind-listeners> : func (::system::Object) : (::system::Void)[::system::Listener^] = {}; | |
func <bind-activator>() : (::system::Void) | |
{ | |
var <bind-activator-result> = ((cast (int) <bind-cache>1.Text) ?? 0); | |
for (<bind-callback> in <bind-listeners>.Values) | |
{ | |
(cast (func (::system::Object) : (::system::Void)) <bind-callback>)(<bind-activator-result>); | |
} | |
} | |
func <bind-callback>1_0(<bind-callback-argument>0 : ::presentation::compositions::GuiGraphicsComposition*, <bind-callback-argument>1 : ::presentation::compositions::GuiEventArgs*) : (::system::Void) | |
{ | |
<bind-activator>(); | |
} | |
func <bind-initialize>() : (::system::Void) | |
{ | |
(<bind-cache>1 = textBoxA); | |
(<bind-handler>1_0 = attach(<bind-cache>1.TextChanged, <bind-callback>1_0)); | |
} | |
override func Subscribe(<bind-callback> : func (::system::Object) : (::system::Void)) : (::system::Listener^) | |
{ | |
if ((!<bind-opened>)) | |
{ | |
(<bind-opened> = true); | |
<bind-initialize>(); | |
} | |
var <subscription> : ::system::Subscription* = this; | |
var <listener-shared> = new (::system::Listener^) | |
{ | |
override func GetSubscription() : (::system::Subscription*) | |
{ | |
return <subscription>; | |
} | |
override func GetStopped() : (::system::Boolean) | |
{ | |
return (!<bind-listeners>.Keys.Contains(this)); | |
} | |
override func StopListening() : (::system::Boolean) | |
{ | |
if (<bind-listeners>.Keys.Contains(this)) | |
{ | |
<bind-listeners>.Remove(this); | |
return true; | |
} | |
return false; | |
} | |
}; | |
<bind-listeners>.Set(<listener-shared>, <bind-callback>); | |
return <listener-shared>; | |
} | |
override func Update() : (::system::Boolean) | |
{ | |
if ((!<bind-closed>)) | |
{ | |
<bind-activator>(); | |
return true; | |
} | |
return false; | |
} | |
override func Close() : (::system::Boolean) | |
{ | |
if ((!<bind-closed>)) | |
{ | |
(<bind-closed> = true); | |
detach(<bind-handler>1_0); | |
(<bind-cache>1 = null of (::presentation::controls::GuiSinglelineTextBox*)); | |
(<bind-handler>1_0 = null of (::system::reflection::EventHandler^)); | |
<bind-listeners>.Clear(); | |
return true; | |
} | |
return false; | |
} | |
}); | |
<created-subscription>.Subscribe(func (<value> : ::system::Object) : (::system::Void) | |
{ | |
var <old> = <precompile>15.X; | |
var <new> = (cast (::system::Int32) <value>); | |
if ((<old> == <new>)) | |
{ | |
return; | |
} | |
(<precompile>15.X = <new>); | |
}); | |
<created-subscription>.Update(); | |
} | |
{ | |
var <created-subscription> = <this>.AddSubscription(new (::system::Subscription^) | |
{ | |
var <bind-cache>1 : ::presentation::controls::GuiSinglelineTextBox* = null of (::presentation::controls::GuiSinglelineTextBox*); | |
var <bind-handler>1_0 : ::system::reflection::EventHandler^ = null of (::system::reflection::EventHandler^); | |
var <bind-opened> : ::system::Boolean = (cast (::system::Boolean) "false"); | |
var <bind-closed> : ::system::Boolean = (cast (::system::Boolean) "false"); | |
var <bind-listeners> : func (::system::Object) : (::system::Void)[::system::Listener^] = {}; | |
func <bind-activator>() : (::system::Void) | |
{ | |
var <bind-activator-result> = ((cast (int) <bind-cache>1.Text) ?? 0); | |
for (<bind-callback> in <bind-listeners>.Values) | |
{ | |
(cast (func (::system::Object) : (::system::Void)) <bind-callback>)(<bind-activator-result>); | |
} | |
} | |
func <bind-callback>1_0(<bind-callback-argument>0 : ::presentation::compositions::GuiGraphicsComposition*, <bind-callback-argument>1 : ::presentation::compositions::GuiEventArgs*) : (::system::Void) | |
{ | |
<bind-activator>(); | |
} | |
func <bind-initialize>() : (::system::Void) | |
{ | |
(<bind-cache>1 = textBoxB); | |
(<bind-handler>1_0 = attach(<bind-cache>1.TextChanged, <bind-callback>1_0)); | |
} | |
override func Subscribe(<bind-callback> : func (::system::Object) : (::system::Void)) : (::system::Listener^) | |
{ | |
if ((!<bind-opened>)) | |
{ | |
(<bind-opened> = true); | |
<bind-initialize>(); | |
} | |
var <subscription> : ::system::Subscription* = this; | |
var <listener-shared> = new (::system::Listener^) | |
{ | |
override func GetSubscription() : (::system::Subscription*) | |
{ | |
return <subscription>; | |
} | |
override func GetStopped() : (::system::Boolean) | |
{ | |
return (!<bind-listeners>.Keys.Contains(this)); | |
} | |
override func StopListening() : (::system::Boolean) | |
{ | |
if (<bind-listeners>.Keys.Contains(this)) | |
{ | |
<bind-listeners>.Remove(this); | |
return true; | |
} | |
return false; | |
} | |
}; | |
<bind-listeners>.Set(<listener-shared>, <bind-callback>); | |
return <listener-shared>; | |
} | |
override func Update() : (::system::Boolean) | |
{ | |
if ((!<bind-closed>)) | |
{ | |
<bind-activator>(); | |
return true; | |
} | |
return false; | |
} | |
override func Close() : (::system::Boolean) | |
{ | |
if ((!<bind-closed>)) | |
{ | |
(<bind-closed> = true); | |
detach(<bind-handler>1_0); | |
(<bind-cache>1 = null of (::presentation::controls::GuiSinglelineTextBox*)); | |
(<bind-handler>1_0 = null of (::system::reflection::EventHandler^)); | |
<bind-listeners>.Clear(); | |
return true; | |
} | |
return false; | |
} | |
}); | |
<created-subscription>.Subscribe(func (<value> : ::system::Object) : (::system::Void) | |
{ | |
var <old> = <precompile>15.Y; | |
var <new> = (cast (::system::Int32) <value>); | |
if ((<old> == <new>)) | |
{ | |
return; | |
} | |
(<precompile>15.Y = <new>); | |
}); | |
<created-subscription>.Update(); | |
} | |
} | |
new () | |
{ | |
} | |
} | |
} | |
================================(2/2)================================ | |
using presentation::controls::Gui*; | |
using presentation::elements::Gui*Element; | |
using presentation::compositions::Gui*Composition; | |
using presentation::compositions::Gui*; | |
using presentation::templates::Gui*; | |
using system::*; | |
using system::reflection::*; | |
using presentation::*; | |
using presentation::Gui*; | |
using presentation::controls::*; | |
using presentation::controls::list::*; | |
using presentation::controls::tree::*; | |
using presentation::elements::*; | |
using presentation::elements::Gui*; | |
using presentation::elements::text*; | |
using presentation::compositions::*; | |
using presentation::templates::*; | |
namespace demo | |
{ | |
class MainWindow : ::presentation::controls::GuiWindow | |
{ | |
var <ctor> : ::demo::MainWindow<Ctor>^ = null; | |
var textBoxA : ::presentation::controls::GuiSinglelineTextBox* = null; | |
var textBoxB : ::presentation::controls::GuiSinglelineTextBox* = null; | |
var <parameter>ViewModel : IViewModel^ = null; | |
func GetViewModel() : (IViewModel^) | |
{ | |
return <parameter>ViewModel; | |
} | |
prop ViewModel : IViewModel^{GetViewModel} | |
new* (<ctor-parameter>ViewModel : IViewModel^) | |
:::presentation::controls::GuiWindow(::presentation::theme::ITheme::GetCurrentTheme().CreateWindowStyle()) | |
{ | |
(<parameter>ViewModel = <ctor-parameter>ViewModel); | |
var <resource> = ::presentation::IGuiResourceManager::GetResourceManager().GetResourceFromClassName("demo::MainWindow"); | |
var <resolver> = new (::presentation::GuiResourcePathResolver^)(<resource>, <resource>.WorkingDirectory); | |
(<ctor> = new (::demo::MainWindow<Ctor>^)()); | |
<ctor>.<initialize-instance>(this, (cast (::presentation::GuiResourcePathResolver*) <resolver>)); | |
(textBoxA = <ctor>.textBoxA); | |
(textBoxB = <ctor>.textBoxB); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment