private void btnStart_Click(object sender, EventArgs e)
{
_pictureSize = ParameterDict.Current.GetDouble("Animation.Size");
_animationSmooth = ParameterDict.Current.GetBool("Animation.Smooth");
_inAnimation = true;
ParameterInput.MainParameterInput.SetButtonsToStart();
CreateAnimationSteps(tbAnimationDescription.Text);
if (_animationSteps.Steps.Count == 0)
return;
btnStart.Enabled = false;
btnStop.Enabled = true;
btnStop.Visible = true;
_animationAbort = false;
lblAnimationProgress.Text = "run ...";
// Prepare AnimationHistory
ParameterHistory animationHistory = new ParameterHistory();
for (int i = 0; i < _animationSteps.Steps.Count; i++)
{
AnimationPoint ap = _animationSteps.Steps[i];
_dataPerTime.Load(ap.Time);
ParameterDict.Current.SetDouble("View.Size", _pictureSize);
animationHistory.Save();
}
// Compute each Animation frame.
for (int i = 1; i < _animationSteps.Steps.Count; i++)
{
AnimationPoint ap1 = _animationSteps.Steps[i - 1];
AnimationPoint ap2 = _animationSteps.Steps[i];
ComputeAnimationPart(ap1.Time, ap2.Time, ap2.Steps, animationHistory,i-1);
if (_animationAbort)
break;
}
if (_animationSteps.Steps.Count > 0)
{
ComputeAnimationPart(_animationSteps.Steps[_animationSteps.Steps.Count - 1].Time, _animationSteps.Steps[_animationSteps.Steps.Count - 1].Time, 1, animationHistory, _animationSteps.Steps.Count-1);
}
btnStop.Visible = false;
btnStart.Enabled = true;
lblAnimationProgress.Text = "ready";
_animationAbort = false;
_inAnimation = false;
ParameterInput.MainParameterInput.SetButtonsToStop();
}