Ejemplo n.º 1
0
        /// <summary>
        /// Helper used by the four Freezable clone methods to copy the resolved key times and
        /// key frames. The Get*AsFrozenCore methods are implemented the same as the Clone*Core
        /// methods; Get*AsFrozen at the top level will recursively Freeze so it's not done here.
        /// </summary>
        /// <param name="sourceAnimation"></param>
        /// <param name="isCurrentValueClone"></param>
        private void CopyCommon(BooleanAnimationUsingKeyFrames sourceAnimation, bool isCurrentValueClone)
        {
            _areKeyTimesValid = sourceAnimation._areKeyTimesValid;

            if (_areKeyTimesValid &&
                sourceAnimation._sortedResolvedKeyFrames != null)
            {
                // _sortedResolvedKeyFrames is an array of ResolvedKeyFrameEntry so the notion of CurrentValueClone doesn't apply
                _sortedResolvedKeyFrames = (ResolvedKeyFrameEntry[])sourceAnimation._sortedResolvedKeyFrames.Clone();
            }

            if (sourceAnimation._keyFrames != null)
            {
                if (isCurrentValueClone)
                {
                    _keyFrames = (BooleanKeyFrameCollection)sourceAnimation._keyFrames.CloneCurrentValue();
                }
                else
                {
                    _keyFrames = (BooleanKeyFrameCollection)sourceAnimation._keyFrames.Clone();
                }

                OnFreezablePropertyChanged(null, _keyFrames);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Implementation of <see cref="System.Windows.Freezable.GetCurrentValueAsFrozenCore(Freezable)">Freezable.GetCurrentValueAsFrozenCore</see>.
        /// </summary>
        protected override void GetCurrentValueAsFrozenCore(Freezable source)
        {
            BooleanAnimationUsingKeyFrames sourceAnimation = (BooleanAnimationUsingKeyFrames)source;

            base.GetCurrentValueAsFrozenCore(source);

            CopyCommon(sourceAnimation, /* isCurrentValueClone = */ true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Implementation of <see cref="System.Windows.Freezable.CloneCore(System.Windows.Freezable)">Freezable.CloneCore</see>.
        /// </summary>
        protected override void CloneCore(Freezable sourceFreezable)
        {
            BooleanAnimationUsingKeyFrames sourceAnimation = (BooleanAnimationUsingKeyFrames)sourceFreezable;

            base.CloneCore(sourceFreezable);

            CopyCommon(sourceAnimation, /* isCurrentValueClone = */ false);
        }
Ejemplo n.º 4
0
		private BooleanAnimationUsingKeyFrames SomeBooleans()
		{
			var booleanAnimation = new BooleanAnimationUsingKeyFrames();
			booleanAnimation.KeyFrames.Add(new DiscreteBooleanKeyFrame(false, // Target value (KeyValue)
					KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.0))) // KeyTime
				);

			// Value becomes true after the first second.
			booleanAnimation.KeyFrames.Add(
				new DiscreteBooleanKeyFrame(
					true, // Target value (KeyValue)
					KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1.0))) // KeyTime
				);

			// Value becomes false after the 2nd second.
			booleanAnimation.KeyFrames.Add(
				new DiscreteBooleanKeyFrame(
					false, // Target value (KeyValue)
					KeyTime.FromTimeSpan(TimeSpan.FromSeconds(2.0))) // KeyTime
				);

			// Value becomes true after the third second.
			booleanAnimation.KeyFrames.Add(
				new DiscreteBooleanKeyFrame(
					true, // Target value (KeyValue)
					KeyTime.FromTimeSpan(TimeSpan.FromSeconds(3.0))) // KeyTime
				);

			// Value becomes false after 3 and half seconds.
			booleanAnimation.KeyFrames.Add(
				new DiscreteBooleanKeyFrame(
					false, // Target value (KeyValue)
					KeyTime.FromTimeSpan(TimeSpan.FromSeconds(3.5))) // KeyTime
				);

			// Value becomes true after the fourth second.
			booleanAnimation.KeyFrames.Add(
				new DiscreteBooleanKeyFrame(
					true, // Target value (KeyValue)
					KeyTime.FromTimeSpan(TimeSpan.FromSeconds(4.0))) // KeyTime
				);
			return booleanAnimation;
		}
