private void star_StateChanged(object sender, StarStateChangedEventArgs e)
        {
            Star star = (Star)sender;

            int current = (int)star.Tag;

            bool reset = (current < Value);

            int value;

            foreach (Star str in stackPanelStars.Children)
            {
                value = (int)str.Tag;

                DisableStateChange(str);

                if (value < current)
                {
                    str.State = StarState.On;
                }
                else if (value > current)
                {
                    str.State = StarState.Off;
                }
                else if (value == current && reset)
                {
                    str.State = StarState.On;
                }

                EnableStateChange(str);
            }

            Value = current;
        }
示例#2
0
 private void OnStateChanged(StarStateChangedEventArgs e)
 {
     if (StateChanged != null)
     {
         StateChanged(this, e);
     }
 }