protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.Parameter is AccelerScroll) { ACS = ( AccelerScroll )e.Parameter; // This will ensure the SV lambda swapping triggered in ReaderContent ACS.Delta(0); ODelta = ACS.Delta; ACS.Delta = a => ODelta(AccTest.Accelerate(a)); ForceBrake.IsChecked = ACS.ForceBrake; TrackAutoAnchor.IsChecked = ACS.TrackAutoAnchor; Brake.Value = ACS.Brake; BrakingForce.Value = ACS.BrakingForce; TerminalVelocity.Value = ACS.TerminalVelocity; BrakeOffset.Value = ACS.BrakeOffset; AccelerMultiplier.Value = ACS.AccelerMultiplier; AccTest.Accelerate(0); AccTest.Brake(ACS.BrakeOffset, ACS.Brake); ACS.StartCallibrate(); // Update by slider if (!ACS.Available) { AccelerReadings.Value = ACS.BrakeOffset + 0.5 * Brake.Value; AccelerReadings.Visibility = Visibility.Visible; Stage.Draw += Stage_Draw; } } }
private async void SetAccelerScroll() { var ACSConf = GRConfig.ContentReader.AccelerScroll; ACScroll = new AccelerScroll { ProgramBrake = true, TrackAutoAnchor = ACSConf.TrackAutoAnchor, Brake = ACSConf.Brake, BrakeOffset = ACSConf.BrakeOffset, BrakingForce = ACSConf.BrakingForce, AccelerMultiplier = ACSConf.AccelerMultiplier, TerminalVelocity = ACSConf.TerminalVelocity }; ACScroll.UpdateOrientation(App.ViewControl.DispOrientation); StringResources stx = StringResources.Load("Settings", "Message"); ToggleAcceler = UIAliases.CreateMenuFlyoutItem(stx.Text("Enabled"), new SymbolIcon(Symbol.Accept)); ToggleAcceler.Click += (s, e) => ToggleAccelerScroll(); CallibrateAcceler = new MenuFlyoutItem() { Text = stx.Text("Callibrate") }; CallibrateAcceler.Click += CallibrateAcceler_Click; AccelerMenu.Items.Add(ToggleAcceler); AccelerMenu.Items.Add(CallibrateAcceler); if (ACScroll.Available && !ACSConf.Asked) { bool EnableAccel = false; await Popups.ShowDialog(UIAliases.CreateDialog( stx.Str("EnableAccelerScroll", "Message") , () => EnableAccel = true , stx.Str("Yes", "Message"), stx.Str("No", "Message") )); ACSConf.Asked = true; ACSConf.Enable = EnableAccel; } ToggleAccelerScroll(ACSConf.Enable); UpdateAccelerDelta(); }