Beispiel #1
0
        private DynamicLayout GenAFNPanel()
        {
            var vm = this._vm;

            var layout = new DynamicLayout();

            layout.Bind((t) => t.Enabled, vm, v => v.AFNCrack.IsPanelEnabled);
            //layout.Bind((t) => t.Visible, vm, v => v.AFNCrack.IsPanelEnabled);

            layout.DefaultSpacing = new Size(4, 4);
            layout.DefaultPadding = new Padding(4);

            var wPerArea = new DoubleText();

            wPerArea.Width        = 250;
            wPerArea.ReservedText = ReservedText.Varies;
            wPerArea.SetDefault(_vm.AFNCrack.Default.FlowCoefficient);
            wPerArea.TextBinding.Bind(vm, _ => _.AFNCrack.FlowCoefficient.NumberText);
            layout.AddRow("Flow Coefficient:", wPerArea);


            var radFraction = new DoubleText();

            radFraction.ReservedText = ReservedText.Varies;
            radFraction.SetDefault(_vm.AFNCrack.Default.FlowExponent);
            radFraction.TextBinding.Bind(vm, _ => _.AFNCrack.FlowExponent.NumberText);
            layout.AddRow("Flow Exponent:", radFraction);

            layout.AddRow(null);

            return(layout);
        }
Beispiel #2
0
        private DynamicLayout GenRadSettingsPanel()
        {
            //radiant system
            var radFaceType = new EnumDropDown <HoneybeeSchema.RadiantFaceTypes>();

            radFaceType.Bind(_ => _.SelectedValue, _vm, _ => _.RadiantFaceType);
            //radFaceType.Bind(_ => _.Visible, _vm, _ => _.RadiantVisable);

            var minOptTime = new NumericStepper()
            {
                MinValue = 0, MaxValue = 24, MaximumDecimalPlaces = 1, Increment = 1
            };
            var switchOverTime = new NumericStepper()
            {
                MinValue = 0, MaxValue = 24, MaximumDecimalPlaces = 1, Increment = 1
            };

            minOptTime.Bind(_ => _.Value, _vm, _ => _.MinOptTime);
            //minOptTime.Bind(_ => _.Visible, _vm, _ => _.RadiantVisable);
            switchOverTime.Bind(_ => _.Value, _vm, _ => _.SwitchTime);
            //switchOverTime.Bind(_ => _.Visible, _vm, _ => _.RadiantVisable);

            var radSettings = new DynamicLayout();

            radSettings.DefaultSpacing = new Size(5, 2);
            radSettings.Bind(_ => _.Visible, _vm, _ => _.RadiantVisable);
            radSettings.AddRow("Radiant Face Type:");
            radSettings.AddRow(radFaceType);
            radSettings.AddRow("Minimum Operation Time:");
            radSettings.AddRow(minOptTime);
            radSettings.AddRow("Switch Over Time:");
            radSettings.AddRow(switchOverTime);
            return(radSettings);
        }
Beispiel #3
0
        private DynamicLayout CreateOutdoorLayout()
        {
            var layout = new DynamicLayout();

            layout.DefaultSpacing = new Size(4, 4);

            layout.Bind(_ => _.Enabled, _vm, _ => _.IsOutdoorBoundary);

            var sun_CB = new CheckBox()
            {
                Text = "Sun Exposure"
            };

            sun_CB.CheckedBinding.Bind(_vm, _ => _.BCOutdoor.SunExposure.IsChecked);

            var wind_CB = new CheckBox()
            {
                Text = "Wind Exposure"
            };

            wind_CB.CheckedBinding.Bind(_vm, _ => _.BCOutdoor.WindExposure.IsChecked);

            layout.AddRow(sun_CB);
            layout.AddRow(wind_CB);


            var vFactor = new DoubleText();

            vFactor.ReservedText = ReservedText.Varies;
            vFactor.SetDefault(0);
            vFactor.TextBinding.Bind(_vm, _ => _.BCOutdoor.ViewFactor.NumberText);
            vFactor.Bind(_ => _.Enabled, _vm, _ => _.BCOutdoor.IsViewFactorInputEnabled);
            var autosize = new CheckBox()
            {
                Text = "Autocalculate"
            };

            autosize.Bind(_ => _.Checked, _vm, _ => _.BCOutdoor.IsViewFactorAutocalculate);
            layout.AddRow(autosize);
            layout.AddRow(vFactor);

            layout.AddRow("View Factor:");
            layout.AddRow(autosize);
            layout.AddRow(vFactor);

            return(layout);
        }
