AnimatGuiCtrls.Controls.TimeRuler.AddKeyFrame C# (CSharp) Method

AddKeyFrame() private method

private AddKeyFrame ( Point pMousePos ) : void
pMousePos Point
return void
		private void AddKeyFrame(Point pMousePos)
		{
			try
			{
				int iMousePosition = ((this.Orientation == enumOrientation.orHorizontal) ? pMousePos.X : pMousePos.Y);
				long lMillisecond = CalculateMillisecondValue(iMousePosition);

				if( (lMillisecond >= _lStartMillisecond) && (lMillisecond <= _lEndMillisecond) )
				{
					if(lMillisecond <= _lCurrentMillisecond)
						throw new System.Exception("You can not add new keyframes that occur before the current simulation time.");

					KeyFrame keyFrame = new KeyFrame(lMillisecond);
					this.KeyFrames.Add(keyFrame);

					OnKeyFrameAdded(keyFrame);

					SelectedKeyFrame = keyFrame;
				}
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}