예제 #1
0
		/// <summary>
		/// AboutBox constructor
		/// </summary>
		public AboutBox()
		{
			InitializeComponent();
			Loaded += AboutBox_Loaded;
			Unloaded += AboutBox_Unloaded;
			clickContext = this;
		}
예제 #2
0
        /// <summary>
        /// Opens an AboutBox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OpenAboutBox(object sender, RoutedEventArgs e)
        {
            var aboutBox = new AboutBox { Owner = this };

            aboutBox.Left = Left + (Width / 2 - aboutBox.Width / 2);
            var regToolsHeight = (int)aboutBox.Height;
            aboutBox.Height = 0;
            int topStart = (int)(Top + Height) + 30;
            aboutBox.Top = topStart;
            var topFinal = (int)(Top + (Height / 2 - regToolsHeight / 2));

            const int fullAnimationDuration = 300;
            int heightAnimationDuration = (fullAnimationDuration * regToolsHeight / (topStart - topFinal));

            var slideUp = new DoubleAnimation
            {
                From = topStart,
                To = topFinal,
                Duration = new Duration(TimeSpan.FromMilliseconds(fullAnimationDuration))
            };
            aboutBox.BeginAnimation(TopProperty, slideUp);

            var scaleUp = new DoubleAnimation
            {
                From = 0,
                To = regToolsHeight,
                Duration = new Duration(TimeSpan.FromMilliseconds(heightAnimationDuration))
            };
            aboutBox.BeginAnimation(HeightProperty, scaleUp);

            aboutBox.AnimateInnerBox();

            aboutBox.ShowDialog();
        }