//function for playing animation public void playAnimation() { animUtils = new AGAnimationUtilsClass(); //register/unregister events for tracing camera path based on selection animEvent = (IAnimationEvents_Event)animUtils; //set animation duration if (theCamForm.animDurationTextBox.Text != "" & theCamForm.animDurationTextBox.Text != "Optional") { animEnv.AnimationDuration = Convert.ToDouble(theCamForm.animDurationTextBox.Text); } else { MessageBox.Show("Please enter animation duration", "Error"); return; } //register animation event handler animEvent.StateChanged += new IAnimationEvents_StateChangedEventHandler(myAnimationEventHandler); //enable/disable other buttons theCamForm.stopButton.Enabled = true; theCamForm.generatePathButton.Enabled = false; theCamForm.playButton.Enabled = false; animPlayer = (IAGAnimationPlayer)animUtils; animationDuration = animEnv.AnimationDuration; animPlayer.PlayAnimation(animationTracks, animEnv, null); }