public void UpdateBindings() { content.Items.Clear(); var tipButton = new BindingDisplay(App.Settings?.TipButton) { MinimumSize = new Size(300, 0) }; tipButton.BindingUpdated += (sender, binding) => App.Settings.TipButton = binding; var tipPressure = new PressureSlider( "Tip Pressure", () => App.Settings.TipActivationPressure, (v) => App.Settings.TipActivationPressure = v ); var tipSettingsStack = new StackView { Items = { new Group("Tip Button", tipButton, Orientation.Horizontal, false), tipPressure } }; var tipSettings = new Group("Tip Bindings", tipSettingsStack); var penBindingsStack = new StackView(); for (int i = 0; i < App.Settings?.PenButtons.Count; i++) { var penBinding = new BindingDisplay(App.Settings?.PenButtons[i]) { MinimumSize = new Size(300, 0), Tag = i }; penBinding.BindingUpdated += (sender, binding) => { var index = (int)(sender as BindingDisplay).Tag; App.Settings.PenButtons[index] = binding; }; var penBindingGroup = new Group($"Pen Button {i + 1}", penBinding, Orientation.Horizontal, false); penBindingsStack.AddControl(penBindingGroup); } var penBindingSettings = new Group("Pen Button Bindings", penBindingsStack); var penSettings = new StackLayout { Orientation = Orientation.Horizontal, VerticalContentAlignment = VerticalAlignment.Stretch, Items = { new StackLayoutItem(tipSettings, true), new StackLayoutItem(penBindingSettings, true) } }; content.AddControl(penSettings); var auxBindingsStack = new StackView(); for (int i = 0; i < App.Settings?.AuxButtons.Count; i++) { var auxBinding = new BindingDisplay(App.Settings?.AuxButtons[i]) { MinimumSize = new Size(300, 0), Tag = i }; auxBinding.BindingUpdated += (sender, Binding) => { var index = (int)(sender as BindingDisplay).Tag; App.Settings.AuxButtons[index] = Binding; }; var auxBindingGroup = new Group($"Auxiliary Button {i + 1}", auxBinding, Orientation.Horizontal, false); auxBindingsStack.AddControl(auxBindingGroup); } var auxBindingSettings = new Group("Auxiliary Button Bindings", auxBindingsStack) { TitleHorizontalAlignment = HorizontalAlignment.Center }; content.AddControl(auxBindingSettings); }
public void UpdateBindings() { content.Items.Clear(); var tipButton = new BindingDisplay(App.Settings?.TipButton); tipButton.BindingUpdated += (sender, binding) => App.Settings.TipButton = binding; var tipPressure = new PressureSlider( "Tip Pressure", () => App.Settings.TipActivationPressure, (v) => App.Settings.TipActivationPressure = v ); var tipSettingsStack = new StackView { Items = { tipButton, tipPressure } }; var tipSettings = new GroupBoxBase("Tip Bindings", tipSettingsStack); content.AddControl(tipSettings, true); var penBindingsStack = new StackView(); for (int i = 0; i < App.Settings?.PenButtons.Count; i++) { var penBinding = new BindingDisplay(App.Settings?.PenButtons[i]) { Tag = i }; penBinding.BindingUpdated += (sender, binding) => { var index = (int)(sender as BindingDisplay).Tag; App.Settings.PenButtons[index] = binding; }; var penBindingGroup = new GroupBoxBase($"Pen Button {i + 1}", penBinding); penBindingsStack.AddControl(penBindingGroup); } var penBindingSettings = new GroupBoxBase("Pen Button Bindings", penBindingsStack); content.AddControl(penBindingSettings, true); var auxBindingsStack = new StackView(); for (int i = 0; i < App.Settings?.AuxButtons.Count; i++) { var auxBinding = new BindingDisplay(App.Settings?.AuxButtons[i]) { Tag = i }; auxBinding.BindingUpdated += (sender, Binding) => { var index = (int)(sender as BindingDisplay).Tag; App.Settings.AuxButtons[index] = Binding; }; var auxBindingGroup = new GroupBoxBase($"Auxiliary Button {i + 1}", auxBinding); auxBindingsStack.AddControl(auxBindingGroup); } var auxBindingSettings = new GroupBoxBase("Auxiliary Button Bindings", auxBindingsStack); content.AddControl(auxBindingSettings, true); }