Example #1
0
 private static void SetUi(Choke sender)
 {
     if (sender.OpenValue == null | sender.CloseValue == null)
     {
         sender.PercentageText.Text = "?";
         sender.OpenPercentage      = 50;
         return;
     }
     if (sender.OpenValue == true && sender.CloseValue != true)
     {
         sender.PercentageText.Text = sender.ConvertValueByUnits("100", "%");
         sender.OpenPercentage      = 100;
         return;
     }
     if (sender.CloseValue == true && sender.OpenValue != true)
     {
         sender.PercentageText.Text = sender.ConvertValueByUnits("0", "%");
         sender.OpenPercentage      = 0;
         return;
     }
     if (sender.CloseValue != true && sender.OpenValue != true)
     {
         sender.PercentageText.Text = "?";
         sender.OpenPercentage      = 50;
     }
 }
Example #2
0
        private static void OnOpenPercentageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Choke sender = d as Choke;

            if (sender == null)
            {
                return;
            }

            if ((int)e.NewValue >= 0 && (int)e.NewValue <= 100)
            {
                sender.PercentageText.Text = sender.ConvertValueByUnits(sender.OpenPercentage.ToString(), "%");
                sender.AxisAngle           = new AxisAngleRotation3D(new Vector3D(-sender.OpenPercentage * 0.9, 0, 0), sender.OpenPercentage * 0.9);
            }
            if (sender.ChangeColor)
            {
                if ((int)e.NewValue == 0)
                {
                    sender.FrameColor = Color.FromArgb(0x77, 0xcc, 0x43, 0x53);
                }
                if ((int)e.NewValue != 0 && (int)e.NewValue != 100)
                {
                    sender.FrameColor = Color.FromArgb(0x77, 0x00, 0x63, 0xBA);
                }
                if ((int)e.NewValue == 100)
                {
                    sender.FrameColor = Color.FromArgb(0x77, 0x00, 0xcc, 0x53);
                }
            }
        }
Example #3
0
 private static void SetUi(Choke sender)
 {
     if (sender.OpenValue == null | sender.CloseValue == null)
     {
         sender.PercentageText.Text = "?";
         sender.OpenPercentage = 50;
         return;
     }
     if (sender.OpenValue == true && sender.CloseValue != true)
     {
         sender.PercentageText.Text = sender.ConvertValueByUnits("100", "%");
         sender.OpenPercentage = 100;
         return;
     }
     if (sender.CloseValue == true && sender.OpenValue != true)
     {
         sender.PercentageText.Text = sender.ConvertValueByUnits("0", "%");
         sender.OpenPercentage = 0;
         return;
     }
     if (sender.CloseValue != true && sender.OpenValue != true)
     {
         sender.PercentageText.Text = "?";
         sender.OpenPercentage = 50;
     }
 }