Пример #1
0
        private static void OnRightLightStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            WeighterPanel wp = d as WeighterPanel;

            string getRightState = Convert.ToInt32(Enum.Parse(typeof(RightLightStates), wp.RightLightState.ToString())).ToString();

            wp.RightLight = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#" + Enum.Parse(typeof(LightColour), getRightState).ToString()));

            // var g = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#2786E4"));
            //if (wp.LeftLightState == LeftLightStates.Red)
            //{
            //    wp.RedLight = Visibility.Visible;
            //    wp.GreenLight = Visibility.Hidden;
            //}
            //else if (wp.LightState == LightStates.Green)
            //{
            //    wp.RedLight = Visibility.Hidden;
            //    wp.GreenLight = Visibility.Visible;
            //}
            //else
            //{
            //    wp.RedLight = Visibility.Hidden;
            //    wp.GreenLight = Visibility.Hidden;
            //}
        }
Пример #2
0
        private static void OnWeighterStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            WeighterPanel wp = d as WeighterPanel;

            if (wp.WeighterState == WeighterStates.Working)
            {
                wp.Icon              = new BitmapImage(new Uri("pack://application:,,,/Talent.ClientCommonLib;Component/Images/waiting.png"));
                wp.Message           = "正在计量...";
                wp.MessageForeground = new SolidColorBrush(Color.FromRgb(157, 239, 157));
            }
            else if (wp.WeighterState == WeighterStates.Free)
            {
                wp.Icon              = new BitmapImage(new Uri("pack://application:,,,/Talent.ClientCommonLib;Component/Images/stop.png"));
                wp.Message           = "无计量任务";
                wp.MessageForeground = new SolidColorBrush(Color.FromRgb(238, 144, 132));
            }
            else if (wp.WeighterState == WeighterStates.NoReaderCard)
            {
                wp.Icon              = new BitmapImage(new Uri("pack://application:,,,/Talent.ClientCommonLib;Component/Images/waiting.png"));
                wp.Message           = "车上秤未插卡";
                wp.MessageForeground = new SolidColorBrush(Color.FromRgb(238, 144, 132));
            }
            else if (wp.WeighterState == WeighterStates.Wait)
            {
                wp.Icon              = new BitmapImage(new Uri("pack://application:,,,/Talent.ClientCommonLib;Component/Images/waiting.png"));
                wp.Message           = "等待计量...";
                wp.MessageForeground = new SolidColorBrush(Color.FromRgb(238, 144, 132));
            }
            else if (wp.WeighterState == WeighterStates.EndTask)
            {
                wp.Icon              = new BitmapImage(new Uri("pack://application:,,,/Talent.ClientCommonLib;Component/Images/stop.png"));
                wp.Message           = "计量完成...";
                wp.MessageForeground = new SolidColorBrush(Color.FromRgb(238, 144, 132));
            }
            else if (wp.WeighterState == WeighterStates.StopTask)
            {
                wp.Icon              = new BitmapImage(new Uri("pack://application:,,,/Talent.ClientCommonLib;Component/Images/stop.png"));
                wp.Message           = "终止计量...";
                wp.MessageForeground = new SolidColorBrush(Color.FromRgb(238, 144, 132));
            }
            else
            {
                wp.Icon              = null;
                wp.Message           = "衡器端断开连接";
                wp.MessageForeground = new SolidColorBrush(Color.FromRgb(157, 239, 157));
            }
        }