Beispiel #4
0
        private DynamicLayout CreateSurfaceLayout()
        {
            var layout = new DynamicLayout();

            layout.DefaultSpacing = new Size(4, 4);

            layout.Bind(_ => _.Enabled, _vm, _ => _.IsSurfaceBoundary);

            var adjBtn = new Button()
            {
                Text = "Adjacent Surface"
            };

            adjBtn.Command = _vm.SurfaceBCCommand;
            layout.AddRow(adjBtn);
            return(layout);
        }
        private GroupBox GenUserDataPanel()
        {
            var vm = this._vm;

            var layout = new DynamicLayout();

            layout.Bind((t) => t.Enabled, vm, v => v.UserData.IsPanelEnabled);

            layout.DefaultSpacing = new Size(4, 4);
            layout.DefaultPadding = new Padding(4);

            var add = new Button()
            {
                Text = "Add"
            };
            var edit = new Button()
            {
                Text = "Edit"
            };
            var remove = new Button()
            {
                Text = "Remove"
            };

            layout.AddSeparateRow(null, add, edit, remove);

            var gd = new GridView();

            gd.Width  = 350;
            gd.Height = 300;
            gd.Bind(_ => _.DataStore, _vm, _ => _.UserData.GridViewDataCollection);
            gd.SelectedItemsChanged += (s, e) =>
            {
                _vm.UserData.SelectedItem = gd.SelectedItem as UserDataItem;
            };

            gd.Columns.Add(new GridColumn
            {
                DataCell = new TextBoxCell {
                    Binding = Binding.Delegate <UserDataItem, string>(r => r.Key)
                },
                HeaderText = "Key",
                Width      = 100
            });
            gd.Columns.Add(new GridColumn
            {
                DataCell = new TextBoxCell {
                    Binding = Binding.Delegate <UserDataItem, string>(r => r.Value)
                },
                HeaderText = "Value",
                Width      = 250
            });

            layout.AddRow(gd);
            layout.AddRow(null);

            add.Bind(_ => _.Command, vm, _ => _.UserData.AddDataCommand);
            edit.Bind(_ => _.Command, vm, _ => _.UserData.EditDataCommand);
            remove.Bind(_ => _.Command, vm, _ => _.UserData.RemoveDataCommand);

            var ltnByProgram = new CheckBox()
            {
                Text = ReservedText.NoUserData
            };

            ltnByProgram.CheckedBinding.Bind(vm, _ => _.UserData.IsCheckboxChecked);

            var gp = new GroupBox()
            {
                Text = "User Data", Height = 400
            };

            gp.Content = new StackLayout(ltnByProgram, layout)
            {
                Spacing = 4, Padding = new Padding(4)
            };

            return(gp);
        }
        private GroupBox GenSHWPanel()
        {
            var vm = this._vm;

            var layout = new DynamicLayout();

            layout.Bind((t) => t.Visible, vm, v => v.ServiceHotWater.IsPanelEnabled);


            layout.DefaultSpacing = new Size(4, 4);
            //layout.DefaultPadding = new Padding(4);

            var wPerArea = new DoubleText();

            wPerArea.Width        = 250;
            wPerArea.ReservedText = ReservedText.Varies;
            wPerArea.SetDefault(_vm.ServiceHotWater.Default.FlowPerArea);
            wPerArea.TextBinding.Bind(vm, _ => _.ServiceHotWater.FlowPerArea.NumberText);
            layout.AddRow("Flow/Area:");
            var unit = new Label();

            unit.TextBinding.Bind(vm, _ => _.ServiceHotWater.FlowPerArea.DisplayUnitAbbreviation);
            layout.AddSeparateRow(wPerArea, unit);

            var sch = new Button();

            sch.TextBinding.Bind(vm, _ => _.ServiceHotWater.Schedule.BtnName);
            sch.Bind(_ => _.Command, vm, _ => _.ServiceHotWater.ScheduleCommand);
            layout.AddRow("Schedule:");
            layout.AddRow(sch);

            var airFraction = new DoubleText()
            {
                Width = 250
            };

            airFraction.ReservedText = ReservedText.Varies;
            airFraction.SetDefault(_vm.ServiceHotWater.Default.TargetTemperature);
            airFraction.TextBinding.Bind(vm, _ => _.ServiceHotWater.TargetTemperature.NumberText);
            layout.AddRow("Target Temperature:");
            var unit2 = new Label();

            unit2.TextBinding.Bind(vm, _ => _.ServiceHotWater.TargetTemperature.DisplayUnitAbbreviation);
            layout.AddSeparateRow(airFraction, unit2);

            var radFraction = new DoubleText();

            radFraction.ReservedText = ReservedText.Varies;
            radFraction.SetDefault(_vm.ServiceHotWater.Default.SensibleFraction);
            radFraction.TextBinding.Bind(vm, _ => _.ServiceHotWater.SensibleFraction.NumberText);
            layout.AddRow("Sensible Fraction:");
            layout.AddRow(radFraction);

            var visFraction = new DoubleText();

            visFraction.ReservedText = ReservedText.Varies;
            visFraction.SetDefault(_vm.ServiceHotWater.Default.LatentFraction);
            visFraction.TextBinding.Bind(vm, _ => _.ServiceHotWater.LatentFraction.NumberText);
            layout.AddRow("Latent Fraction:");
            layout.AddRow(visFraction);


            layout.AddRow(null);


            var ltnByProgram = new CheckBox()
            {
                Text = ReservedText.Noload
            };

            ltnByProgram.CheckedBinding.Bind(vm, _ => _.ServiceHotWater.IsCheckboxChecked);

            var gp = new GroupBox()
            {
                Text = "Service Hot Water"
            };

            gp.Content = new StackLayout(ltnByProgram, layout)
            {
                Spacing = 4, Padding = new Padding(4)
            };

            return(gp);
        }
        private GroupBox GenStpPanel()
        {
            var vm = this._vm;

            var layout = new DynamicLayout();

            layout.Bind((t) => t.Visible, vm, v => v.Setpoint.IsPanelEnabled);


            layout.DefaultSpacing = new Size(4, 4);
            //layout.DefaultPadding = new Padding(4);


            var sch = new Button();

            sch.Width = 250;
            sch.TextBinding.Bind(vm, _ => _.Setpoint.CoolingSchedule.BtnName);
            sch.Bind(_ => _.Command, vm, _ => _.Setpoint.CoolingScheduleCommand);
            layout.AddRow("Cooling Schedule:");
            layout.AddRow(sch);

            var sch2 = new Button();

            sch2.TextBinding.Bind(vm, _ => _.Setpoint.HeatingSchedule.BtnName);
            sch2.Bind(_ => _.Command, vm, _ => _.Setpoint.HeatingScheduleCommand);
            layout.AddRow("Heating Schedule:");
            layout.AddRow(sch2);

            var sch3 = new OptionalButton();

            sch3.TextBinding.Bind(vm, _ => _.Setpoint.HumidifyingSchedule.BtnName);
            sch3.Bind(_ => _.Command, vm, _ => _.Setpoint.HumidifyingScheduleCommand);
            sch3.Bind(_ => _.RemoveCommand, vm, _ => _.Setpoint.RemoveHumidifyingScheduleCommand);
            sch3.Bind(_ => _.IsRemoveVisable, vm, _ => _.Setpoint.HumidifyingSchedule.IsRemoveVisable);
            layout.AddRow("Humidifying Schedule:");
            layout.AddRow(sch3);

            var sch4 = new OptionalButton();

            sch4.TextBinding.Bind(vm, _ => _.Setpoint.DehumidifyingSchedule.BtnName);
            sch4.Bind(_ => _.Command, vm, _ => _.Setpoint.DehumidifyingScheduleCommand);
            sch4.Bind(_ => _.RemoveCommand, vm, _ => _.Setpoint.RemoveDehumidifyingScheduleCommand);
            sch4.Bind(_ => _.IsRemoveVisable, vm, _ => _.Setpoint.DehumidifyingSchedule.IsRemoveVisable);
            layout.AddRow("Dehumidifying Schedule:");
            layout.AddRow(sch4);

            layout.AddRow(null);


            var ltnByProgram = new CheckBox()
            {
                Text = ReservedText.Noload
            };

            ltnByProgram.CheckedBinding.Bind(vm, _ => _.Setpoint.IsCheckboxChecked);

            var gp = new GroupBox()
            {
                Text = "Setpoint"
            };

            gp.Content = new StackLayout(ltnByProgram, layout)
            {
                Spacing = 4, Padding = new Padding(4)
            };

            return(gp);
        }
        private GroupBox GenVentPanel()
        {
            var vm = this._vm;

            var layout = new DynamicLayout();

            layout.Bind((t) => t.Visible, vm, v => v.Ventilation.IsPanelEnabled);


            layout.DefaultSpacing = new Size(4, 4);
            //layout.DefaultPadding = new Padding(4);

            var wPerArea = new DoubleText();

            wPerArea.Width        = 250;
            wPerArea.ReservedText = ReservedText.Varies;
            wPerArea.SetDefault(_vm.Ventilation.Default.FlowPerArea);
            wPerArea.TextBinding.Bind(vm, _ => _.Ventilation.FlowPerArea.NumberText);
            layout.AddRow("Flow/Area:");
            var unit = new Label();

            unit.TextBinding.Bind(vm, _ => _.Ventilation.FlowPerArea.DisplayUnitAbbreviation);
            layout.AddSeparateRow(wPerArea, unit);

            var sch = new OptionalButton();

            sch.TextBinding.Bind(vm, _ => _.Ventilation.Schedule.BtnName);
            sch.Bind(_ => _.Command, vm, _ => _.Ventilation.ScheduleCommand);
            sch.Bind(_ => _.RemoveCommand, vm, _ => _.Ventilation.RemoveScheduleCommand);
            sch.Bind(_ => _.IsRemoveVisable, vm, _ => _.Ventilation.Schedule.IsRemoveVisable);
            layout.AddRow("Schedule:");
            layout.AddRow(sch);

            var radFraction = new DoubleText()
            {
                Width = 250
            };

            radFraction.ReservedText = ReservedText.Varies;
            radFraction.SetDefault(_vm.Ventilation.Default.FlowPerPerson);
            radFraction.TextBinding.Bind(vm, _ => _.Ventilation.FlowPerPerson.NumberText);
            layout.AddRow("Flow/Person:");
            var unit2 = new Label();

            unit2.TextBinding.Bind(vm, _ => _.Ventilation.FlowPerPerson.DisplayUnitAbbreviation);
            layout.AddSeparateRow(radFraction, unit2);

            var visFraction = new DoubleText()
            {
                Width = 250
            };

            visFraction.ReservedText = ReservedText.Varies;
            visFraction.SetDefault(_vm.Ventilation.Default.FlowPerZone);
            visFraction.TextBinding.Bind(vm, _ => _.Ventilation.FlowPerZone.NumberText);
            layout.AddRow("Flow/Zone:");
            var unit3 = new Label();

            unit3.TextBinding.Bind(vm, _ => _.Ventilation.FlowPerZone.DisplayUnitAbbreviation);
            layout.AddSeparateRow(visFraction, unit3);

            var airFraction = new DoubleText()
            {
                Width = 250
            };

            airFraction.ReservedText = ReservedText.Varies;
            airFraction.SetDefault(_vm.Ventilation.Default.AirChangesPerHour);
            airFraction.TextBinding.Bind(vm, _ => _.Ventilation.AirChangesPerHour.NumberText);
            layout.AddRow("AirChanges/Hour:");
            var unit4 = new Label();

            unit4.TextBinding.Bind(vm, _ => _.Ventilation.AirChangesPerHour.DisplayUnitAbbreviation);
            layout.AddSeparateRow(airFraction, unit4);

            layout.AddRow(null);


            var ltnByProgram = new CheckBox()
            {
                Text = ReservedText.Noload
            };

            ltnByProgram.CheckedBinding.Bind(vm, _ => _.Ventilation.IsCheckboxChecked);

            var gp = new GroupBox()
            {
                Text = "Ventilation"
            };

            gp.Content = new StackLayout(ltnByProgram, layout)
            {
                Spacing = 4, Padding = new Padding(4)
            };

            return(gp);
        }
        private GroupBox GenInfPanel()
        {
            var vm = this._vm;

            var layout = new DynamicLayout();

            layout.Bind((t) => t.Visible, vm, v => v.Infiltration.IsPanelEnabled);

            layout.DefaultSpacing = new Size(4, 4);
            //layout.DefaultPadding = new Padding(4);

            var wPerArea = new DoubleText();

            wPerArea.Width        = 250;
            wPerArea.ReservedText = ReservedText.Varies;
            wPerArea.SetDefault(_vm.Infiltration.Default.FlowPerExteriorArea);
            wPerArea.TextBinding.Bind(vm, _ => _.Infiltration.FlowPerExteriorArea.NumberText);
            layout.AddRow("Flow/Area (exterior area):");
            var unit = new Label();

            unit.TextBinding.Bind(vm, _ => _.Infiltration.FlowPerExteriorArea.DisplayUnitAbbreviation);
            layout.AddSeparateRow(wPerArea, unit);

            var sch = new Button();

            sch.TextBinding.Bind(vm, _ => _.Infiltration.Schedule.BtnName);
            sch.Bind(_ => _.Command, vm, _ => _.Infiltration.ScheduleCommand);
            layout.AddRow("Schedule:");
            layout.AddRow(sch);

            var radFraction = new DoubleText();

            radFraction.ReservedText = ReservedText.Varies;
            radFraction.SetDefault(_vm.Infiltration.Default.ConstantCoefficient);
            radFraction.TextBinding.Bind(vm, _ => _.Infiltration.ConstantCoefficient.NumberText);
            layout.AddRow("Constant Coefficient:");
            layout.AddRow(radFraction);

            var visFraction = new DoubleText();

            visFraction.ReservedText = ReservedText.Varies;
            visFraction.SetDefault(_vm.Infiltration.Default.TemperatureCoefficient);
            visFraction.TextBinding.Bind(vm, _ => _.Infiltration.TemperatureCoefficient.NumberText);
            layout.AddRow("Temperature Coefficient:");
            layout.AddRow(visFraction);

            var airFraction = new DoubleText();

            airFraction.ReservedText = ReservedText.Varies;
            airFraction.SetDefault(_vm.Infiltration.Default.VelocityCoefficient);
            airFraction.TextBinding.Bind(vm, _ => _.Infiltration.VelocityCoefficient.NumberText);
            layout.AddRow("Velocity Coefficient:");
            layout.AddRow(airFraction);

            layout.AddRow(null);


            var ltnByProgram = new CheckBox()
            {
                Text = ReservedText.Noload
            };

            ltnByProgram.CheckedBinding.Bind(vm, _ => _.Infiltration.IsCheckboxChecked);

            var gp = new GroupBox()
            {
                Text = "Infiltration"
            };

            gp.Content = new StackLayout(ltnByProgram, layout)
            {
                Spacing = 4, Padding = new Padding(4)
            };

            return(gp);
        }
        private GroupBox GenPplPanel()
        {
            var vm = this._vm;

            var layout = new DynamicLayout();

            layout.Bind((t) => t.Visible, vm, v => v.People.IsPanelEnabled);

            layout.DefaultSpacing = new Size(4, 4);
            //layout.DefaultPadding = new Padding(4);

            var wPerArea = new DoubleText();

            wPerArea.Width        = 250;
            wPerArea.ReservedText = ReservedText.Varies;
            wPerArea.SetDefault(_vm.People.Default.PeoplePerArea);
            wPerArea.TextBinding.Bind(vm, _ => _.People.PeoplePerArea.NumberText);
            layout.AddRow("People/Area:");
            var unit = new Label();

            unit.TextBinding.Bind(vm, _ => _.People.PeoplePerArea.DisplayUnitAbbreviation);
            layout.AddSeparateRow(wPerArea, unit);

            var sch = new Button();

            sch.TextBinding.Bind(vm, _ => _.People.OccupancySchedule.BtnName);
            sch.Bind(_ => _.Command, vm, _ => _.People.ScheduleCommand);
            layout.AddRow("Occupancy Schedule:");
            layout.AddRow(sch);

            var sch2 = new OptionalButton();

            sch2.TextBinding.Bind(vm, _ => _.People.ActivitySchedule.BtnName);
            sch2.Bind(_ => _.Command, vm, _ => _.People.ActivityScheduleCommand);
            sch2.Bind(_ => _.RemoveCommand, vm, _ => _.People.RemoveActivityScheduleCommand);
            sch2.Bind(_ => _.IsRemoveVisable, vm, _ => _.People.ActivitySchedule.IsRemoveVisable);
            layout.AddRow("Activity Schedule:");
            layout.AddRow(sch2);

            var radFraction = new DoubleText();

            radFraction.ReservedText = ReservedText.Varies;
            radFraction.SetDefault(_vm.People.Default.RadiantFraction);
            radFraction.TextBinding.Bind(vm, _ => _.People.RadiantFraction.NumberText);
            layout.AddRow("Radiant Fraction:");
            layout.AddRow(radFraction);

            var visFraction = new DoubleText();

            visFraction.ReservedText = ReservedText.Varies;
            visFraction.SetDefault(_vm.People.Default.LatentFraction);
            visFraction.TextBinding.Bind(vm, _ => _.People.LatentFraction.NumberText);
            visFraction.Bind(_ => _.Enabled, vm, _ => _.People.IsLatenFractionInputEnabled);
            var autosize = new CheckBox()
            {
                Text = "Autocalculate"
            };

            autosize.Bind(_ => _.Checked, vm, _ => _.People.IsLatentFractionAutocalculate);
            layout.AddRow("Latent Fraction:");
            layout.AddRow(autosize);
            layout.AddRow(visFraction);

            layout.AddRow(null);



            var ltnByProgram = new CheckBox()
            {
                Text = ReservedText.Noload
            };

            ltnByProgram.CheckedBinding.Bind(vm, _ => _.People.IsCheckboxChecked);

            var gp = new GroupBox()
            {
                Text = "People"
            };

            gp.Content = new StackLayout(ltnByProgram, layout)
            {
                Spacing = 4, Padding = new Padding(4)
            };

            return(gp);
        }
        private GroupBox GenGasEqpPanel()
        {
            var vm = this._vm;

            var layout = new DynamicLayout();

            layout.Bind((t) => t.Visible, vm, v => v.Gas.IsPanelEnabled);


            layout.DefaultSpacing = new Size(4, 4);
            //layout.DefaultPadding = new Padding(4);

            var wPerArea = new DoubleText();

            wPerArea.Width        = 250;
            wPerArea.ReservedText = ReservedText.Varies;
            wPerArea.SetDefault(_vm.Gas.Default.WattsPerArea);
            wPerArea.TextBinding.Bind(vm, _ => _.Gas.WattsPerArea.NumberText);
            layout.AddRow("Watts/Area:");
            var unit = new Label();

            unit.TextBinding.Bind(vm, _ => _.Gas.WattsPerArea.DisplayUnitAbbreviation);
            layout.AddSeparateRow(wPerArea, unit);

            var sch = new Button();

            sch.TextBinding.Bind(vm, _ => _.Gas.Schedule.BtnName);
            sch.Bind(_ => _.Command, vm, _ => _.Gas.ScheduleCommand);
            layout.AddRow("Schedule:");
            layout.AddRow(sch);

            var radFraction = new DoubleText();

            radFraction.ReservedText = ReservedText.Varies;
            radFraction.SetDefault(_vm.Gas.Default.RadiantFraction);
            radFraction.TextBinding.Bind(vm, _ => _.Gas.RadiantFraction.NumberText);
            layout.AddRow("Radiant Fraction:");
            layout.AddRow(radFraction);

            var visFraction = new DoubleText();

            visFraction.ReservedText = ReservedText.Varies;
            visFraction.SetDefault(_vm.Gas.Default.LatentFraction);
            visFraction.TextBinding.Bind(vm, _ => _.Gas.LatentFraction.NumberText);
            layout.AddRow("Latent Fraction:");
            layout.AddRow(visFraction);

            var airFraction = new DoubleText();

            airFraction.ReservedText = ReservedText.Varies;
            airFraction.SetDefault(_vm.Gas.Default.LostFraction);
            airFraction.TextBinding.Bind(vm, _ => _.Gas.LostFraction.NumberText);
            layout.AddRow("Lost Fraction:");
            layout.AddRow(airFraction);

            layout.AddRow(null);


            var ltnByProgram = new CheckBox()
            {
                Text = ReservedText.Noload
            };

            ltnByProgram.CheckedBinding.Bind(vm, _ => _.Gas.IsCheckboxChecked);

            var gp = new GroupBox()
            {
                Text = "Gas Equipment"
            };

            gp.Content = new StackLayout(ltnByProgram, layout)
            {
                Spacing = 4, Padding = new Padding(4)
            };

            return(gp);
        }
