Exemplo n.º 1
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return(value);
            }
            double c2h4Value = double.Parse(value.ToString());
            double w         = Triangle.triangleWidth;
            double h         = Triangle.triangleHeight;
            //c2h4Value = 100 - c2h4Value;
            //double y =  c2h4Value * Triangle.triangleHeight / 100;
            //double x = w * (y + h) / (2 * h);
            double x = CoordinateConverterHelp.CoordinateConverter(c2h4Value, EnumGas.C2H4).X;
            double y = CoordinateConverterHelp.CoordinateConverter(c2h4Value, EnumGas.C2H4).Y;

            if (parameter.ToString() == "Left")
            {
                return(x - 3);
            }
            else if (parameter.ToString() == "Top")
            {
                return(y - 3);
            }
            return(value);
        }
Exemplo n.º 2
0
        private void thumb1_DragCompleted(object sender, DragCompletedEventArgs e)
        {
            double x    = Canvas.GetLeft(thumb1) + thumb1.Width;
            double y    = Canvas.GetTop(thumb1) + thumb1.Height;
            double c2h2 = CoordinateConverterHelp.PointConvertCH(new Point(x, y), EnumGas.C2H2);
            double c2h4 = CoordinateConverterHelp.PointConvertCH(new Point(x, y), EnumGas.C2H4);
            double ch4  = CoordinateConverterHelp.PointConvertCH(new Point(x, y), EnumGas.CH4);

            thumb1.ToolTip = string.Format("X:{0},Y{1},C2H2:{2},C2H4:{3},Ch4:{4}", x, y, c2h2, c2h4, ch4);
            tbxInfo.Text   = string.Format("X:{0},Y{1},C2H2:{2:D},C2H4:{3:D},CH4:{4:D}", x, y, (int)c2h2, (int)c2h4, (int)ch4);
        }
Exemplo n.º 3
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return(value);
            }

            double c2h2Value = double.Parse(value.ToString());
            //double y = (100 - c2h2Value) * Triangle.triangleHeight / 100;
            //double x = Triangle.triangleWidth - c2h2Value * Triangle.triangleWidth/100;
            double x = CoordinateConverterHelp.CoordinateConverter(c2h2Value, EnumGas.C2H2).X;

            if (parameter.ToString() == "Left")
            {
                return(x - 3);
            }
            else if (parameter.ToString() == "Top")
            {
                return(Triangle.triangleHeight - 3);
            }
            return(value);
        }