void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.lbIndicator = ((System.Windows.Controls.Label)(target));
                return;

            case 2:
                this.testRunProcess = ((BeatfanControls.ProcessBars.CycleProcessBar2)(target));
                return;
            }
            this._contentLoaded = true;
        }
Example #2
0
        private static void OnCurrentValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CycleProcessBar2 cpb          = d as CycleProcessBar2;
            double           percentValue = (double)e.NewValue;

            if (percentValue < 0.3)
            {
                cpb.myCycleProcessBar2.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xEA, 0x6A, 0x12));
            }
            else if (percentValue < 0.7)
            {
                cpb.myCycleProcessBar2.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xD6, 0xBB, 0x0F));
            }
            else
            {
                cpb.myCycleProcessBar2.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0x12, 0xCB, 0x66));
            }

            cpb.lbProcessContent.Content = (percentValue * 100).ToString() + "%";
            //100%就会归零,此处不归零
            cpb.myCycleProcessBar2.Data = cpb.GetGeometry(percentValue == 1 ? 0.99 : percentValue);
        }
Example #3
0
        private static void OnCurrentValueListChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CycleProcessBar2 cpb       = d as CycleProcessBar2;
            List <double>    valueList = (List <double>)e.NewValue;

            double percentValue = valueList[0] / valueList[1];

            if (percentValue < 0.3)
            {
                cpb.myCycleProcessBar2.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xEA, 0x6A, 0x12));
            }
            else if (percentValue < 0.7)
            {
                cpb.myCycleProcessBar2.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xD6, 0xBB, 0x0F));
            }
            else
            {
                cpb.myCycleProcessBar2.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0x12, 0xCB, 0x66));
            }

            cpb.lbProcessContent.Content = valueList[0].ToString() + "\r\n" + valueList[1].ToString();
            //100%就会归零,此处不让不归零
            cpb.myCycleProcessBar2.Data = cpb.GetGeometry(percentValue >= 1 ? 0.99 : percentValue);
        }