Beispiel #12
0
        private GroupBox GenVentPanel()
        {
            var vm = this._vm;

            var layout = new DynamicLayout();

            layout.Bind((t) => t.Enabled, vm, v => v.VentilationOpening.IsPanelEnabled);
            //layout.Bind((t) => t.Visible, vm, v => v.VentilationOpening.IsPanelEnabled);

            // double fractionAreaOperable = 0.5, double fractionHeightOperable = 1, double dischargeCoefficient = 0.45,
            // bool windCrossVent = false, double flowCoefficientClosed = 0, double flowExponentClosed = 0.65, double twoWayThreshold = 0.0001

            layout.DefaultSpacing = new Size(4, 4);
            layout.DefaultPadding = new Padding(4);

            var wPerArea = new DoubleText();

            wPerArea.Width        = 250;
            wPerArea.ReservedText = ReservedText.Varies;
            wPerArea.SetDefault(_vm.VentilationOpening.Default.FractionAreaOperable);
            wPerArea.TextBinding.Bind(vm, _ => _.VentilationOpening.FractionAreaOperable.NumberText);
            layout.AddRow("Fraction Area Operable:");
            layout.AddRow(wPerArea);

            var radFraction = new DoubleText();

            radFraction.ReservedText = ReservedText.Varies;
            radFraction.SetDefault(_vm.VentilationOpening.Default.FractionHeightOperable);
            radFraction.TextBinding.Bind(vm, _ => _.VentilationOpening.FractionHeightOperable.NumberText);
            layout.AddRow("Fraction Height Operable:");
            layout.AddRow(radFraction);

            var visFraction = new DoubleText();

            visFraction.ReservedText = ReservedText.Varies;
            visFraction.SetDefault(_vm.VentilationOpening.Default.DischargeCoefficient);
            visFraction.TextBinding.Bind(vm, _ => _.VentilationOpening.DischargeCoefficient.NumberText);
            layout.AddRow("Discharge Coefficient:");
            layout.AddRow(visFraction);

            var autosize = new CheckBox()
            {
                Text = "WindCrossVent"
            };

            autosize.CheckedBinding.Bind(_vm, _ => _.VentilationOpening.WindCrossVent.IsChecked);
            layout.AddRow(autosize);

            var airFraction = new DoubleText();

            airFraction.ReservedText = ReservedText.Varies;
            airFraction.SetDefault(_vm.VentilationOpening.Default.FlowCoefficientClosed);
            airFraction.TextBinding.Bind(vm, _ => _.VentilationOpening.FlowCoefficientClosed.NumberText);
            layout.AddRow("Flow Coefficient Closed:");
            layout.AddRow(airFraction);

            var delta = new DoubleText();

            delta.ReservedText = ReservedText.Varies;
            delta.SetDefault(_vm.VentilationOpening.Default.FlowExponentClosed);
            delta.TextBinding.Bind(vm, _ => _.VentilationOpening.FlowExponentClosed.NumberText);
            layout.AddRow("Flow Exponent Closed:");
            layout.AddRow(delta);

            var twoWay = new DoubleText();

            twoWay.ReservedText = ReservedText.Varies;
            twoWay.SetDefault(_vm.VentilationOpening.Default.TwoWayThreshold);
            twoWay.TextBinding.Bind(vm, _ => _.VentilationOpening.TwoWayThreshold.NumberText);
            layout.AddRow("Two Way Threshold:");
            layout.AddRow(twoWay);

            layout.AddRow(null);


            var ltnByProgram = new CheckBox()
            {
                Text = ReservedText.NoControl
            };

            ltnByProgram.CheckedBinding.Bind(vm, _ => _.VentilationOpening.IsCheckboxChecked);

            var gp = new GroupBox()
            {
                Text = "Ventilation Opening", Height = 500
            };

            gp.Content = new StackLayout(ltnByProgram, layout)
            {
                Spacing = 4, Padding = new Padding(4)
            };
            return(gp);
        }
        //private ModelEnergyProperties ModelEnergyProperties { get; set; }
        public Dialog_SHW(HoneybeeSchema.SHWSystem shw = default, bool lockedMode = false, Func <string> roomIDPicker = default)
        {
            var sys = shw ?? new SHWSystem($"SHWSystem_{Guid.NewGuid().ToString().Substring(0, 8)}");
            var vm  = new SHWViewModel(sys, this);

            vm.SetAmbientCoffConditionRoomPicker(roomIDPicker);

            //Padding = new Padding(4);
            Title       = $"Service Hot Water - {DialogHelper.PluginName}";
            WindowStyle = WindowStyle.Default;
            Width       = 450;
            this.Icon   = DialogHelper.HoneybeeIcon;

            var layout = new DynamicLayout();

            layout.DefaultSpacing = new Size(5, 5);
            layout.Padding        = new Padding(10);


            //string identifier,
            //string displayName = null,
            //object userData = null,
            //SHWEquipmentType equipmentType = SHWEquipmentType.Gas_WaterHeater,
            //AnyOf<double, Autocalculate> heaterEfficiency = null,
            //AnyOf< double, string> ambientCondition = null,
            //double ambientLossCoefficient = 6.0

            var nameText = new TextBox();

            var eqpType       = new EnumDropDown <SHWEquipmentType>();
            var heaterEffAuto = new RadioButton()
            {
                Text = "Autocalculate"
            };
            var heaterEffNumber = new RadioButton();
            var heaterEff       = new NumericStepper();

            // ambientCoffCondition
            var ambientLayout = new DynamicLayout();

            ambientLayout.DefaultSpacing = new Size(5, 5);

            var ambientCoffConditionNumber = new RadioButton();
            var ambientCoffConditionRoom   = new RadioButton()
            {
                Text = "Room ID"
            };

            var ambientCoffCondition = new DoubleText()
            {
                Width = 370
            };
            var ambientCoffConditionRoomLayout = new DynamicLayout();
            var ambientCoffConditionRoomID     = new TextBox();
            var ambientCoffConditionRoomID_btn = new Button();

            ambientCoffConditionRoomLayout.AddRow(ambientCoffConditionRoomID);
            ambientCoffConditionRoomLayout.AddRow(ambientCoffConditionRoomID_btn);

            var ambientCoffConditionUnit = new Label();

            ambientCoffConditionUnit.TextBinding.Bind(vm, _ => _.AmbientCoffConditionNumber.DisplayUnitAbbreviation);

            ambientLayout.AddSeparateRow("Ambient Condition:");
            ambientLayout.AddSeparateRow(ambientCoffConditionNumber, ambientCoffCondition, ambientCoffConditionUnit);
            ambientLayout.AddSeparateRow(ambientCoffConditionRoom, ambientCoffConditionRoomLayout);
            ambientLayout.Bind(_ => _.Enabled, vm, _ => _.AmbientCoffConditionEnabled);


            var ambientLossCoefficient = new NumericStepper()
            {
                MaximumDecimalPlaces = 2
            };

            nameText.Bind(_ => _.Text, vm, _ => _.Name);
            eqpType.Bind(_ => _.SelectedValue, vm, _ => _.EquipType);


            heaterEffAuto.Bind(c => c.Checked, vm, _ => _.HeaterEffAuto);
            heaterEffNumber.Bind(c => c.Checked, vm, _ => _.HeaterEffEnabled);
            heaterEff.Bind(c => c.Value, vm, _ => _.HeaterEff);
            heaterEff.Bind(c => c.Enabled, vm, _ => _.HeaterEffEnabled);

            ambientCoffConditionNumber.Bind(c => c.Checked, vm, _ => _.AmbientCoffConditionNumberEnabled);
            ambientCoffConditionRoom.Bind(c => c.Checked, vm, _ => _.AmbientCoffConditionRoomIDEnabled);
            //ambientCoffCondition.Bind(c => c.Value, vm, _ => _.AmbientCoffConditionNumber);
            ambientCoffCondition.Bind(c => c.Enabled, vm, _ => _.AmbientCoffConditionNumberEnabled);
            ambientCoffConditionRoomLayout.Bind(c => c.Enabled, vm, _ => _.AmbientCoffConditionRoomIDEnabled);

            ambientCoffConditionRoomID.Bind(c => c.Text, vm, _ => _.AmbientCoffConditionRoomID);
            ambientCoffConditionRoomID.Bind(_ => _.Visible, vm, _ => _.VisibleAmbientCoffConditionRoomInput);
            ambientCoffConditionRoomID_btn.Bind(_ => _.Text, vm, _ => _.AmbientCoffConditionRoomID);
            ambientCoffConditionRoomID_btn.Bind(_ => _.Visible, vm, _ => _.VisibleAmbientCoffConditionRoomPicker);
            ambientCoffConditionRoomID_btn.Command = vm.AmbientCoffConditionRoomPickerCommand;

            ambientCoffCondition.ReservedText = ReservedText.Varies;
            ambientCoffCondition.SetDefault(22);
            ambientCoffCondition.TextBinding.Bind(vm, _ => _.AmbientCoffConditionNumber.NumberText);


            ambientLossCoefficient.Bind(_ => _.Value, vm, _ => _.AmbientLostCoff);

            layout.AddRow("Name:");
            layout.AddRow(nameText);
            layout.AddRow("Equipment Type:");
            layout.AddRow(eqpType);

            layout.AddRow("Heater Efficiency:");
            layout.AddRow(heaterEffAuto);
            layout.AddSeparateRow(heaterEffNumber, heaterEff);

            layout.AddRow(ambientLayout);

            layout.AddRow("Ambient Loss Coefficient [W/K]");
            layout.AddRow(ambientLossCoefficient);

            var locked = new CheckBox()
            {
                Text = "Locked", Enabled = false
            };

            locked.Checked = lockedMode;

            var OKButton = new Button {
                Text = "OK", Enabled = !lockedMode
            };

            OKButton.Click += (sender, e) => {
                try
                {
                    OkCommand.Execute(vm.GreateSys(shw));
                }
                catch (Exception er)
                {
                    MessageBox.Show(this, er.Message);
                    //throw;
                }
            };

            var abortButton = new Button {
                Text = "Cancel"
            };

            abortButton.Click += (sender, e) => Close();

            var hbData = new Button {
                Text = "Data"
            };

            hbData.Click += (sender, e) => Dialog_Message.Show(this, vm.GreateSys(shw).ToJson(true), "Schema Data");

            layout.AddSeparateRow(locked, null, OKButton, abortButton, null, hbData);
            layout.AddRow(null);
            Content = layout;
        }