public Dialog_Modifier(T modifier, bool lockedMode = false) { var _hbObj = modifier; Title = $"Modifier - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; Width = 450; this.Icon = DialogHelper.HoneybeeIcon; var locked = new CheckBox() { Text = "Locked", Enabled = false }; locked.Checked = lockedMode; var OkButton = new Button { Text = "OK", Enabled = !lockedMode }; OkButton.Click += (sender, e) => OkCommand.Execute(_hbObj); AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); var layout = new DynamicLayout(); layout.DefaultSpacing = new Size(5, 5); layout.DefaultPadding = new Padding(5); var paramPanel = GenParmPanel(_hbObj); layout.AddRow(paramPanel); var docLink = new LinkButton(); docLink.Text = "View help documents..."; docLink.ToolTip = @"https://www.ladybug.tools/honeybee-schema/model.html"; docLink.Click += (s, e) => { var url = $"https://www.ladybug.tools/honeybee-schema/model.html#tag/{typeof(T).Name.ToLower()}_model"; System.Diagnostics.Process.Start(url); }; var buttonSource = new Button { Text = "Schema Data" }; buttonSource.Click += (s, e) => { Dialog_Message.Show(this, _hbObj.ToJson(true)); }; layout.AddRow(docLink); layout.AddSeparateRow(locked, null, OkButton, AbortButton, null, buttonSource); layout.AddRow(null); Content = layout; }
public Dialog_Construction(HB.ModelEnergyProperties libSource, HB.Energy.IConstruction construction, bool lockedMode = false) { try { this.ModelEnergyProperties = libSource; _hbObj = construction; Padding = new Padding(5); Resizable = true; Title = $"Construction - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; MinimumSize = new Size(650, 500); this.Icon = DialogHelper.HoneybeeIcon; var OkButton = new Button { Text = "OK", Enabled = !lockedMode }; OkButton.Click += (sender, e) => { // add new material to library source foreach (var layer in _layers) { var m = OpaqueMaterials.FirstOrDefault(_ => _.Identifier == layer); m = m ?? WindowMaterials.FirstOrDefault(_ => _.Identifier == layer); var dup = m.Duplicate() as HB.Energy.IMaterial; dup.DisplayName = m.DisplayName ?? m.Identifier; libSource.AddMaterial(dup); } OkCommand.Execute(_hbObj); }; AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); //var panel = new Panel_Schedule(sch); //panel.AddSeparateRow(null, OkButton, AbortButton, null); //Content = panel; var leftLayout = new DynamicLayout(); leftLayout.DefaultSpacing = new Size(5, 5); leftLayout.DefaultPadding = new Padding(5); leftLayout.Height = 600; leftLayout.AddRow("Name"); var name = new TextBox(); _hbObj.DisplayName = _hbObj.DisplayName ?? _hbObj.Identifier; name.TextBinding.Bind(() => _hbObj.DisplayName, v => _hbObj.DisplayName = v); leftLayout.AddRow(name); var groupContent = new DynamicLayout(); groupContent.DefaultSpacing = new Size(5, 5); Action <int, string> actionWhenItemChanged = (int layerIndex, string newValue) => { _layers.RemoveAt(layerIndex); _layers.Insert(layerIndex, newValue); CalRValue(_hbObj, _showIP); }; _layersPanel = new DynamicLayout(); _layersPanel.DefaultSpacing = new Size(5, 5); GenMaterialLayersPanel(_layersPanel, actionWhenItemChanged); var fromLibDropin = GenAddMoreDropInArea( (newValue) => { var newIndex = _layers.Count; _layers.Add(newValue); GenMaterialLayersPanel(_layersPanel, actionWhenItemChanged); _layersPanel.Create(); CalRValue(_hbObj, _showIP); } ); groupContent.AddSeparateRow(null, "Outside", null); groupContent.AddRow(_layersPanel); groupContent.AddRow(fromLibDropin); groupContent.AddSeparateRow(null, "Inside", null); //group.Content = groupContent; leftLayout.AddRow(groupContent); leftLayout.AddRow(null); //leftLayout.AddAutoSized(new Button()); //leftLayout.AddSeparateRow(new Button()); // Thermal properties var thermGp = new GroupBox() { Text = "Construction Thermal Properties" }; var thermProp = new DynamicLayout() { DefaultPadding = new Padding(4) }; //thermProp.AddSeparateRow("Construction Thermal Properties", null); _r_label = new Label() { Text = _r_si }; _u_label = new Label() { Text = _u_si }; _uf_label = new Label() { Text = _uf_si }; _r_value = new Label() { Text = "Not available" }; _u_value = new Label() { Text = "Not available" }; _uf_value = new Label() { Text = "Not available" }; thermProp.AddSeparateRow(_r_label, ":", _r_value); thermProp.AddSeparateRow(_u_label, ":", _u_value); thermProp.AddSeparateRow(_uf_label, ":", _uf_value); CalRValue(_hbObj, false); // unit switchs var unit = new RadioButtonList(); unit.Items.Add("Metric"); unit.Items.Add("Imperial"); unit.SelectedIndex = 0; unit.Spacing = new Size(5, 0); unit.SelectedIndexChanged += (s, e) => CalRValue(_hbObj, unit.SelectedIndex == 1); thermProp.AddSeparateRow("Unit:", unit); thermGp.Content = thermProp; leftLayout.AddRow(thermGp); leftLayout.AddRow(null); var buttonSource = new Button { Text = "Schema Data" }; buttonSource.Click += (s, e) => { Dialog_Message.Show(this, _hbObj.ToJson(true)); }; //leftLayout.AddRow(null); //Right panel var rightGroup = new GroupBox(); rightGroup.Text = "Library"; var groupPanel = new DynamicLayout(); var materialType = new DropDown(); materialType.Items.Add(new ListItem() { Key = "Opaque", Text = "Opaque Material" }); materialType.Items.Add(new ListItem() { Key = "Window", Text = "Window Material" }); //constructionTypes.Items.Add(new ListItem() { Key = "Shade Material" }); //constructionTypes.Items.Add(new ListItem() { Key = "AirBoundary Material" }); materialType.SelectedIndex = 0; groupPanel.AddRow(materialType); //Search tbox var searchTBox = new TextBox() { PlaceholderText = "Search" }; groupPanel.AddRow(searchTBox); var allMaterials = OpaqueMaterials; // Library var lib = new GridView(); lib.Height = 400; groupPanel.AddRow(lib); lib.ShowHeader = false; var nameCol = new GridColumn() { DataCell = new TextBoxCell(0) }; lib.Columns.Add(nameCol); // Library items lib.DataStore = allMaterials; var idCell = new TextBoxCell { Binding = Binding.Delegate <HB.Energy.IIDdEnergyBaseModel, string>(r => r.DisplayName ?? r.Identifier) }; lib.Columns.Add(new GridColumn() { DataCell = idCell }); // material details var detailPanel = new DynamicLayout(); var materialDetail = new TextArea(); materialDetail.Height = 150; materialDetail.Text = "Material Details"; //groupPanel.AddRow(materialDetail); var rightSplit = new Splitter(); rightSplit.Panel1 = groupPanel; rightSplit.Panel2 = materialDetail; rightSplit.Panel1MinimumSize = 300; rightSplit.Orientation = Orientation.Vertical; rightGroup.Content = rightSplit; materialType.SelectedIndexChanged += (sender, e) => { var selectedType = materialType.SelectedKey; allMaterials = selectedType == "Window" ? this.WindowMaterials : this.OpaqueMaterials; searchTBox.Text = null; //lib.Items.Clear(); lib.DataStore = allMaterials; //var filteredItems = allMaterials.Select(_ => new ListItem() { Text = _.Identifier, Key = _.Identifier, Tag = _ }); //lib.Items.AddRange(filteredItems); }; //// need this to make drag drop work on Mac //lib.MouseDown += (sender, e) => { // _primMousePressed = e.Buttons == MouseButtons.Primary; //}; //lib.MouseUp += (sender, e) => { // _primMousePressed = false; //}; lib.MouseMove += (sender, e) => { if (e.Buttons != MouseButtons.Primary) { return; } if (lib.SelectedItem == null) { return; } var dragableArea = lib.Bounds; dragableArea.Width -= 20; dragableArea.Height -= 20; var iscontained = e.Location.Y < dragableArea.Height && e.Location.X < dragableArea.Width; //name.Text = $"{dragableArea.Width}x{dragableArea.Height}, {new Point(e.Location).X}:{new Point(e.Location).Y}, {dragableArea.Contains(new Point(e.Location))}"; if (!iscontained) { return; } var cell = lib.GetCellAt(e.Location); if (cell.RowIndex == -1 || cell.ColumnIndex == -1) { return; } var selected = (lib.SelectedItem as HB.Energy.IMaterial).Identifier; var data = new DataObject(); data.SetString(selected, "HBObj"); lib.DoDragDrop(data, DragEffects.Move); e.Handled = true; }; lib.SelectedItemsChanged += (s, e) => { //Clear preview first materialDetail.Text = null; //Check current selected item from library var selItem = lib.SelectedItem as HB.HoneybeeObject; if (selItem == null) { return; } //Update Preview materialDetail.Text = selItem.ToString(true); }; searchTBox.TextChanged += (sender, e) => { var input = searchTBox.Text; materialDetail.Text = null; if (string.IsNullOrWhiteSpace(input)) { lib.DataStore = allMaterials; return; } var regexPatten = ".*" + input.Replace(" ", "(.*)") + ".*"; var filtered = allMaterials.Where(_ => Regex.IsMatch(_.Identifier, regexPatten, RegexOptions.IgnoreCase) || (_.DisplayName != null ? Regex.IsMatch(_.DisplayName, regexPatten, RegexOptions.IgnoreCase) : false)); lib.DataStore = filtered; }; //var split = new Splitter(); //split.Orientation = Orientation.Horizontal; //split.Panel1 = leftLayout; //split.Panel2 = rightGroup; var locked = new CheckBox() { Text = "Locked", Enabled = false }; locked.Checked = lockedMode; var layout = new DynamicLayout(); layout.DefaultSpacing = new Size(5, 5); layout.DefaultPadding = new Padding(5); layout.AddSeparateRow(leftLayout, rightGroup); layout.AddSeparateRow(locked, null, OkButton, AbortButton, null, buttonSource); layout.AddRow(null); //Create layout Content = layout; } catch (Exception e) { throw e; } }
public Dialog_Construction_Shade(HB.ShadeConstruction shadeConstruction, bool lockedMode = false) { var _hbObj = shadeConstruction; Padding = new Padding(10); Resizable = true; Title = $"Construction - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; //MinimumSize = new Size(450, 250); Width = 450; this.Icon = DialogHelper.HoneybeeIcon; var locked = new CheckBox() { Text = "Locked", Enabled = false }; locked.Checked = lockedMode; var OkButton = new Button { Text = "OK", Enabled = !lockedMode }; OkButton.Click += (sender, e) => OkCommand.Execute(_hbObj); AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); var layout = new DynamicLayout(); layout.DefaultSpacing = new Size(5, 5); layout.DefaultPadding = new Padding(10, 5); layout.AddRow("Name"); var name = new TextBox(); _hbObj.DisplayName = _hbObj.DisplayName ?? _hbObj.Identifier; name.TextBinding.Bind(() => _hbObj.DisplayName, (v) => _hbObj.DisplayName = v); layout.AddRow(name); //SolarReflectance var solarRef = new MaskedTextBox(); solarRef.Provider = new NumericMaskedTextProvider() { AllowDecimal = true }; solarRef.TextBinding.Bind(() => _hbObj.SolarReflectance.ToString(), (v) => _hbObj.SolarReflectance = DoubleFromString(v)); layout.AddRow(nameof(_hbObj.SolarReflectance)); layout.AddRow(solarRef); //VisibleReflectance var visibleRef = new MaskedTextBox(); visibleRef.Provider = new NumericMaskedTextProvider() { AllowDecimal = true }; visibleRef.TextBinding.Bind(() => _hbObj.VisibleReflectance.ToString(), (v) => _hbObj.VisibleReflectance = DoubleFromString(v)); layout.AddRow(nameof(_hbObj.VisibleReflectance)); layout.AddRow(visibleRef); // IsSpecular var IsSpecular = new CheckBox(); IsSpecular.CheckedBinding.Bind(() => _hbObj.IsSpecular, (v) => _hbObj.IsSpecular = v.GetValueOrDefault(false)); layout.AddRow(nameof(_hbObj.IsSpecular)); layout.AddRow(IsSpecular); var buttonSource = new Button { Text = "Schema Data" }; buttonSource.Click += (s, e) => { Dialog_Message.Show(this, _hbObj.ToJson(true)); }; layout.AddRow(null); layout.AddRow(buttonSource); layout.AddRow(null); layout.AddSeparateRow(locked, null, OkButton, AbortButton, null, buttonSource); Content = layout; }
public Dialog_ProgramType(ref HB.ModelProperties libSource, HB.ProgramTypeAbridged programType, bool lockedMode = false) { try { libSource.FillNulls(); _vm = new ProgramTypeViewModel(this, ref libSource, programType); Title = $"Program Type - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; Width = 450; this.Icon = DialogHelper.HoneybeeIcon; //Generate ProgramType Panel var nameTbx = new TextBox(); nameTbx.TextBinding.Bind(_vm, c => c.Name); var loadGroup = GenLoadsPanel(lockedMode); 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.GetHBObject()); } catch (Exception er) { MessageBox.Show(er.Message); //throw; } }; AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); // Json Data var hbData = new Button { Text = "Schema Data" }; hbData.Command = _vm.HBDataBtnClick; //Create layout var layout = new DynamicLayout() { DefaultPadding = new Padding(5), DefaultSpacing = new Size(5, 5) }; layout.BeginScrollable(BorderType.None); layout.AddRow("Name"); layout.AddRow(nameTbx); layout.AddRow(loadGroup); layout.AddRow(null); layout.EndScrollable(); layout.AddSeparateRow(locked, null, OkButton, AbortButton, null, hbData); layout.Add(null); //Create layout Content = layout; } catch (Exception e) { //throw e; Dialog_Message.Show(e.ToString()); } }
public Dialog_Material(HB.Energy.IMaterial material, bool lockedMode = false) { try { //_hbObj = HB.ModelEnergyProperties.Default.Materials.First(_ => _.Obj is HB.EnergyWindowMaterialGas).Obj as HB.EnergyWindowMaterialGas; var _hbObj = material; Padding = new Padding(5); Resizable = true; Title = $"Material - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; MinimumSize = new Size(450, 200); this.Icon = DialogHelper.HoneybeeIcon; var locked = new CheckBox() { Text = "Locked", Enabled = false }; locked.Checked = lockedMode; var OkButton = new Button { Text = "OK", Enabled = !lockedMode }; OkButton.Click += (sender, e) => OkCommand.Execute(_hbObj); AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); //var panel = new Panel_Schedule(sch); //panel.AddSeparateRow(null, OkButton, AbortButton, null); //Content = panel; var layout = new DynamicLayout(); layout.DefaultSpacing = new Size(5, 5); layout.DefaultPadding = new Padding(5); // unit switchs var unit = new RadioButtonList(); unit.Items.Add("Metric"); unit.Items.Add("Imperial"); unit.SelectedIndex = 0; unit.Spacing = new Size(5, 0); unit.SelectedIndexChanged += (s, e) => CalRValue(_hbObj, unit.SelectedIndex == 1); var buttonSource = new Button { Text = "Schema Data" }; buttonSource.Click += (s, e) => { Dialog_Message.Show(this, _hbObj.ToJson(true)); }; var materialPanel = GenParmPanel(_hbObj); layout.AddRow(materialPanel); layout.AddSeparateRow(null, "R/U value unit:", unit); layout.AddSeparateRow(locked, null, OkButton, AbortButton, null, buttonSource); layout.AddRow(null); //Create layout Content = layout; } catch (Exception e) { MessageBox.Show(e.Message); //throw e; } }
public static void Show(string message) { var dia = new Dialog_Message(message); dia.ShowModal(); }
//private ModelEnergyProperties ModelEnergyProperties { get; set; } public Dialog_IdealAirLoad(ref HoneybeeSchema.ModelEnergyProperties libSource, IdealAirSystemAbridged hvac = default, bool lockedMode = false) { var sys = hvac ?? new IdealAirSystemAbridged($"IdealAirSystem_{Guid.NewGuid().ToString().Substring(0, 8)}"); var vm = new IdealAirLoadViewModel(libSource, sys, this); //Padding = new Padding(4); Title = $"Ideal Air Load - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; Width = 450; this.Icon = DialogHelper.HoneybeeIcon; var layout = new DynamicLayout() { DataContext = vm }; layout.DefaultSpacing = new Size(4, 4); layout.Padding = new Padding(10); // string displayName = null, // EconomizerType economizerType = EconomizerType.DifferentialDryBulb, // bool demandControlledVentilation = false, // double sensibleHeatRecovery = 0, // double latentHeatRecovery = 0, // double heatingAirTemperature = 50, // double coolingAirTemperature = 13, // AnyOf<Autosize, NoLimit, double> heatingLimit = null, // AnyOf<Autosize, NoLimit, double> coolingLimit = null, // string heatingAvailability = null, // string coolingAvailability var nameText = new TextBox(); var economizer = new DropDown(); var DCV = new CheckBox() { Text = "Demand Controlled Ventilation" }; var sensible = new NumericStepper() { MinValue = 0, MaxValue = 1, MaximumDecimalPlaces = 2, Increment = 0.1 }; var latent = new NumericStepper() { MinValue = 0, MaxValue = 1, MaximumDecimalPlaces = 2, Increment = 0.1 }; var heatingAirT = new NumericStepper() { MinValue = -50, MaxValue = 100, MaximumDecimalPlaces = 2 }; var coolingAirT = new NumericStepper() { MinValue = -50, MaxValue = 100, MaximumDecimalPlaces = 2 }; var heatingLimitAuto = new RadioButton() { Text = "Autosize" }; var heatingLimitNoLimit = new RadioButton() { Text = "No Limit" }; var heatingLimitNumber = new RadioButton(); var heatingLimit = new NumericStepper(); var coolingLimitAuto = new RadioButton() { Text = "Autosize" }; var coolingLimitNoLimit = new RadioButton() { Text = "No Limit" }; var coolingLimitNumber = new RadioButton(); var coolingLimit = new NumericStepper(); var heatingAvailability = new OptionalButton(); heatingAvailability.TextBinding.Bind(vm, _ => _.HeatingAvaliabilitySchedule.BtnName); heatingAvailability.Bind(_ => _.Command, vm, _ => _.HeatingAvaliabilityCommand); heatingAvailability.Bind(_ => _.RemoveCommand, vm, _ => _.RemoveHeatingAvaliabilityCommand); heatingAvailability.Bind(_ => _.IsRemoveVisable, vm, _ => _.HeatingAvaliabilitySchedule.IsRemoveVisable); var coolingAvailability = new OptionalButton(); coolingAvailability.TextBinding.Bind(vm, _ => _.CoolingAvaliabilitySchedule.BtnName); coolingAvailability.Bind(_ => _.Command, vm, _ => _.CoolingAvaliabilityCommand); coolingAvailability.Bind(_ => _.RemoveCommand, vm, _ => _.RemoveCoolingAvaliabilityCommand); coolingAvailability.Bind(_ => _.IsRemoveVisable, vm, _ => _.CoolingAvaliabilitySchedule.IsRemoveVisable); nameText.TextBinding.BindDataContext((IdealAirLoadViewModel m) => m.Name); economizer.BindDataContext(c => c.DataStore, (IdealAirLoadViewModel m) => m.Economizers); economizer.SelectedKeyBinding.BindDataContext((IdealAirLoadViewModel m) => m.Economizer); DCV.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.DCV); sensible.BindDataContext(c => c.Value, (IdealAirLoadViewModel m) => m.SensibleHR); latent.BindDataContext(c => c.Value, (IdealAirLoadViewModel m) => m.LatentHR); heatingAirT.BindDataContext(c => c.Value, (IdealAirLoadViewModel m) => m.HeatingAirTemperature); coolingAirT.BindDataContext(c => c.Value, (IdealAirLoadViewModel m) => m.CoolingAirTemperature); heatingLimitAuto.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.HeatingLimitAutosized); heatingLimitNoLimit.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.HeatingLimitNoLimit); heatingLimitNumber.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.HeatingLimitNumber); heatingLimit.BindDataContext(c => c.Value, (IdealAirLoadViewModel m) => m.HeatingLimit); heatingLimit.BindDataContext(c => c.Enabled, (IdealAirLoadViewModel m) => m.HeatingLimitNumber); coolingLimitAuto.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.CoolingLimitAutosized); coolingLimitNoLimit.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.CoolingLimitNoLimit); coolingLimitNumber.BindDataContext(c => c.Checked, (IdealAirLoadViewModel m) => m.CoolingLimitNumber); coolingLimit.BindDataContext(c => c.Value, (IdealAirLoadViewModel m) => m.CoolingLimit); coolingLimit.BindDataContext(c => c.Enabled, (IdealAirLoadViewModel m) => m.CoolingLimitNumber); layout.AddRow("Name:"); layout.AddRow(nameText); layout.AddRow("Economizer:"); layout.AddRow(economizer); layout.AddSeparateRow(DCV); layout.AddRow("Sensible Heat Recovery: [0-1]"); layout.AddRow(sensible); layout.AddRow("Latent Heat Recovery: [0-1]"); layout.AddRow(latent); layout.AddRow("Heating Supply Air Temperature: [C]"); layout.AddRow(heatingAirT); layout.AddRow("Cooling Supply Air Temperature: [C]"); layout.AddRow(coolingAirT); layout.AddRow("Heating Capacity Limit: [Watts]"); layout.AddRow(heatingLimitAuto); layout.AddRow(heatingLimitNoLimit); layout.AddSeparateRow(heatingLimitNumber, heatingLimit); layout.AddRow("Cooling Capacity Limit: [Watts]"); layout.AddRow(coolingLimitAuto); layout.AddRow(coolingLimitNoLimit); layout.AddSeparateRow(coolingLimitNumber, coolingLimit); layout.AddRow("Heating Availability"); layout.AddRow(heatingAvailability); layout.AddRow("Cooling Availability"); layout.AddRow(coolingAvailability); var locked = new CheckBox() { Text = "Locked", Enabled = false }; locked.Checked = lockedMode; var OKButton = new Button { Text = "OK", Enabled = !lockedMode }; OKButton.Click += (sender, e) => OkCommand.Execute(vm.GreateHvac(hvac)); AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); var hbData = new Button { Text = "Schema Data" }; hbData.Click += (sender, e) => Dialog_Message.Show(this, vm.GreateHvac(hvac).ToJson(true), "Schema Data"); layout.AddSeparateRow(locked, null, OKButton, this.AbortButton, null, hbData); layout.AddRow(null); Content = layout; }
public static void Show(Control owner, string message) { var dia = new Dialog_Message(message); dia.ShowModal(owner); }
public Dialog_Construction_AirBoundary(HB.ModelEnergyProperties libSource, HB.AirBoundaryConstructionAbridged airBoundaryConst, bool lockedMode = false) { _lib = libSource; _hbObj = airBoundaryConst; Padding = new Padding(10); Resizable = true; Title = $"Construction - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; Width = 450; this.Icon = DialogHelper.HoneybeeIcon; var locked = new CheckBox() { Text = "Locked", Enabled = false }; locked.Checked = lockedMode; var OkButton = new Button { Text = "OK", Enabled = !lockedMode }; OkButton.Click += (sender, e) => OkCommand.Execute(_hbObj); AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); var layout = new DynamicLayout(); layout.DefaultSpacing = new Size(5, 5); layout.DefaultPadding = new Padding(10, 5); layout.AddRow("Name"); var name = new TextBox(); _hbObj.DisplayName = _hbObj.DisplayName ?? _hbObj.Identifier; name.TextBinding.Bind(() => _hbObj.DisplayName, (v) => _hbObj.DisplayName = v); layout.AddRow(name); //AirMixingPerArea var airMx = new MaskedTextBox(); airMx.Provider = new NumericMaskedTextProvider() { AllowDecimal = true }; airMx.TextBinding.Bind(() => _hbObj.AirMixingPerArea.ToString(), (v) => _hbObj.AirMixingPerArea = Utility.ToNumber(v)); layout.AddRow(nameof(_hbObj.AirMixingPerArea)); layout.AddRow(airMx); //AirMixingSchedule var airMxSch = new Button(); _airMixSch = airMxSch; airMxSch.Text = _hbObj.AirMixingSchedule; airMxSch.Click += AirMxSch_Click; layout.AddRow(nameof(_hbObj.AirMixingSchedule)); layout.AddRow(airMxSch); var buttonSource = new Button { Text = "Schema Data" }; buttonSource.Click += (s, e) => { Dialog_Message.Show(this, _hbObj.ToJson(true)); }; layout.AddRow(null); layout.AddRow(buttonSource); layout.AddRow(null); layout.AddSeparateRow(locked, null, OkButton, AbortButton, null, buttonSource); Content = layout; }
//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; }
public Dialog_ConstructionSet_Interior(ref HB.ModelEnergyProperties libSource, InteriorSet constructionSet, bool lockedMode = false) { try { _vm = new ConstructionSetViewModel_Interior(this, ref libSource, constructionSet); Padding = new Padding(5); Resizable = true; Title = $"Interior Construction Set - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; Width = 450; this.Icon = DialogHelper.HoneybeeIcon; var interiorGroup = GenInteriorSetPanel(lockedMode); //Left panel var panelLeft = new DynamicLayout(); panelLeft.DefaultSpacing = new Size(0, 5); panelLeft.AddRow(interiorGroup); var locked = new CheckBox() { Text = "Locked", Enabled = false }; locked.Checked = lockedMode; var OkButton = new Button { Text = "OK", Enabled = !lockedMode }; OkButton.Click += (sender, e) => { var obj = _vm.GetHBObject(); this.Close(obj); }; AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); var buttons = new TableLayout { Padding = new Padding(5, 10, 5, 5), Spacing = new Size(10, 10), Rows = { new TableRow(locked, null, OkButton, this.AbortButton, null) } }; //Create layout Content = new TableLayout() { Padding = new Padding(10), Spacing = new Size(5, 5), Rows = { panelLeft, new TableRow(buttons), null } }; } catch (Exception e) { Dialog_Message.Show(e.ToString()); //throw e; } }
public Dialog_ConstructionSet(ref HB.ModelEnergyProperties libSource, HB.ConstructionSetAbridged constructionSet, bool lockedMode = false) { try { _vm = new ConstructionSetViewModel(this, ref libSource, constructionSet); Padding = new Padding(5); Resizable = true; Title = $"Construction Set - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; MinimumSize = new Size(450, 600); this.Icon = DialogHelper.HoneybeeIcon; var nameTbx = new TextBox() { Enabled = !lockedMode }; nameTbx.TextBinding.Bind(_vm, _ => _.Name); var wallGroup = GenWallSetPanel(lockedMode); var floorGroup = GenFloorSetPanel(lockedMode); var roofGroup = GenRoofSetPanel(lockedMode); var apertureGroup = GenApertureSetPanel(lockedMode); var doorGroup = GenDoorSetPanel(lockedMode); var shadeGroup = GenShadeSetPanel(lockedMode); var airBdGroup = GenAirBoundarySetPanel(lockedMode); //Left panel var panelLeft = new DynamicLayout(); panelLeft.DefaultSpacing = new Size(0, 5); panelLeft.BeginScrollable(BorderType.None); panelLeft.Height = 600; panelLeft.AddRow("Name"); panelLeft.AddRow(nameTbx); panelLeft.AddRow(wallGroup); panelLeft.AddRow(floorGroup); panelLeft.AddRow(roofGroup); panelLeft.AddRow(apertureGroup); panelLeft.AddRow(doorGroup); panelLeft.AddRow(shadeGroup); panelLeft.AddRow(airBdGroup); var locked = new CheckBox() { Text = "Locked", Enabled = false }; locked.Checked = lockedMode; var OkButton = new Button { Text = "OK", Enabled = !lockedMode }; OkButton.Click += (sender, e) => { var obj = _vm.GetHBObject(); OkCommand.Execute(obj); }; AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); var hbData = new Button { Text = "Schema Data" }; hbData.Command = _vm.HBDataBtnClick; var buttons = new TableLayout { Padding = new Padding(5, 10, 5, 5), Spacing = new Size(10, 10), Rows = { new TableRow(locked, null, OkButton, this.AbortButton, null, hbData) } }; //Create layout Content = new TableLayout() { Padding = new Padding(10), Spacing = new Size(5, 5), Rows = { panelLeft, new TableRow(buttons), null } }; } catch (Exception e) { Dialog_Message.Show(e.ToString()); //throw e; } }