void ChangeFrame(object sender, FrameChangedEventArgs e) { // Unsubscribe to event handler m_currentFrame.OnFrameChanged -= ChangeFrame; // Update de frame this.MainFrame.NavigationService.Navigate(new System.Uri(e.nextFramePath, UriKind.Relative)); }
/// <summary> /// Event fired everytime the user selects a frame on the timeline /// </summary> /// <param name="sender">Object that fired this event</param> /// <param name="newFrame">The new frame selected on the timeline control</param> private void tlc_timeline_FrameChanged(object sender, FrameChangedEventArgs newFrame) { _currentGif.CurrentFrame = newFrame.NewFrame - 1; UpdateFrameText(); AnimationTimer.Stop(); AnimationTimer.Interval = 15; AnimationTimer.Start(); }
private void MachineFrameChanged(object sender, FrameChangedEventArgs e) { if (!e.Frame.Coordinate.NotEmpty()) { return; } var gModalGroup1 = _machineSimulator.ModalGCodes.Single(c => GCodeExpression.MutuallyExclusiveCodes[0].Contains(c)); if (_machineSimulator.OldCoordinates.X != null && _machineSimulator.OldCoordinates.Y != null && _machineSimulator.OldCoordinates.Z != null) { var oldCoordinates = new Point3D(_machineSimulator.OldCoordinates.X.Value, _machineSimulator.OldCoordinates.Y.Value, _machineSimulator.OldCoordinates.Z.Value); var centers = new ArcCenters { I = e.Frame.IValue, J = e.Frame.JValue, K = e.Frame.KValue }; bool absolute = !_machineSimulator.ModalGCodes.Contains(91); var newCoordinates = new Point3D(CalculateNewCoordinate(_machineSimulator.CurrentCoordinates.X, oldCoordinates.X, absolute), CalculateNewCoordinate(_machineSimulator.CurrentCoordinates.Y, oldCoordinates.Y, absolute), CalculateNewCoordinate(_machineSimulator.CurrentCoordinates.Z, oldCoordinates.Z, absolute)); var radius = e.Frame.RValue; ScaleCoordinates(10, ref oldCoordinates, ref newCoordinates, ref centers, ref radius); Draw(gModalGroup1, oldCoordinates, newCoordinates, radius, centers, e); } }
// // Timeline frame changed // private void tlc_timeline_FrameChanged(object sender, FrameChangedEventArgs e) { ChangeFrame(e.NewFrame - 1); }
// // Timeline frame changed // private void tc_timeline_FrameChanged(object sender, FrameChangedEventArgs eventArgs) { SetDisplayFrame(_animation.GetFrameAtIndex(eventArgs.NewFrame - 1)); }
private void Draw(float gModalGroup1, Point3D oldCoordinates, Point3D newCoordinates, float?radius, ArcCenters centers, FrameChangedEventArgs e) { ArcInterpolation interpolation; switch (gModalGroup1) { case 0: //Rapid AddLine(oldCoordinates.ToVector3(), newCoordinates.ToVector3(), RapidGeometry); break; case 1: //Linear AddLine(oldCoordinates.ToVector3(), newCoordinates.ToVector3(), LinearGeometry); break; case 2: //Arc clockwise interpolation = e.Frame.RValue.HasValue ? new ArcInterpolation(oldCoordinates, radius: radius.Value, newCoordinates, true) : new ArcInterpolation(oldCoordinates, centers, newCoordinates, true); for (int i = 0; i <= 100; i += 5) { var point = interpolation.GetArcCoordinatesEx(i); AddLine(oldCoordinates.ToVector3(), point.ToVector3(), LinearGeometry); oldCoordinates = point; } AddLine(oldCoordinates.ToVector3(), newCoordinates.ToVector3(), LinearGeometry); break; case 3: //Arc Counter-clockwise if (e.Frame.RValue.HasValue) { interpolation = new ArcInterpolation(oldCoordinates, radius: radius.Value, newCoordinates, false); } else { interpolation = new ArcInterpolation(oldCoordinates, centers, newCoordinates, false); } for (int i = 100; i >= 0; i -= 5) { var point = interpolation.GetArcCoordinatesEx(i); AddLine(oldCoordinates.ToVector3(), point.ToVector3(), LinearGeometry); oldCoordinates = point; } AddLine(oldCoordinates.ToVector3(), newCoordinates.ToVector3(), LinearGeometry); break; } }