Ejemplo n.º 5
0
 /// <summary>
 /// Show or expand popup</summary>
 /// <param name="dockContent">Dock content</param>
 internal void ShowPopup(DockContent dockContent)
 {
     if (PART_Popup.IsOpen)
     {
         if (!((DockedWindow)PART_Popup.Content).HasChild(dockContent))
         {
             ClosePopup();
         }
         else
         {
             return;
         }
     }
     ContentSettings settings = dockContent.Settings;
     switch (Orientation)
     {
         case Orientation.Horizontal:
             PART_Popup.MaxWidth = RenderSize.Width;
             PART_Popup.MaxHeight = 0.75 * Math.Min(Root.RenderSize.Height, System.Windows.SystemParameters.PrimaryScreenHeight);
             PART_Popup.Width = RenderSize.Width;
             PART_Popup.Height = Math.Min(settings.Size.Height + 25, PART_Popup.MaxHeight);
             break;
         case Orientation.Vertical:
             PART_Popup.MaxWidth = 0.75 * Math.Min(Root.RenderSize.Width, System.Windows.SystemParameters.PrimaryScreenWidth);
             PART_Popup.MaxHeight = RenderSize.Height;
             PART_Popup.Width = Math.Min(settings.Size.Width + 7, PART_Popup.MaxWidth);
             PART_Popup.Height = RenderSize.Height;
             break;
     }
     DockedWindow window = new DockedWindow(Root, dockContent);
     window.Closing += Window_Closing;
     window.Focused = true;
     window.IsCollapsed = true;
     PART_Popup.Content = window;
     PART_Popup.Tag = dockContent;
     BooleanAnimationUsingKeyFrames booleanAnimation = new BooleanAnimationUsingKeyFrames();
     booleanAnimation.Duration = TimeSpan.FromSeconds(0.1);
     booleanAnimation.KeyFrames.Add(
         new DiscreteBooleanKeyFrame(
             false, // Target value (KeyValue)
             KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.0))) // KeyTime
         );
     booleanAnimation.KeyFrames.Add(
         new DiscreteBooleanKeyFrame(
             true, // Target value (KeyValue)
             KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.1))) // KeyTime
         );
     PART_Popup.IsOpen = true;
     Root.Focus(dockContent);
     m_timer.Start();
 }
        /// <summary>
        /// Helper used by the four Freezable clone methods to copy the resolved key times and 
        /// key frames. The Get*AsFrozenCore methods are implemented the same as the Clone*Core
        /// methods; Get*AsFrozen at the top level will recursively Freeze so it's not done here.
        /// </summary>
        /// <param name="sourceAnimation"></param>
        /// <param name="isCurrentValueClone"></param>
        private void CopyCommon(BooleanAnimationUsingKeyFrames sourceAnimation, bool isCurrentValueClone)
        {    
            _areKeyTimesValid = sourceAnimation._areKeyTimesValid;

            if (   _areKeyTimesValid 
                && sourceAnimation._sortedResolvedKeyFrames != null)
            {
                // _sortedResolvedKeyFrames is an array of ResolvedKeyFrameEntry so the notion of CurrentValueClone doesn't apply
                _sortedResolvedKeyFrames = (ResolvedKeyFrameEntry[])sourceAnimation._sortedResolvedKeyFrames.Clone(); 
            }

            if (sourceAnimation._keyFrames != null)
            {
                if (isCurrentValueClone)
                {
                    _keyFrames = (BooleanKeyFrameCollection)sourceAnimation._keyFrames.CloneCurrentValue();
                }
                else
                {
                    _keyFrames = (BooleanKeyFrameCollection)sourceAnimation._keyFrames.Clone();
                }

                OnFreezablePropertyChanged(null, _keyFrames);
            }
        }