async void Accelerometer_Shaken(Accelerometer sender, AccelerometerShakenEventArgs args) { var dispatcher = App.Dispatcher; await dispatcher.RunAsync(CoreDispatcherPriority.Normal, (DispatchedHandler)(() => { _shaken(this, args); })); }
void accelerometer_Shaken(Accelerometer sender, AccelerometerShakenEventArgs args) { Deployment.Current.Dispatcher.BeginInvoke(() => { statusTextBlock.Text = "手机在摇动 时间点" + args.Timestamp.DateTime.ToLongTimeString(); }); }
private async void AccelerometerOnShaken(Sensor.Accelerometer sender, Sensor.AccelerometerShakenEventArgs args) { await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { ShakeCount = ShakeCount + 1; }); }
async void accelerometer_Shaken(Accelerometer sender, AccelerometerShakenEventArgs args) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { shakes++; ShakeCount.Text = shakes.ToString(); }); }
/// <summary> /// This is the event handler for Shaken events. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> async private void Shaken(object sender, AccelerometerShakenEventArgs e) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { _shakeCount++; ScenarioOutputText.Text = _shakeCount.ToString(); }); }
private void OnShake(Accelerometer sender, AccelerometerShakenEventArgs args) { throw new NotImplementedException(); }
void MainPage_Shaken( Accelerometer sender, AccelerometerShakenEventArgs args ) { }
async void accelerometerShaken(Accelerometer sender, AccelerometerShakenEventArgs args) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { GetStopByUri(lastStop.Uri); }); }
void accelerometer_Shaken(Accelerometer sender, AccelerometerShakenEventArgs args) { }
private void OnShaken(Accelerometer sender, AccelerometerShakenEventArgs args) { ((MainPageVM) DataContext).WasShaken(); Path[] paths; if (zoom.IsZoomedInViewActive) { paths = GetVisiblePaths(); } else { paths = GetAllPaths(); } int MaxParts = 100; foreach (Path geo in paths) { for (int i = 0; i < MaxParts; i++) { // The geometry allows us to get the position and // the tangent at a given fraction length. Geometry flattened = GetFlattenedPathGeometry(geo.Data); Point tangent; Point point; GetPointAtFractionLength(flattened, (i/MaxParts), out point, out tangent); // Create the visual representation of the broken part. var rectangle = new Rectangle { Width = 8, Height = 3, Fill = new SolidColorBrush(Colors.Black), RadiusX = 1.5, RadiusY = 1.5 }; // Add the rectangle to the explosion area and set the position Canvas.SetLeft(rectangle, point.X - (rectangle.Width/2)); Canvas.SetTop(rectangle, point.Y - (rectangle.Height/2)); ((Canvas) geo.Parent).Children.Add(rectangle); // For a good look, the rectangle shall be rotated, // based on the tangent of the point. var v = new Vector(tangent.X, tangent.Y); v.Normalize(); double angle = Vector.AngleBetween(new Vector(1, 0), v); rectangle.RenderTransform = new RotateTransform { Angle = angle, CenterX = rectangle.Width/2, CenterY = rectangle.Height/2 }; } } }
void ac_Shaken(Accelerometer sender, AccelerometerShakenEventArgs args) { throw new NotImplementedException(); }
private void OnShaken(Accelerometer sender, AccelerometerShakenEventArgs args) { var dispatcher = Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher; var runOperation = dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { var content = Window.Current.Content; Frame rootFrame = content as Frame; if (easterEggState) { rootFrame.Navigate(typeof(ItemsPage)); } else { rootFrame.Navigate(typeof(EasterEggPage)); } easterEggState = !easterEggState; }); }