public MaskedTextBoxSection() { Spacing = 5; Padding = new Padding(10); var tb = new NumericMaskedTextBox <decimal> { Value = 123.456M }; var l = new Label(); l.TextBinding.Bind(Binding.Property(tb, c => c.Value).Convert(r => "Value: " + Convert.ToString(r))); Items.Add(new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { tb, l } }); Items.Add(new MaskedTextBox(new FixedMaskedTextProvider("(999) 000-0000")) { ShowPromptOnFocus = true, PlaceholderText = "(123) 456-7890" }); Items.Add(new MaskedTextBox <DateTime>(new FixedMaskedTextProvider <DateTime>("&&/90/0000") { ConvertToValue = DateTime.Parse })); Items.Add(new MaskedTextBox(new FixedMaskedTextProvider(">L0L 0L0"))); Items.Add(new MaskedTextBox { InsertMode = InsertKeyMode.Toggle }); }
private Control BuildBuffLayout() { var buffIdTextBox = new NumericMaskedTextBox <uint> { Value = 0 }; buffIdTextBox.ValueBinding.Bind(() => BuffId, x => BuffId = x); var buffIdCheckbox = new CheckBox { Checked = false }; buffIdCheckbox.CheckedBinding.Bind(() => BuffIdEnabled, x => BuffIdEnabled = x ?? false); var filterLayout = new DynamicLayout(); filterLayout.BeginHorizontal(); { filterLayout.BeginGroup("Buff"); { filterLayout.AddRow("Buff ID", buffIdTextBox, buffIdCheckbox, null); } filterLayout.EndGroup(); filterLayout.AddRow(null); } filterLayout.EndHorizontal(); return(filterLayout); }
private static NumericMaskedTextBox <T> GetNumericMaskedTextBox <T>(PropertyInfo property, PluginSetting setting) { var tb = new NumericMaskedTextBox <T> { Value = GetSetting <T>(property, setting) }; tb.ValueChanged += (sender, e) => setting.SetValue(tb.Value); return(tb); }
public MaskedTextBoxSection() { Spacing = 5; Padding = new Padding(10); var tb = new NumericMaskedTextBox<decimal> { Value = 123.456M }; var l = new Label(); l.TextBinding.Bind(Binding.Property(tb, c => c.Value).Convert(r => "Value: " + Convert.ToString(r))); Items.Add(new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { tb, l } }); Items.Add(new MaskedTextBox(new FixedMaskedTextProvider("(999) 000-0000")) { ShowPromptOnFocus = true, PlaceholderText = "(123) 456-7890" }); Items.Add(new MaskedTextBox<DateTime>(new FixedMaskedTextProvider<DateTime>("&&/90/0000") { ConvertToValue = DateTime.Parse })); Items.Add(new MaskedTextBox(new FixedMaskedTextProvider(">L0L 0L0"))); Items.Add(new MaskedTextBox { InsertMode = InsertKeyMode.Toggle }); }
public LogsSettingsPage() { Text = "Logs"; var dialog = new SelectFolderDialog(); locationTextBox = new TextBox { ReadOnly = true, PlaceholderText = "Log Location", }; var locationDialogButton = new Button { Text = "Select Log Directory" }; locationDialogButton.Click += (sender, args) => { if (dialog.ShowDialog(this) == DialogResult.Ok) { locationTextBox.Text = dialog.Directory; } }; minDurationCheckBox = new CheckBox { Text = "Exclude short logs", Checked = Settings.MinimumLogDurationSeconds.HasValue, ThreeState = false }; minDurationTextBox = new NumericMaskedTextBox <int> { Value = Settings.MinimumLogDurationSeconds ?? 5, Enabled = minDurationCheckBox.Checked ?? false, Width = 50 }; minDurationCheckBox.CheckedChanged += (sender, args) => minDurationTextBox.Enabled = minDurationCheckBox.Checked ?? false; var durationLabel = new Label { Text = "Minimum duration in seconds:", VerticalAlignment = VerticalAlignment.Center }; var layout = new DynamicLayout(); layout.BeginVertical(spacing: new Size(5, 5), padding: new Padding(10)); { layout.BeginGroup("Log directory", new Padding(5), new Size(5, 5)); { layout.AddRow(new Label { Text = "The directory in which your arcdps logs are stored. Subdirectories " + "are also searched, do not choose a parent directory containing more " + "irrelevant files unless you like extra waiting.", Wrap = WrapMode.Word, Height = 70 }); layout.AddRow(locationTextBox); layout.AddRow(locationDialogButton); } layout.EndGroup(); layout.BeginGroup("Log filters", new Padding(5), new Size(5, 5)); { layout.AddRow(minDurationCheckBox); layout.AddRow(durationLabel, minDurationTextBox, null); } layout.EndGroup(); } layout.EndVertical(); Content = layout; if (Settings.LogRootPaths.Any()) { if (Settings.LogRootPaths.Count > 1) { // There is currently no interface for adding more than one log directory, so this would end up // losing some quietly when that is implemented. throw new NotImplementedException(); } string logRootPath = Settings.LogRootPaths.Single(); if (Directory.Exists(logRootPath)) { dialog.Directory = logRootPath; } locationTextBox.Text = logRootPath; } else { string defaultDirectory = GetDefaultLogDirectory(); if (Directory.Exists(defaultDirectory)) { dialog.Directory = defaultDirectory; locationTextBox.Text = defaultDirectory; } } }
public void updateRoomPanel(RoomEntity hbObjEntity) { var room = hbObjEntity.HBObject; var layout = new DynamicLayout { }; layout.Spacing = new Size(5, 5); layout.Padding = new Padding(10); layout.DefaultSpacing = new Size(2, 2); layout.AddSeparateRow(new Label { Text = $"ID: {room.Name}" }); layout.AddSeparateRow(new Label { Text = "Name:" }); var modelNameTextBox = new TextBox() { }; room.DisplayName = room.DisplayName ?? string.Empty; modelNameTextBox.TextBinding.Bind(room, m => m.DisplayName); layout.AddSeparateRow(modelNameTextBox); layout.AddSeparateRow(new Label { Text = "Properties:" }); var rmPropBtn = new Button { Text = "Room Energy Properties" }; rmPropBtn.Click += (s, e) => RmPropBtn_Click(hbObjEntity); layout.AddSeparateRow(rmPropBtn); var facesListBox = new ListBox(); facesListBox.Height = 120; var faces = hbObjEntity.HBFaces; if (faces != null) { var faceItems = faces.Select(_ => new ListItem() { Text = _.DisplayName ?? _.Name, Tag = _ }); facesListBox.Items.AddRange(faceItems); } layout.AddSeparateRow(new Label { Text = $"Faces: (total: {room.Faces.Count})" }); layout.AddSeparateRow(facesListBox); layout.AddSeparateRow(new Label { Text = "IndoorShades:" }); var inShadesListBox = new ListBox(); inShadesListBox.Height = 50; var inShds = room.IndoorShades; if (inShds != null) { var idShds = inShds.Select(_ => new ListItem() { Text = _.DisplayName ?? _.Name, Tag = _ }); inShadesListBox.Items.AddRange(idShds); } layout.AddSeparateRow(inShadesListBox); layout.AddSeparateRow(new Label { Text = "OutdoorShades:" }); var outShadesListBox = new ListBox(); outShadesListBox.Height = 50; var outShds = room.OutdoorShades; if (outShds != null) { var outShdItems = outShds.Select(_ => new ListItem() { Text = _.DisplayName ?? _.Name, Tag = _ }); outShadesListBox.Items.AddRange(outShdItems); } layout.AddSeparateRow(outShadesListBox); layout.AddSeparateRow(new Label { Text = "Multiplier:" }); var multiplierNum = new NumericMaskedTextBox <int>() { }; multiplierNum.TextBinding.Bind(Binding.Delegate(() => room.Multiplier.ToString(), v => room.Multiplier = CheckIfNum(v))); int CheckIfNum(string numString) { var isNum = int.TryParse(numString, out int numValue); return(isNum ? numValue : 0); } layout.AddSeparateRow(multiplierNum); layout.Add(null); var data_button = new Button { Text = "Honeybee Data" }; data_button.Click += (sender, e) => Dialogs.ShowEditBox("Honeybee Data", "Honeybee Data can be shared across all platforms.", room.ToJson(), true, out string outJson); layout.AddSeparateRow(data_button, null); this.Content = layout; //layout.up void RmPropBtn_Click(Entities.RoomEntity roomEnt) { var roomEnergyProperties = RoomEnergyPropertiesAbridged.FromJson(roomEnt.GetEnergyProp().ToJson()); var dialog = new UI.Dialog_RoomEnergyProperty(roomEnergyProperties); dialog.RestorePosition(); var dialog_rc = dialog.ShowModal(RhinoEtoApp.MainWindow); dialog.SavePosition(); if (dialog_rc != null) { //replace brep in order to add an undo history var undo = Rhino.RhinoDoc.ActiveDoc.BeginUndoRecord("Set Honeybee room energy properties"); var dup = roomEnt.HostObjRef.Brep().DuplicateBrep(); dup.TryGetRoomEntity().HBObject.Properties.Energy = dialog_rc; Rhino.RhinoDoc.ActiveDoc.Objects.Replace(roomEnt.HostObjRef.ObjectId, dup); Rhino.RhinoDoc.ActiveDoc.EndUndoRecord(undo); } } }
public MainWindow() { config = LibreLancer.GameConfig.Create(); Title = "Librelancer"; var wrap = new TableLayout(); wrap.Rows.Add(new TableRow(new HeaderBar())); var layout = new TableLayout(); //Freelancer Path freelancerPath = new TextBox() { Text = config.FreelancerPath }; var flpath = new TableLayout() { Padding = 2, Spacing = new Size(2, 0) }; flpath.Rows.Add(new TableRow( new Label() { Text = "Freelancer Directory:" }, new TableCell(freelancerPath, true), new Button(FolderBrowse) { Text = ".." } )); layout.Rows.Add(flpath); //Width & Height bufferWidth = new NumericMaskedTextBox <int>() { Value = config.BufferWidth }; bufferHeight = new NumericMaskedTextBox <int>() { Value = config.BufferHeight }; var res = new TableLayout() { Padding = 2, Spacing = new Size(2, 0) }; res.Rows.Add(new TableRow( new Label() { Text = "Resolution:" }, new TableCell(bufferWidth) { ScaleWidth = true }, new Label() { Text = "x" }, new TableCell(bufferHeight) { ScaleWidth = true })); layout.Rows.Add(res); //Options skipIntroMovies = new CheckBox() { Text = "Skip Intro Movies" }; if (Program.introForceDisable) { skipIntroMovies.Enabled = false; skipIntroMovies.Checked = true; } else { skipIntroMovies.Checked = !config.IntroMovies; } layout.Rows.Add(skipIntroMovies); muteMusic = new CheckBox() { Text = "Mute Music", Checked = config.MuteMusic }; layout.Rows.Add(muteMusic); vsync = new CheckBox() { Text = "VSync", Checked = config.VSync }; layout.Rows.Add(vsync); //Spacer layout.Rows.Add(new TableRow() { ScaleHeight = true }); //Launch var end = new TableLayout() { Padding = 2, Spacing = new Size(2, 0) }; end.Rows.Add(new TableRow(new TableCell() { ScaleWidth = true }, new Button(LaunchClicked) { Text = "Launch" })); layout.Rows.Add(end); wrap.Rows.Add(new TableRow(layout) { ScaleHeight = true }); Content = wrap; }
public MainWindow() { config = LibreLancer.GameConfig.Create(); Title = "Librelancer"; var wrap = new TableLayout(); wrap.Rows.Add(new TableRow(new HeaderBar())); var layout = new TableLayout(); //Freelancer Path freelancerPath = new TextBox() { Text = config.FreelancerPath }; var flpath = new TableLayout() { Padding = 2, Spacing = new Size(2, 0) }; flpath.Rows.Add(new TableRow( new Label() { Text = "Freelancer Directory:", VerticalAlignment = VerticalAlignment.Center }, new TableCell(freelancerPath, true), new Button(FolderBrowse) { Text = ".." } )); layout.Rows.Add(flpath); //Width & Height bufferWidth = new NumericMaskedTextBox <int>() { Value = config.BufferWidth }; bufferHeight = new NumericMaskedTextBox <int>() { Value = config.BufferHeight }; var res = new TableLayout() { Padding = 2, Spacing = new Size(2, 0) }; res.Rows.Add(new TableRow( new Label() { Text = "Resolution:", VerticalAlignment = VerticalAlignment.Center }, new TableCell(bufferWidth) { ScaleWidth = true }, new Label() { Text = "x", VerticalAlignment = VerticalAlignment.Center }, new TableCell(bufferHeight) { ScaleWidth = true })); layout.Rows.Add(res); //Options skipIntroMovies = new CheckBox() { Text = "Skip Intro Movies" }; if (Program.introForceDisable) { skipIntroMovies.Enabled = false; skipIntroMovies.Checked = true; } else { skipIntroMovies.Checked = !config.IntroMovies; } layout.Rows.Add(skipIntroMovies); masterVolume = new Slider() { MinValue = 0, MaxValue = 1000, Value = (int)(config.MasterVolume * 1000), Orientation = Orientation.Horizontal, TickFrequency = 0, SnapToTick = false, Style = "volslider" }; var layoutMaster = new TableLayout( new TableRow(new Label() { Text = "Master Volume: ", VerticalAlignment = VerticalAlignment.Center }, masterVolume) ); layout.Rows.Add(layoutMaster); sfxVolume = new Slider() { MinValue = 0, MaxValue = 1000, Value = (int)(config.SfxVolume * 1000), Orientation = Orientation.Horizontal, TickFrequency = 0, SnapToTick = false, Style = "volslider" }; var layoutSfx = new TableLayout( new TableRow(new Label() { Text = "Sfx Volume: ", VerticalAlignment = VerticalAlignment.Center }, sfxVolume) ); layout.Rows.Add(layoutSfx); musicVolume = new Slider() { MinValue = 0, MaxValue = 1000, Value = (int)(config.MusicVolume * 1000), Orientation = Orientation.Horizontal, TickFrequency = 0, SnapToTick = false, Style = "volslider" }; var layoutMusic = new TableLayout( new TableRow(new Label() { Text = "Music Volume: ", VerticalAlignment = VerticalAlignment.Center }, musicVolume) ); layout.Rows.Add(layoutMusic); vsync = new CheckBox() { Text = "VSync", Checked = config.VSync }; layout.Rows.Add(vsync); //Spacer layout.Rows.Add(new TableRow() { ScaleHeight = true }); //Launch var end = new TableLayout() { Padding = 2, Spacing = new Size(2, 0) }; end.Rows.Add(new TableRow(new TableCell() { ScaleWidth = true }, new Button(LaunchClicked) { Text = "Launch" })); layout.Rows.Add(end); wrap.Rows.Add(new TableRow(layout) { ScaleHeight = true }); Content = wrap; }
Control BuildContent() { return(new TableLayout { Spacing = new Eto.Drawing.Size(5, 5), Rows = { new TableRow(new Label { Text = "TCP Listener Mode", Font = SystemFonts.Bold(), }), new TableRow(new Label { Text = "Ip Address:" }, (_textTcpListenerIp = new TextBox{ PlaceholderText = "e.g. 127.0.0.1" })), new TableRow(new Label { Text = "Port:" }, (_textTcpListenerPort = new NumericMaskedTextBox <int>{ PlaceholderText = "e.g. 8080" })), new TableRow((_btnResetTcpListener = new Button{ Text = "Reset TCP Listener" }), null), new TableRow(), new TableRow(new Label { Text = "TCP Client Mode", Font = SystemFonts.Bold(), }), new TableRow(new Label { Text = "Ip Address:" }, (_textTcpClientIp = new TextBox{ PlaceholderText = "e.g. 127.0.0.1" })), new TableRow(new Label { Text = "Port:" }, (_textTcpClientPort = new NumericMaskedTextBox <int>{ PlaceholderText = "e.g. 8080" })), new TableRow((_btnResetTcpClient = new Button{ Text = "Reset TCP Client" }), null), new TableRow(), new TableRow(new Label { Text = "Serial COM Mode", Font = SystemFonts.Bold(), }), new TableRow(new Label { Text = "Baud Rate" }, (_dropDownBaudRate = new ComboBox{ })), new TableRow(new Label { Text = "Handshake" }, (_dropDownHandshake = new EnumDropDown <Handshake>{ })), new TableRow(new Label { Text = "Parity" }, (_dropDownParity = new EnumDropDown <Parity>{ })), new TableRow(new Label { Text = "Data Bits" }, (_radDataBits = new DropDown{ })), new TableRow(new Label { Text = "Stop Bits" }, (_radStopBits = new EnumDropDown <StopBits>{ })), new TableRow(new Label { Text = "Enable Dtr" }, (_chkDtr = new CheckBox{ })), new TableRow(new Label { Text = "Enable Rts" }, (_chkRts = new CheckBox{ })), new TableRow((_btnResetSerial = new Button{ Text = "Reset Serial" }), null), new TableRow(), null, }, }); }
protected override async void OnLoadComplete(EventArgs e) { base.OnLoadComplete(e); topGroup = new Group { Content = top = new NumericMaskedTextBox <float> { PlaceholderText = "0" } }; leftGroup = new Group { Content = left = new NumericMaskedTextBox <float> { PlaceholderText = "0" } }; bottomGroup = new Group { Content = bottom = new NumericMaskedTextBox <float> { PlaceholderText = "0" } }; rightGroup = new Group { Content = right = new NumericMaskedTextBox <float> { PlaceholderText = "0" } }; this.Content = new StackLayout { Orientation = Orientation.Vertical, HorizontalContentAlignment = HorizontalAlignment.Stretch, Padding = 5, Spacing = 5, Items = { new Group { Text = "Converter", Content = converterList, Orientation = Orientation.Horizontal }, new StackLayoutItem { Expand = true, Control = new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { new StackLayoutItem { Expand = true, Control = new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Stretch, Spacing = 5, Items = { topGroup, leftGroup } } }, new StackLayoutItem { Expand = true, Control = new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Stretch, Spacing = 5, Items = { bottomGroup, rightGroup } } } } } }, new StackLayoutItem { HorizontalAlignment = HorizontalAlignment.Right, Control = applyButton = new Button((sender, e) => ConvertArea()) { Text = "Apply", Enabled = false } } } }; var tablet = await App.Driver.Instance.GetTablet(); SelectConverterForTablet(tablet); }
public MaskedTextBoxSection() { DefaultSpacing = new Size(5, 5); Padding = new Padding(10); var enabledCheckBox = new CheckBox { Text = "Enabled", Checked = true }; enabledCheckBox.CheckedChanged += (sender, e) => Set(m => m.Enabled = enabledCheckBox.Checked == true); var readOnlyCheckBox = new CheckBox { Text = "ReadOnly", Checked = false }; readOnlyCheckBox.CheckedChanged += (sender, e) => Set(m => m.ReadOnly = readOnlyCheckBox.Checked == true); var tb = new NumericMaskedTextBox <double> { Value = rememberValue ? lastValue : 123.456 }; tb.ValueChanged += (sender, e) => lastValue = tb.Value; var l = new Label(); l.TextBinding.Bind(Binding.Property(tb, c => c.Value).Convert(r => "Value: " + Convert.ToString(r))); var cultureSelector = new CultureDropDown(); cultureSelector.SelectedValueBinding.Bind(tb, s => s.Culture); var rememberCheckBox = new CheckBox { Text = "Remember Value", Checked = rememberValue }; rememberCheckBox.CheckedChanged += (sender, e) => rememberValue = rememberCheckBox.Checked == true; AddAutoSized(enabledCheckBox); AddAutoSized(readOnlyCheckBox); BeginGroup("FixedMaskedTextProvider", padding: 10); AddAutoSized(new MaskedTextBox(new FixedMaskedTextProvider("(999) 000-0000")) { ShowPromptMode = ShowPromptMode.OnFocus, PlaceholderText = "(123) 456-7890" }); AddAutoSized(new MaskedTextBox <DateTime>(new FixedMaskedTextProvider <DateTime>("&&/90/0000") { ConvertToValue = DateTime.Parse })); AddAutoSized(new MaskedTextBox(new FixedMaskedTextProvider(">L0L 0L0"))); AddAutoSized(new MaskedTextBox { InsertMode = InsertKeyMode.Toggle }); EndGroup(); BeginGroup("NumericMaskedTextBox<double>", padding: 10); AddSeparateRow(tb, l, rememberCheckBox, null); AddSeparateRow("Culture:", cultureSelector, null); BeginHorizontal(); EndHorizontal(); EndGroup(); AddSpace(); }
public Dialog_HBModel(Entities.ModelEntity modelEntity) { try { var dup = modelEntity.Duplicate(); var hbModel = dup.HBObject; Padding = new Padding(5); Resizable = true; Title = "Honeybee Rhino PlugIn"; WindowStyle = WindowStyle.Default; MinimumSize = new Size(450, 620); DefaultButton = new Button { Text = "OK" }; DefaultButton.Click += (sender, e) => Close(dup); 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(null, this.DefaultButton, this.AbortButton, null) } }; //Name hbModel.DisplayName = hbModel.DisplayName ?? string.Empty; var modelNameTextBox = new TextBox() { }; modelNameTextBox.TextBinding.Bind(hbModel, m => m.DisplayName); //NorthAngle var northNum = new NumericMaskedTextBox <double>() { }; northNum.TextBinding.Bind(Binding.Delegate(() => hbModel.NorthAngle.ToString(), v => hbModel.NorthAngle = CheckIfNum(v))); //Properties //Energy var energyProp = hbModel.Properties.Energy; //TerrainType var terrainTypeDP = new EnumDropDown <HB.ModelEnergyProperties.TerrainTypeEnum>(); terrainTypeDP.SelectedValueBinding.Bind(Binding.Delegate(() => energyProp.TerrainType.Value, v => energyProp.TerrainType = v)); //Get constructions var gloConstrSetDP = DialogHelper.MakeDropDown(hbModel.Properties.Energy.GlobalConstructionSet, (v) => hbModel.Properties.Energy.GlobalConstructionSet = v?.Name, hbModel.Properties.Energy.ConstructionSets, hbModel.Properties.Energy.GlobalConstructionSet); ////Construction Set list //var ConstructionSetsListBox = new ListBox(); //ConstructionSetsListBox.Height = 60; //ConstructionSetsListBox.bin //foreach (var item in hbModel.Properties.Energy.ConstructionSets) //{ // .Add(new ListItem() { Text = $"Room_{ item.Value.Guid }" }); //} //Room list var rooms = dup.RoomEntitiesWithoutHistory; var roomListBox = new ListBox(); roomListBox.Height = 100; foreach (var item in rooms) { var room = item.TryGetRoomEntity().HBObject; var displayName = room.DisplayName ?? string.Empty; roomListBox.Items.Add(new ListItem() { Text = displayName }); } //Shade list var shades = dup.OrphanedShadesWithoutHistory; var shadeListBox = new ListBox(); shadeListBox.Height = 100; foreach (var item in shades) { var displayName = item.TryGetShadeEntity().HBObject.DisplayName ?? string.Empty; shadeListBox.Items.Add(new ListItem() { Text = displayName }); } //Create layout Content = new TableLayout { Padding = new Padding(10), Spacing = new Size(5, 5), Rows = { new Label() { Text = $"ID: {hbModel.Name}" }, new Label() { Text = "Model Name:" }, modelNameTextBox, new Label() { Text = "Terrain Type:" }, terrainTypeDP, new Label() { Text = "Global Construction Set:" }, gloConstrSetDP, new Label() { Text = "North Angle:" }, northNum, new Label() { Text = $"Rooms: [total: {rooms.Count()}]" }, roomListBox, new Label() { Text = $"Shades:" }, shadeListBox, new TableRow(buttons), null } }; } catch (Exception e) { Rhino.RhinoApp.WriteLine(e.Message); } }