/// <summary> /// Called by the DataGrid control when this column asks for its elements to be /// updated, because its CheckBoxContentBinding or IsThreeState property changed. /// </summary> public override void UpdateElement(Control element, string propertyName) { if (element == null) { throw new ArgumentNullException("element"); } CheckBox checkBox = element as CheckBox; if (checkBox == null) { throw DataGridError.DataGrid.ValueIsNotAnInstanceOf("element", typeof(CheckBox)); } if (propertyName == DATAGRIDCHECKBOXCOLUMN_checkBoxContentBindingName) { checkBox.Bind(CheckBox.ContentProperty, this.CheckBoxContentBinding); } else if (propertyName == DATAGRIDCHECKBOXCOLUMN_isThreeStateName) { checkBox.IsThreeState = this.IsThreeState; } else { checkBox.Bind(CheckBox.ContentProperty, this.CheckBoxContentBinding); checkBox.IsThreeState = this.IsThreeState; } }
private void ConfigureCheckBox(CheckBox checkBox) { checkBox.HorizontalAlignment = HorizontalAlignment.Center; checkBox.VerticalAlignment = VerticalAlignment.Center; checkBox.IsThreeState = this.IsThreeState; checkBox.Bind(CheckBox.IsCheckedProperty, this.DisplayMemberBinding); if (this.CheckBoxContentBinding != null) { checkBox.Bind(CheckBox.ContentProperty, this.CheckBoxContentBinding); } }
Control UseClearColorControl() { var control = new CheckBox { Text = "Use Red Clear Color at 0.5 alpha" }; control.Bind(r => r.Checked, this, r => r.UseClearColor); return(control); }
Control UseBackgroundColorControl() { var control = new CheckBox { Text = "Use Background Color" }; control.Bind(c => c.Checked, this, c => c.UseBackgroundColor); return(control); }
Control EnableContextMenu() { var control = new CheckBox { Text = "Enable Context Menu" }; control.Bind(r => r.Checked, webView, w => w.BrowserContextMenuEnabled); return(control); }
Control BoldFont() { var control = new CheckBox { Text = "Bold", Enabled = false }; control.Bind(r => r.Checked, (Font f) => f.Bold); return(control); }
Control ItalicFont() { var control = new CheckBox { Text = "Italic", Enabled = false }; control.Bind(r => r.Checked, (Font f) => f.Italic); return(control); }
Control CreateShowActivatedCheckbox() { showActivatedCheckBox = new ResettableCheckBox { Text = "ShowActivated" }; showActivatedCheckBox.CheckedBinding.BindDataContext((Form w) => w.ShowActivated); showActivatedCheckBox.Bind(c => c.Enabled, typeRadio, Binding.Property((RadioButtonList t) => t.SelectedKey).ToBool("dialog").Convert(v => !v)); return(showActivatedCheckBox); }
Control UseGraphicsPathClipControl() { var control = new CheckBox { Text = "Use graphics path clip" }; control.Bind(r => r.Checked, this, r => r.UseGraphicsPathClip); return(control); }
Control ExpandContentHeight() { var control = new CheckBox { Text = "ExpandContentHeight" }; control.Bind(r => r.Checked, defaultScrollable, s => s.ExpandContentHeight); return(control); }
Control ResetClipControl() { var control = new CheckBox { Text = "Reset Clip" }; control.Bind(r => r.Checked, this, r => r.ResetClip); return(control); }
Control Reverse() { var control = new CheckBox { Text = "Reverse" }; control.Bind(r => r.Checked, (PrintSettings s) => s.Reverse); return(control); }
Control Collate() { var control = new CheckBox { Text = "Collate" }; control.Bind(r => r.Checked, (PrintSettings s) => s.Collate); return(control); }
public static void Display(DecompilerTextView textView) { AvaloniaEditTextOutput output = new AvaloniaEditTextOutput(); output.WriteLine("ILSpy version " + RevisionClass.FullVersion); output.AddUIElement( delegate { StackPanel stackPanel = new StackPanel(); stackPanel.HorizontalAlignment = HorizontalAlignment.Center; stackPanel.Orientation = Orientation.Horizontal; if (latestAvailableVersion == null) { AddUpdateCheckButton(stackPanel, textView); } else { // we already retrieved the latest version sometime earlier ShowAvailableVersion(latestAvailableVersion, stackPanel); } CheckBox checkBox = new CheckBox(); checkBox.Margin = new Thickness(4); checkBox.Content = "Automatically check for updates every week"; UpdateSettings settings = new UpdateSettings(ILSpySettings.Load()); checkBox.Bind(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled") { Source = settings }); return(new StackPanel { Margin = new Thickness(0, 4, 0, 0), Cursor = Cursor.Default, Children = { stackPanel, checkBox } }); }); output.WriteLine(); foreach (var plugin in App.ExportProvider.GetExportedValues <IAboutPageAddition>()) { plugin.Write(output); } output.WriteLine(); var asm = typeof(AboutPage).Assembly; using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), "README.txt")) { using (StreamReader r = new StreamReader(s)) { string line; while ((line = r.ReadLine()) != null) { output.WriteLine(line); } } } output.AddVisualLineElementGenerator(new MyLinkElementGenerator("SharpDevelop", "http://www.icsharpcode.net/opensource/sd/")); output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MIT License", "resource:license.txt")); output.AddVisualLineElementGenerator(new MyLinkElementGenerator("LGPL", "resource:LGPL.txt")); output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MS-PL", "resource:MS-PL.txt")); textView.ShowText(output); }
Control CloseFiguresControl() { var control = new CheckBox { Text = "Close Figures" }; control.Bind(cb => cb.Checked, this, r => r.CloseFigures); control.CheckedChanged += Refresh; return(control); }
public void SetViewModel(CustomRenderSettingsViewModel view_model) { ViewModel = view_model; // Databinding ViewModel.PropertyChanged += new PropertyChangedEventHandler(ViewModelChanged); m_checkbox.Bind(m_checkOn => m_checkOn.Checked, ViewModel, (CustomRenderSettingsViewModel m) => m.CheckBoxValue); // Get initial values for display ViewModel.DisplayData(); }
Control ConnectPathControl() { var control = new CheckBox { Text = "Connect Paths" }; control.Bind(cb => cb.Checked, this, r => r.ConnectPath); control.CheckedChanged += Refresh; return(control); }
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); }
void UpdateTemplate() { if (Node != null) { bindings.Add(expander.Bind(ToggleButton.IsVisibleProperty, new Binding("ShowExpander") { Source = Node })); bindings.Add(expander.Bind(ToggleButton.IsCheckedProperty, new Binding("IsExpanded") { Source = Node })); bindings.Add(icon.Bind(ContentPresenter.IsVisibleProperty, new Binding("ShowIcon") { Source = Node })); bindings.Add(checkBoxContainer.Bind(Border.IsVisibleProperty, new Binding("IsCheckable") { Source = Node })); bindings.Add(checkBox.Bind(CheckBox.IsCheckedProperty, new Binding("IsChecked") { Source = Node })); bindings.Add(textContainer.Bind(Border.IsVisibleProperty, new Binding("IsEditing") { Source = Node, Converter = BoolConverters.Inverse })); bindings.Add(textContent.Bind(ContentPresenter.ContentProperty, new Binding("Text") { Source = Node })); RaisePropertyChanged(IconProperty, null, Icon); } spacer.Width = CalculateIndent(); if (ParentTreeView.Root == Node && !ParentTreeView.ShowRootExpander) { expander.IsVisible = false; } else { expander.ClearValue(IsVisibleProperty); } }
private void FillOptions(object sender, AvaloniaPropertyChangedEventArgs args) { if (args.Property == Grid.BoundsProperty) { mainPanel.PropertyChanged -= FillOptions; var typeDict = new Dictionary <Type, int>() { { typeof(bool), 1 }, { typeof(KeyGesture), 2 } }; var optionsPanel = this.FindControl <StackPanel>("OptionsPanel"); foreach (var item in InitialOptions.Properties) { var newRow = new WrapPanel(); optionsPanel.Children.Add(newRow); newRow.Children.Add(new TextBlock() { Text = StringUtils.SplitCamelCase(item.Name) }); var itemValue = item.GetValue((this.DataContext as OptionsViewModel).CurrentOptions, null); switch (typeDict.GetValueOrDefault(item.PropertyType)) { case 1: var checkBox = new CheckBox(); newRow.Children.Add(checkBox); checkBox.Bind(CheckBox.IsCheckedProperty, new Binding("CurrentOptions." + item.Name)); break; case 2: var propertyText = new TextBox(); newRow.Children.Add(propertyText); propertyText.Bind(TextBox.TextProperty, new Binding("CurrentOptions." + item.Name) { Converter = new KeyGestureConverter() }); break; default: System.Console.WriteLine("none of the above"); break; } System.Console.WriteLine(item.GetValue((this.DataContext as OptionsViewModel).CurrentOptions, null)); } } }
private Control CreateLoggingGroup() { var group = new GroupBox { Text = "Logging" }; var layout = new TableLayout(1, 3); var enableTrace = new CheckBox { Text = "Enable trace level" }; enableTrace.Bind(c => c.Checked, _vm, v => v.EnableTraceLogging); layout.Add(enableTrace, 0, 0, true, false); layout.Rows.Add(null); group.Content = layout; return(group); }
private Control CreateAppearanceGroup() { var group = new GroupBox { Text = "Appearance" }; var layout = new TableLayout(1, 3); var connectOnStartup = new CheckBox { Text = "Show connection dialog on application startup" }; connectOnStartup.Bind(c => c.Checked, _vm, v => v.ShowConnectOnStartup); layout.Add(connectOnStartup, 0, 0, true, false); layout.Rows.Add(null); group.Content = layout; return(group); }
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 ModelEnergyProperties ModelEnergyProperties { get; set; } public Dialog_OpsHVACs(ref HoneybeeSchema.ModelEnergyProperties libSource, HoneybeeSchema.Energy.IHvac hvac = default, bool lockedMode = false) { this.Padding = new Padding(10); Title = $"From OpenStudio HVAC library - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; Width = 450; this.Icon = DialogHelper.HoneybeeIcon; if (hvac == null) // add a new system { _vm = new OpsHVACsViewModel(libSource, this); } else // edit existing system { _vm = new OpsHVACsViewModel(libSource, hvac, this); } var layout = new DynamicLayout() { DataContext = _vm }; layout.DefaultSpacing = new Size(5, 5); layout.DefaultPadding = new Padding(5); // add a new system from lib if (hvac == null) { // UI for system groups var hvacGroups = new DropDown(); var hvacTypes = new DropDown(); var hvacEquipments = new DropDown(); hvacGroups.BindDataContext(c => c.DataStore, (OpsHVACsViewModel m) => m.HvacGroups); hvacGroups.SelectedKeyBinding.BindDataContext((OpsHVACsViewModel m) => m.HvacGroup); hvacTypes.BindDataContext(c => c.DataStore, (OpsHVACsViewModel m) => m.HvacTypes); hvacTypes.ItemTextBinding = Binding.Delegate <Type, string>(t => _vm.HVACTypesDic[t]); hvacTypes.SelectedValueBinding.BindDataContext((OpsHVACsViewModel m) => m.HvacType); hvacEquipments.BindDataContext(c => c.DataStore, (OpsHVACsViewModel m) => m.HvacEquipmentTypes); hvacEquipments.ItemTextBinding = Binding.Delegate <string, string>(t => _vm.HVACsDic[t]); hvacEquipments.SelectedKeyBinding.BindDataContext((OpsHVACsViewModel m) => m.HvacEquipmentType); layout.AddRow("HVAC Groups:"); layout.AddRow(hvacGroups); layout.AddRow("HVAC Types:"); layout.AddRow(hvacTypes); layout.AddRow("HVAC Equipment Types:"); layout.AddRow(hvacEquipments); layout.AddRow(null); } var year = new DropDown(); var nameText = new TextBox(); var economizer = new DropDown(); 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 }; nameText.TextBinding.BindDataContext((OpsHVACsViewModel m) => m.Name); year.BindDataContext(c => c.DataStore, (OpsHVACsViewModel m) => m.Vintages); year.SelectedKeyBinding.BindDataContext((OpsHVACsViewModel m) => m.Vintage); var economizerTitle = new Label() { Text = "Economizer:" }; economizer.BindDataContext(c => c.DataStore, (OpsHVACsViewModel m) => m.Economizers); economizer.SelectedKeyBinding.BindDataContext((OpsHVACsViewModel m) => m.Economizer); economizer.BindDataContext(c => c.Enabled, (OpsHVACsViewModel m) => m.EconomizerVisable); economizer.BindDataContext(c => c.Visible, (OpsHVACsViewModel m) => m.EconomizerVisable); economizerTitle.BindDataContext(c => c.Visible, (OpsHVACsViewModel m) => m.EconomizerVisable); var sensibleTitle = new Label() { Text = "Sensible Heat Recovery:" }; sensible.BindDataContext(c => c.Value, (OpsHVACsViewModel m) => m.SensibleHR); sensible.BindDataContext(c => c.Visible, (OpsHVACsViewModel m) => m.SensibleHRVisable); sensibleTitle.BindDataContext(c => c.Visible, (OpsHVACsViewModel m) => m.SensibleHRVisable); var latentTitle = new Label() { Text = "Latent Heat Recovery:" }; latent.BindDataContext(c => c.Value, (OpsHVACsViewModel m) => m.LatentHR); latent.BindDataContext(c => c.Visible, (OpsHVACsViewModel m) => m.LatentHRVisable); latentTitle.BindDataContext(c => c.Visible, (OpsHVACsViewModel m) => m.LatentHRVisable); var dcv = new CheckBox() { Text = "Demand Control Ventilation" }; dcv.Bind(_ => _.Checked, _vm, _ => _.DcvChecked); dcv.Bind(c => c.Visible, _vm, _ => _.DcvVisable); var availabilityTitle = new Label() { Text = "DOAS Availability Schedule:" }; availabilityTitle.Bind(c => c.Visible, _vm, _ => _.AvaliabilityVisable); var availability = new OptionalButton(); availability.Bind(c => c.Visible, _vm, _ => _.AvaliabilityVisable); availability.TextBinding.Bind(_vm, _ => _.AvaliabilitySchedule.BtnName); availability.Bind(_ => _.Command, _vm, _ => _.AvaliabilityCommand); availability.Bind(_ => _.RemoveCommand, _vm, _ => _.RemoveAvaliabilityCommand); availability.Bind(_ => _.IsRemoveVisable, _vm, _ => _.AvaliabilitySchedule.IsRemoveVisable); var radSettings = GenRadSettingsPanel(); var gp = new GroupBox() { Text = "HVAC System settings" }; var gpLayout = new DynamicLayout(); gpLayout.DefaultPadding = new Padding(5); // fix the height of layout in case of creating a new system, otherwise, autosize height if (hvac == null) { gpLayout.Height = 250; gpLayout.BeginScrollable(BorderType.None); } var gpGeneralLayout = new DynamicLayout(); //gpLayout.BeginGroup("HVAC System settings", new Padding(5), new Size(5, 0)); gpGeneralLayout.Spacing = new Size(5, 2); gpGeneralLayout.AddRow("Name:"); gpGeneralLayout.AddRow(nameText); gpGeneralLayout.AddRow("Vintage:"); gpGeneralLayout.AddRow(year); gpGeneralLayout.AddRow(economizerTitle); gpGeneralLayout.AddRow(economizer); gpGeneralLayout.AddRow(sensibleTitle); gpGeneralLayout.AddRow(sensible); gpGeneralLayout.AddRow(latentTitle); gpGeneralLayout.AddRow(latent); gpGeneralLayout.AddRow(availabilityTitle); gpGeneralLayout.AddRow(availability); gpGeneralLayout.AddRow(dcv); gpLayout.AddRow(gpGeneralLayout); gpLayout.AddRow(radSettings); //gpLayout.EndGroup(); gp.Content = gpLayout; layout.AddRow(gp); 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.GreateHvac(hvac); OkCommand.Execute(obj); }; AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); layout.AddSeparateRow(locked, null, OKButton, this.AbortButton, null, null); //layout.AddRow(null); Content = layout; }
public Dialog_MatchRoomProperties(HB.Room sourceRoom, IEnumerable <HB.Room> targetRooms) { var vm = new MatchRoomPropertiesViewModel(sourceRoom, targetRooms); Padding = new Padding(5); Title = "Match Room Properties"; WindowStyle = WindowStyle.Default; Width = 300; this.Icon = Honeybee.UI.DialogHelper.HoneybeeIcon; var layout = new DynamicLayout(); this.DefaultButton = new Button { Text = "OK" }; DefaultButton.Click += (sender, e) => Close(vm.GetUpdatedRooms()); this.AbortButton = new Button { Text = "Close" }; AbortButton.Click += (sender, e) => Close(); // all controls var allToggle = new CheckBox() { Text = "Select/Unselect All" }; allToggle.Bind(_ => _.Checked, vm, m => m.All); layout.AddRow(allToggle); HoneybeeSchema.Room dummy = null; // General layout.BeginGroup("General"); var name = new CheckBox() { Text = "Name" }; name.CheckedBinding.Bind(vm, m => m.Name); layout.AddRow(name); var story = new CheckBox() { Text = nameof(dummy.Story) }; story.CheckedBinding.Bind(vm, m => m.Story); layout.AddRow(story); var multi = new CheckBox() { Text = nameof(dummy.Multiplier) }; multi.CheckedBinding.Bind(vm, m => m.Multiplier); layout.AddRow(multi); var mset = new CheckBox() { Text = "Modifier Set" }; mset.CheckedBinding.Bind(vm, m => m.ModifierSet); layout.AddRow(mset); var cset = new CheckBox() { Text = "Construction Set" }; cset.CheckedBinding.Bind(vm, m => m.ConstructionSet); layout.AddRow(cset); var ptype = new CheckBox() { Text = "Program Type" }; ptype.CheckedBinding.Bind(vm, m => m.ProgramType); layout.AddRow(ptype); var hvac = new CheckBox() { Text = "HVAC System" }; hvac.CheckedBinding.Bind(vm, m => m.HVAC); layout.AddRow(hvac); var user = new CheckBox() { Text = "User Data" }; user.CheckedBinding.Bind(vm, m => m.User); layout.AddRow(user); layout.EndGroup(); //Loads layout.BeginGroup("Loads"); var ltn = new CheckBox() { Text = nameof(dummy.Properties.Energy.Lighting) }; ltn.CheckedBinding.Bind(vm, m => m.Lighting); layout.AddRow(ltn); var ppl = new CheckBox() { Text = nameof(dummy.Properties.Energy.People) }; ppl.CheckedBinding.Bind(vm, m => m.People); layout.AddRow(ppl); var elecEqp = new CheckBox() { Text = "Electric Equipment" }; elecEqp.CheckedBinding.Bind(vm, m => m.ElecEquipment); layout.AddRow(elecEqp); var gas = new CheckBox() { Text = "Gas Equipment" }; gas.CheckedBinding.Bind(vm, m => m.GasEquipment); layout.AddRow(gas); var vent = new CheckBox() { Text = nameof(dummy.Properties.Energy.Ventilation) }; vent.CheckedBinding.Bind(vm, m => m.Ventilation); layout.AddRow(vent); var infil = new CheckBox() { Text = nameof(dummy.Properties.Energy.Infiltration) }; infil.CheckedBinding.Bind(vm, m => m.Infiltration); layout.AddRow(infil); var spt = new CheckBox() { Text = nameof(dummy.Properties.Energy.Setpoint) }; spt.CheckedBinding.Bind(vm, m => m.Setpoint); layout.AddRow(spt); var hotWater = new CheckBox() { Text = "Service Hot Water" }; hotWater.CheckedBinding.Bind(vm, m => m.ServiceHotWater); layout.AddRow(hotWater); var masses = new CheckBox() { Text = "Internal Masses" }; masses.CheckedBinding.Bind(vm, m => m.InternalMasses); layout.AddRow(masses); layout.EndGroup(); // Controls layout.BeginGroup("Controls"); var vCtrl = new CheckBox() { Text = "Window Ventilation Control" }; vCtrl.CheckedBinding.Bind(vm, m => m.VentControl); layout.AddRow(vCtrl); var dCtrl = new CheckBox() { Text = "Daylighting Control" }; dCtrl.CheckedBinding.Bind(vm, m => m.DaylightControl); layout.AddRow(dCtrl); layout.EndGroup(); //layout.DefaultPadding = new Padding(10); layout.DefaultSpacing = new Size(3, 3); layout.DefaultPadding = new Padding(5); layout.AddSeparateRow(null, DefaultButton, AbortButton, null); layout.AddRow(null); Content = layout; }
private void BuildDetails() { _details.UnBind(); _details.Controls.Clear(); var material = this.GameObject as PluginBase.GameObjects.Material; //var shader = Plugins.Container.ResolveNamed<TokED.ShaderDefinition>(material.Shader); _depthTest = _details.AddLabeledCheckBox(100, "Depth Test:"); _depthTest.Bind(this.GameObject, "DepthTest"); _alphaBlend = _details.AddLabeledCheckBox(100, "Alpha Blend:"); _alphaBlend.Bind(this.GameObject, "AlphaBlend"); _smoothLines = _details.AddLabeledCheckBox(100, "Smooth Lines:"); _smoothLines.Bind(this.GameObject, "SmoothLines"); _minFilter = _details.AddEnumList(100, "Min Filter:", typeof(TextureMinFilter)); _minFilter.Bind(this.GameObject, "MinFilter"); _magFilter = _details.AddEnumList(100, "Mag Filter:", typeof(TextureMagFilter)); _magFilter.Bind(this.GameObject, "MagFilter"); //Shader Parameters foreach (var p in material.Parameters) { switch (p.Type) { case ShaderParamType.Int: _details.AddLabeledTextBox(100, p.LongName + ":", 1.0f).Bind(p, "IntValue").Bind(this.GameObject, "ApplyParameters"); break; case ShaderParamType.Float: _details.AddLabeledTextBox(100, p.LongName + ":", 0.02f).Bind(p, "FloatValue").Bind(this.GameObject, "ApplyParameters"); break; case ShaderParamType.Vec2: _details.AddLabeledTextBox(100, p.LongName + " X:", 0.02f).Bind(p, "X").Bind(this.GameObject, "ApplyParameters"); _details.AddLabeledTextBox(100, p.LongName + " Y:", 0.02f).Bind(p, "Y").Bind(this.GameObject, "ApplyParameters"); break; case ShaderParamType.Vec3: _details.AddLabeledTextBox(100, p.LongName + " X:", 0.02f).Bind(p, "X").Bind(this.GameObject, "ApplyParameters"); _details.AddLabeledTextBox(100, p.LongName + " Y:", 0.02f).Bind(p, "Y").Bind(this.GameObject, "ApplyParameters"); _details.AddLabeledTextBox(100, p.LongName + " Z:", 0.02f).Bind(p, "Z").Bind(this.GameObject, "ApplyParameters"); break; case ShaderParamType.Vec4: _details.AddLabeledTextBox(100, p.LongName + " X:", 0.02f).Bind(p, "X").Bind(this.GameObject, "ApplyParameters"); _details.AddLabeledTextBox(100, p.LongName + " Y:", 0.02f).Bind(p, "Y").Bind(this.GameObject, "ApplyParameters"); _details.AddLabeledTextBox(100, p.LongName + " Z:", 0.02f).Bind(p, "Z").Bind(this.GameObject, "ApplyParameters"); _details.AddLabeledTextBox(100, p.LongName + " W:", 0.02f).Bind(p, "W").Bind(this.GameObject, "ApplyParameters"); break; case ShaderParamType.Color: _details.AddLabeledColorButton(100, p.LongName + ":").Bind(p, "Color").Bind(this.GameObject, "ApplyParameters"); break; case ShaderParamType.Texture: _details.AddLabeledFilename(100, p.LongName + ":", ".png", "Texture (.png)|*.png", "Load Texture from file:") .Bind(p, "Filename") .Bind(this.GameObject, "NotifyChange"); break; } } _details.Size = new Point(0, 20 * _details.Controls.Count); }
public SegmentedButtonSection() { var checkCommand = new CheckCommand { ToolBarText = "CheckCommand" }; checkCommand.CheckedChanged += (sender, e) => Log.Write(sender, $"CheckedChanged: {checkCommand.Checked}"); checkCommand.Executed += (sender, e) => Log.Write(sender, "Executed"); var segbutton = new SegmentedButton(); segbutton.Items.Add(new ButtonSegmentedItem { Image = TestIcons.TestIcon.WithSize(16, 16) }); segbutton.Items.Add(new ButtonSegmentedItem { Text = "Some Text", Image = TestIcons.TestImage.WithSize(16, 16) }); segbutton.Items.Add(new ButtonSegmentedItem(checkCommand)); segbutton.Items.Add(new ButtonSegmentedItem { Text = "Width=150", Width = 150 }); segbutton.Items.Add(new MenuSegmentedItem { Text = "Selectable Menu", CanSelect = true, Menu = new ContextMenu { Items = { CreateMenuItem("Menu Item 1"), CreateMenuItem("Menu Item 2") } } }); segbutton.Items.Add(new MenuSegmentedItem { Text = "Menu Only", Image = TestIcons.TestImage.WithSize(16, 16), CanSelect = false, Menu = new ContextMenu { Items = { CreateMenuItem("Menu Item 1"), CreateMenuItem("Menu Item 2") } } }); LogEvents(segbutton); var selectionModeDropDown = new EnumDropDown <SegmentedSelectionMode>(); selectionModeDropDown.SelectedValueBinding.Bind(segbutton, b => b.SelectionMode); var selectAllButton = new Button { Text = "SelectAll" }; selectAllButton.Click += (sender, e) => segbutton.SelectAll(); //selectAllButton.Bind(c => c.Enabled, selectionModeDropDown.SelectedValueBinding.Convert(r => r == SegmentedSelectionMode.Multiple)); var clearSelectionButton = new Button { Text = "ClearSelection" }; clearSelectionButton.Click += (sender, e) => segbutton.ClearSelection(); clearSelectionButton.Bind(c => c.Enabled, selectionModeDropDown.SelectedValueBinding.Convert(r => r != SegmentedSelectionMode.None)); var checkCommandEnabled = new CheckBox { Text = "CheckCommand.Enabled" }; checkCommandEnabled.Bind(c => c.Checked, checkCommand, c => c.Enabled); // layout BeginCentered(); AddSeparateRow("SelectionMode:", selectionModeDropDown); AddSeparateRow(selectAllButton, clearSelectionButton); AddSeparateRow(checkCommandEnabled); EndCentered(); AddSeparateRow(segbutton); }
private void DefineLayout() { var hostLabel = new Label { Text = ConnectResource.Host_label, Width = FirstColumnWidth, VerticalAlignment = VerticalAlignment.Center }; var keyLabel = new Label { Text = ConnectResource.Key_label, Width = FirstColumnWidth, VerticalAlignment = VerticalAlignment.Center }; var portLabel = new Label { Text = ConnectResource.Port_label, VerticalAlignment = VerticalAlignment.Center }; var previewLabel = new Label { Text = "Preview", Width = FirstColumnWidth, VerticalAlignment = VerticalAlignment.Center }; _previewText = new TextBox { ReadOnly = true, }; _hostText = new TextBox { Width = 150 }; _portText = new TextBox { Width = 55, Text = ServiceEndpoint.Port.ToString() }; _keyText = new TextBox { PlaceholderText = ConnectResource.Key_placeholder }; var saveChk = new CheckBox { Text = ConnectResource.Save_label }; _connectBtn = new Button { Text = "Connect" }; _cancelBtn = new Button { Text = CommonResource.Cancel }; _dialog = new Dialog { DisplayMode = DialogDisplayMode.Attached, Title = ConnectResource.Connect_to_host, DefaultButton = _connectBtn, AbortButton = _cancelBtn, Padding = new Padding(Spacing), ShowInTaskbar = false, Icon = AppImages.Xf }; var mainContainer = new TableLayout(1, 5) { Spacing = new Size(0, Spacing) }; var hostContainer = new TableLayout(4, 1) { Spacing = new Size(Spacing, 0) }; var keyContainer = new TableLayout(2, 1) { Spacing = new Size(Spacing, 0) }; var previewContainer = new TableLayout(2, 1) { Spacing = new Size(Spacing, 0) }; var buttonContainer = new TableLayout(3, 1) { Spacing = new Size(5, 0) }; _logTextArea = new TextArea { Height = LogAreaHeight, ReadOnly = true, Wrap = true, }; var expander = new Expander { Padding = new Padding(0), Expanded = true, Header = new Label { Text = "Status", Enabled = false, TextColor = Colors.Black }, Content = new Panel { Padding = new Padding(0, Spacing, 0, 0), Content = _logTextArea }, }; expander.ExpandedChanged += (s, e) => { if (expander.Expanded) { _dialog.Height += LogAreaHeight; } else { _dialog.Height -= expander.Content.Height; } }; hostContainer.Add(hostLabel, 0, 0, false, false); hostContainer.Add(_hostText, 1, 0, false, false); hostContainer.Add(portLabel, 2, 0, false, false); hostContainer.Add(_portText, 3, 0, false, false); keyContainer.Add(keyLabel, 0, 0, false, false); keyContainer.Add(_keyText, 1, 0, true, false); previewContainer.Add(previewLabel, 0, 0, false, false); previewContainer.Add(_previewText, 1, 0, true, false); buttonContainer.Add(saveChk, 0, 0, true, false); buttonContainer.Add(_cancelBtn, 1, 0, false, false); buttonContainer.Add(_connectBtn, 2, 0, false, false); mainContainer.Add(hostContainer, 0, 0, true, false); mainContainer.Add(previewContainer, 0, 1, true, false); mainContainer.Add(keyContainer, 0, 2, true, false); mainContainer.Add(buttonContainer, 0, 3, true, false); mainContainer.Add(expander, 0, 4, true, true); _dialog.DataContext = _model; _dialog.Content = mainContainer; _dialog.PreLoad += (s, e) => OnPreload(); _dialog.Closing += OnDialogClosing; _connectBtn.Bind(b => b.Enabled, _model, v => v.OkEnabled); _hostText.Bind(b => b.Text, _model, v => v.Host); _portText.Bind(b => b.Text, _model, v => v.Port); saveChk.Bind(b => b.Checked, _model, v => v.RememberSettings); _dialog.LoadComplete += (s, e) => _connectBtn.Focus(); _connectBtn.Click += OnConnectBtnClicked; _cancelBtn.Click += OnCancelBtnClicked; _hostText.KeyUp += (s, e) => SetPreviewText(); _portText.KeyUp += (s, e) => SetPreviewText(); }
public Dialog_Legend(LegendParameter parameter, Action <LegendParameter> previewAction = default) { this.Title = $"Legend Parameters - {DialogHelper.PluginName}"; this.Width = 400; this.Icon = DialogHelper.HoneybeeIcon; _vm = new LegendViewModel(parameter, this); var title = new TextBox(); var x = new Eto.Forms.NumericStepper() { MinValue = 0 }; var y = new Eto.Forms.NumericStepper() { MinValue = 0 }; var w = new Eto.Forms.NumericStepper() { MinValue = 1 }; var h = new Eto.Forms.NumericStepper() { MinValue = 1 }; var fontH = new Eto.Forms.NumericStepper() { MinValue = 1 }; var fontColor = new Button(); var decimalPlaces = new Eto.Forms.NumericStepper() { DecimalPlaces = 0, MinValue = 0 }; title.TextBinding.Bind(_vm, _ => _.Title); x.ValueBinding.Bind(_vm, _ => _.X); y.ValueBinding.Bind(_vm, _ => _.Y); w.ValueBinding.Bind(_vm, _ => _.W); h.ValueBinding.Bind(_vm, _ => _.H); fontH.ValueBinding.Bind(_vm, _ => _.FontHeight); fontColor.Bind(_ => _.BackgroundColor, _vm, _ => _.FontColor); fontColor.Command = _vm.FontColorCommand; decimalPlaces.ValueBinding.Bind(_vm, _ => _.DecimalPlaces); var minNum = new Eto.Forms.NumericStepper() { MaximumDecimalPlaces = 5 }; var maxNum = new Eto.Forms.NumericStepper() { MaximumDecimalPlaces = 5 }; var numSeg = new Eto.Forms.NumericStepper() { DecimalPlaces = 0, MinValue = 1 }; var continuous = new CheckBox(); var horizontal = new CheckBox(); minNum.ValueBinding.Bind(_vm, _ => _.Min); maxNum.ValueBinding.Bind(_vm, _ => _.Max); numSeg.ValueBinding.Bind(_vm, _ => _.NumSeg); continuous.CheckedBinding.Bind(_vm, _ => _.Continuous); horizontal.CheckedBinding.Bind(_vm, _ => _.IsHorizontal); minNum.Bind(_ => _.Enabled, _vm, _ => _.IsNumberValues); maxNum.Bind(_ => _.Enabled, _vm, _ => _.IsNumberValues); numSeg.Bind(_ => _.Enabled, _vm, _ => _.IsNumberValues); continuous.Bind(_ => _.Enabled, _vm, _ => _.IsNumberValues); var colorPanel = GenColorControl(); var tb = new TabControl(); tb.Pages.Add(new TabPage(colorPanel) { Text = "Colors" }); var general = new DynamicLayout(); general.Height = 280; general.DefaultSpacing = new Eto.Drawing.Size(5, 5); general.DefaultPadding = new Eto.Drawing.Padding(5); general.AddRow("Font height:", fontH); general.AddRow("Font color:", fontColor); general.AddRow("Location X:", x); general.AddRow("Location Y:", y); general.AddRow("Width:", w); general.AddRow("Height:", h); general.AddRow("Decimal places", decimalPlaces); general.AddRow(null, null); tb.Pages.Add(new TabPage(general) { Text = "Settings" }); var OkBtn = new Eto.Forms.Button() { Text = "OK" }; OkBtn.Click += (s, e) => { if (_vm.Validate()) { var lg = _vm.GetLegend(); this.Close(lg); } }; this.AbortButton = new Eto.Forms.Button() { Text = "Cancel" }; this.AbortButton.Click += (s, e) => { this.Close(); }; var preview = new Button() { Text = "Preview", Visible = previewAction != default }; preview.Click += (s, e) => { if (_vm.Validate()) { var lg = _vm.GetLegend(); previewAction?.Invoke(lg); } }; var layout = new Eto.Forms.DynamicLayout(); layout.DefaultSpacing = new Eto.Drawing.Size(5, 2); layout.DefaultPadding = new Eto.Drawing.Padding(4); layout.AddSeparateRow("Legend title:", title); layout.AddSeparateRow("Maximum:", maxNum); layout.AddSeparateRow("Minimum:", minNum); layout.AddSeparateRow("Number of segment:", numSeg); layout.AddSeparateRow("Continuous colors:", continuous); layout.AddSeparateRow("Horizontal:", horizontal); layout.AddSeparateRow(tb); //layout.AddSeparateRow("Font height:", fontH, null, "Font color:", fontColor); //layout.AddSeparateRow("X:", x, "Y:", y, "W", w, "H", h); layout.AddSeparateRow(null, OkBtn, this.AbortButton, null, preview); layout.AddRow(null); this.Content = layout; }