예제 #1
0
 private void yamuiButton4_Click(object sender, EventArgs e)
 {
     // We create a transition to animate all four properties at the same time...
     Transition t = new Transition(new TransitionType_Linear(1000));
     //t.add(yamuiButton5, "Text", "What the hell???");
     t.add(yamuiButton5, "Text", (yamuiButton5.Text == @"What the hell???") ? "Holy molly" : "What the hell???");
     t.run();
 }
예제 #2
0
        /// <summary>
        /// Called when the transition we have just run has completed.
        /// </summary>
        private void onTransitionCompleted(object sender, Transition.Args e)
        {
            // We unregister from the completed event...
            Transition transition = (Transition)sender;
            transition.TransitionCompletedEvent -= onTransitionCompleted;

            // We remove the completed transition from our collection, and
            // run the next one...
            m_listTransitions.RemoveFirst();
            runNextTransition();
        }
예제 #3
0
 private void OnTransitionCompletedEvent(object sender, Transition.Args args)
 {
     if (string.IsNullOrEmpty(Text))
         return;
     var t = new Transition(new TransitionType_Linear(500));
     t.add(this, "ForeColor", YamuiThemeManager.Current.LabelNormalFore);
     t.run();
     LinearBlink = 0;
     var t2 = new Transition(new TransitionType_Linear(2000));
     t2.add(this, "LinearBlink", 401);
     t2.run();
 }
예제 #4
0
        /// <summary>
        /// Finds any properties in the old-transition that are also in the new one,
        /// and removes them from the old one.
        /// </summary>
        private void removeDuplicates(Transition newTransition, Transition oldTransition)
        {
            // Note: This checking might be a bit more efficient if it did the checking
            //       with a set rather than looking through lists. That said, it is only done
            //       when transitions are added (which isn't very often) rather than on the
            //       timer, so I don't think this matters too much.

            // We get the list of properties for the old and new transitions...
            IList<Transition.TransitionedPropertyInfo> newProperties = newTransition.TransitionedProperties;
            IList<Transition.TransitionedPropertyInfo> oldProperties = oldTransition.TransitionedProperties;

            // We loop through the old properties backwards (as we may be removing
            // items from the list if we find a match)...
            for (int i = oldProperties.Count - 1; i >= 0; i--)
            {
                // We get one of the properties from the old transition...
                Transition.TransitionedPropertyInfo oldProperty = oldProperties[i];

                // Is this property part of the new transition?
                foreach (Transition.TransitionedPropertyInfo newProperty in newProperties)
                {
                    if (oldProperty.target == newProperty.target
                        &&
                        oldProperty.propertyInfo == newProperty.propertyInfo)
                    {
                        // The old transition contains the same property as the new one,
                        // so we remove it from the old transition...
                        oldTransition.removeProperty(oldProperty);
                    }
                }
            }
        }
예제 #5
0
 /// <summary>
 /// Checks if any existing transitions are acting on the same properties as the
 /// transition passed in. If so, we remove the duplicated properties from the 
 /// older transitions.
 /// </summary>
 private void removeDuplicates(Transition transition)
 {
     // We look through the set of transitions we're currently managing...
     foreach (KeyValuePair<Transition, bool> pair in m_Transitions)
     {
         removeDuplicates(transition, pair.Key);
     }
 }
예제 #6
0
        /// <summary>
        /// Called when a transition has completed. 
        /// </summary>
        private void onTransitionCompleted(object sender, Transition.Args e)
        {
            // We stop observing the transition...
            Transition transition = (Transition)sender;
            transition.TransitionCompletedEvent -= onTransitionCompleted;

            // We remove the transition from the collection we're managing...
            lock (m_Lock)
            {
                m_Transitions.Remove(transition);
            }
        }
예제 #7
0
        /// <summary>
        /// You register a transition with the manager here. This will start to run
        /// the transition as the manager's timer ticks.
        /// </summary>
        public void register(Transition transition)
        {
            lock (m_Lock)
            {
                // We check to see if the properties of this transition
                // are already being animated by any existing transitions...
                removeDuplicates(transition);

                // We add the transition to the collection we manage, and
                // observe it so that we know when it has completed...
                m_Transitions[transition] = true;
                transition.TransitionCompletedEvent += onTransitionCompleted;
            }
        }
