Exemple #1
0
        /// <summary>
        /// Set the new state. If it is an animation, it starts immediatly
        /// and iterates the animation as defined within the NotifyIconState.AniLoops
        /// property. If it was set to -1, this will be an endless animation.
        /// </summary>
        /// <param name="stateKey"></param>
        /// <returns></returns>
        public NotifyIconState SetState(string stateKey)
        {
            if (_currentState.IsAnimation)
            {
                _aniStepTimer.Stop();
                _aniStep     = 0;
                _aniLoopStep = 0;
            }

            // set the new state
            if (_iconStates.ContainsKey(stateKey))
            {
                _currentState = (NotifyIconState)_iconStates[stateKey];
            }
            else
            {
                _currentState = new NotifyIconState();
            }

            // refresh current display state
            if (_currentState.IsIcon)
            {
                SetIcon();
            }

            SetText();

            // if it is a animation, start it
            if (_currentState.IsAnimation)
            {   // do not make the UI unresponding anymore:
                ThreadPool.QueueUserWorkItem(new WaitCallback(this.AnimationThreadRun));
            }
            return(_currentState);
        }
Exemple #2
0
 protected virtual void OnAnimationFinished(NotifyIconState animation)
 {
     if (AnimationFinished != null)
     {
         AnimationFinished(this, animation);
     }
 }
Exemple #3
0
 public NotifyIconState AddState(NotifyIconState newState)
 {
     _iconStates.Add(newState.Key, newState);
     return(newState);
 }
Exemple #4
0
 public NotifyIconAnimation(System.ComponentModel.IContainer container, NotifyIconState notifyIconState)
     : this(container)
 {
     _currentState = this.AddState(notifyIconState);
 }
Exemple #5
0
 public NotifyIconAnimation(NotifyIconState notifyIconState)
     : this()
 {
     _currentState = this.AddState(notifyIconState);
 }