Beispiel #1
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value != null)
     {
         TimeSpan TimeValue;
         if (value.GetType() != typeof(TimeSpan))
         {
             TimeValue = new TimeSpan(0, 0, 0, System.Convert.ToInt32(value));
         }
         else
         {
             TimeValue = (TimeSpan)value;
         }
         if (TimeValue.TotalHours < 1)
         {
             return(TimeValue.ToString("m\\:ss"));
         }
         else
         {
             return(TimeValue.ToString("h\\:mm\\:ss"));
         }
     }
     else
     {
         return("");
     }
 }
Beispiel #2
0
        public override string ToString()
        {
            try
            {
                Type propType = !IsTie ? AnchorAttributePropertyInfo.PropertyType
                    : TieValueType;

                if (propType.Equals(typeof(int)) || propType.Equals(typeof(long))
                    || propType.Equals(typeof(byte)))
                {
                    return LongValue.ToString();
                }
                else
                    if (propType.Equals(typeof(float)) || propType.Equals(typeof(double)))
                {
                    return DoubleValue.ToString();
                }
                else
                    if (propType.Equals(typeof(decimal)))
                {
                    return DecimalValue.ToString();
                }
                else
                    if (propType.Equals(typeof(string)))
                {
                    return StringValue;
                }
                else
                    if (propType.Equals(typeof(bool)))
                {
                    return BoolValue.ToString();
                }
                else
                    if (propType.Equals(typeof(DateTime)))
                {
                    return TimeValue.ToString();
                }
                else
                    if (propType.Equals(typeof(Guid)))
                {
                    return TimeValue.ToString();
                }
                else
                {
                    return base.ToString();
                }
            }
            catch
            {
                //TODO : write to logger
                return null;
            }
        }
        private void DrawNetVertical(Graphics graphics)
        {
            double xTime  = Math.Ceiling(SignalPaint.StartSelection * SignalPaint.PointTime / _kofNetWidth) * _kofNetWidth;
            double x      = (xTime / SignalPaint.PointTime - SignalPaint.StartSelection) / _pointWidth;
            double deltaX = (_kofNetWidth / SignalPaint.PointTime) / _pointWidth;

            while (x < _paintWidth)
            {
                TimeValue time = new TimeValue(xTime);
                graphics.DrawLine(_netPen, (float)x, -SignalPaint.Min / _pointHeight, (float)x, -SignalPaint.Max / _pointHeight);
                graphics.DrawString(time.ToString( ), _font, Brushes.Black, (float)x, -SignalPaint.Min / _pointHeight + _fontWidth / 4, _sfCenterTop);
                x     += deltaX;
                xTime += _kofNetWidth;
            }
        }
Beispiel #4
0
        public void TestTimeValue_ToString()
        {
            TimeValue time1 = new TimeValue(1, 2, 3, 4);

            Assert.AreEqual("01:02:03.04", time1.ToString(), "TimeValue ToString() is incorrect.");
        }
 internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet <int> processed)
 {
     base.SetXML(xml, host, processed);
     xml.SetAttribute("TimeValue", TimeValue.ToString());
     setAttribute(xml, "Formula", Formula);
 }
Beispiel #6
0
 string GetLastTimeAddedKey()
 {
     return(EnergySuiteConfig.LastTimeAddedPrefixKey + Type.ToString());
 }