예제 #8
0
 /// <summary>
 /// Sets the property passed in to the initial value passed in, then creates and 
 /// immediately runs a transition on it. Also set an final action to execute when the transition ends
 /// </summary>
 public static void run(object target, string strPropertyName, object initialValue, object destinationValue, ITransitionType transitionMethod, EventHandler<Args> executeAtEnd)
 {
     Utility.setValue(target, strPropertyName, initialValue);
     Transition t = new Transition(transitionMethod);
     t.TransitionCompletedEvent += executeAtEnd;
     t.add(target, strPropertyName, destinationValue);
     t.run();
 }
예제 #9
0
 private void YamuiNotificationsShown(object sender, EventArgs e)
 {
     // Once the animation has completed the form can receive focus
     _allowFocus = true;
     if (_duration > 0) {
         _closingTransition = new Transition(new TransitionType_Linear(_duration));
         _closingTransition.add(_progressSimplePanel, "Width", 0);
         _closingTransition.TransitionCompletedEvent += (o, args) => { Close(); };
         _closingTransition.run();
     }
 }
예제 #10
0
 /// <summary>
 /// Creates and immediately runs a transition on the property passed in.
 /// </summary>
 public static void run(object target, string strPropertyName, object destinationValue, ITransitionType transitionMethod)
 {
     Transition t = new Transition(transitionMethod);
     t.add(target, strPropertyName, destinationValue);
     t.run();
 }
예제 #11
0
 private void YamuiNotificationsOnClosing(object sender, CancelEventArgs args)
 {
     if ((bool)Tag) return;
     args.Cancel = true;
     Tag = true;
     var t = new Transition(new TransitionType_Acceleration(200));
     t.add(this, "Opacity", 0d);
     t.TransitionCompletedEvent += (o, args1) => { Close(); };
     t.run();
 }
예제 #12
0
 private void YamuiNotificationsActivated(object sender, EventArgs e)
 {
     // Prevent the form taking focus when it is initially shown
     if (!_allowFocus) {
         // Activate the window that previously had focus
         WinApi.SetForegroundWindow(_currentForegroundWindow);
     } else {
         if (_closingTransition != null) {
             _closingTransition.removeProperty(_closingTransition.TransitionedProperties.FirstOrDefault());
             _closingTransition = null;
             _progressSimplePanel.Width = 0;
             _progressSimplePanel.Invalidate();
         }
     }
 }
예제 #13
0
 // get activated window
 protected override void OnShown(EventArgs e)
 {
     // Once the animation has completed the form can receive focus
     _allowFocus = true;
     if (_duration > 0) {
         _closingTransition = new Transition(new TransitionType_Linear(_duration));
         _closingTransition.add(_progressSimplePanel, "Width", 0);
         _closingTransition.TransitionCompletedEvent += (o, args) => { Close(); };
         _closingTransition.run();
     }
     base.OnShown(e);
 }
예제 #14
0
 protected override void OnActivated(EventArgs e)
 {
     // Prevent the form taking focus when it is initially shown
     if (!_allowFocus) {
         // Activate the window that previously had focus
         WinApi.SetForegroundWindow(_currentForegroundWindow);
     } else {
         if (_closingTransition != null) {
             _closingTransition.removeProperty(_closingTransition.TransitionedProperties.FirstOrDefault());
             _closingTransition = null;
             Controls.Remove(_progressSimplePanel);
             _progressSimplePanel.Dispose();
         }
     }
     base.OnActivated(e);
 }
예제 #15
0
파일: YamuiTab.cs 프로젝트: jcaillon/3P
 private void TabAnimatorStart()
 {
     if (!YamuiThemeManager.TabAnimationAllowed) return;
     var t = new Transition(new TransitionType_Acceleration(500));
     t.add(_animSmokeScreen, "Opacity", 0d);
     t.TransitionCompletedEvent += (sender, args) => _animSmokeScreen.GoHide = true;
     t.run();
 }