コード例 #1
0
ファイル: MainForm.cs プロジェクト: bogdaniolu97/public
        //

        private void MainForm_Load(object sender, EventArgs e)
        {
            env.AddInput("tbWeight", Observable.FromEventPattern(tbWeight, "ValueChanged"));
            env.AddInput("tbHeight", Observable.FromEventPattern(tbHeight, "ValueChanged"));

            // the BMI component must be first - it must react to the initial values from the sliders
            env.AddComponent(new BmiFlow());
            env.AddComponent(new SliderFlow("tbWeight", "weights", "lblWeight:Text", "Weight (kg): {0:##0}", 40));
            env.AddComponent(new SliderFlow("tbHeight", "heights", "lblHeight:Text", "Height (cm): {0:##0}", 150));

            env.AddOutput <string>("lblWeight:Text", text => lblWeight.Text = text);
            env.AddOutput <string>("lblHeight:Text", text => lblHeight.Text = text);
            env.AddOutput <string>("lblBMI:Text", text => lblBMI.Text       = text);

            env.Start();
        }
コード例 #2
0
        private void SetUp()
        {
            env.AddInput("weight", tbWeight.Intercept("ValueChanged"));
            env.AddInput("height", tbHeight.Intercept("ValueChanged"));
            env.AddInput("save", btnSave.Intercept("Click"));
            env.AddInput("restore", btnRestore.Intercept("Click"));

            env.AddFlow(new SliderFlow("weight", "Weight (kg)", 40));
            env.AddFlow(new SliderFlow("height", "Height (cm)", 150));
            env.AddFlow(new BmiFlow());
            env.AddFlow(new SaveRestoreFlow());

            env.AddOutput("weight", new PropertySetter(lblWeight));
            env.AddOutput("height", new PropertySetter(lblHeight));
            env.AddOutput("bmi", new PropertySetter(lblBMI));
            env.AddOutput("save-weight", new PropertySetter(lblSavedWeight));
            env.AddOutput("save-height", new PropertySetter(lblSavedHeight));
            env.AddOutput("set-weight", new PropertySetter(tbWeight));
            env.AddOutput("set-height", new PropertySetter(tbHeight));
            env.AddOutput("enable-restore", new PropertySetter(btnRestore));
        }