public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
            {
                if (destType == typeof(string) && value is GraphMeasurement)
                {
                    // Cast the value to an Employee type
                    GraphMeasurement pp = (GraphMeasurement)value;

                    return(pp.Symbol + ", " + pp.Value.ToString() + ", " + pp.Timestamp.ToString("dd/MM/yyyy HH:mm:ss"));
                }
                return(base.ConvertTo(context, culture, value, destType));
            }
Esempio n. 2
0
        public void AddPoint(float value, DateTime timestamp, float minrange, float maxrange, Color linecolor)
        {
            _lineColor = linecolor;
            _minrange  = minrange;
            _maxrange  = maxrange;
            // check bounds
            if (m_measurements.Count >= _maxpoints)
            {
                // re-scale
                _maxpoints++;

                /*for (int t = 0; t < _maxpoints -1 ; t++)
                 * {
                 *  //Console.WriteLine("Setting index " + t.ToString() + " with value " + m_measurements[t].Value.ToString("F2") + " to " + m_measurements[t + 1].Value.ToString("F2"));
                 *  //m_measurements[t] = m_measurements[t + 1];
                 *  m_measurements[t].Value = m_measurements[t+1].Value;
                 *  m_measurements[t].Timestamp = m_measurements[t+1].Timestamp;
                 * }
                 * m_measurements[_maxpoints - 1].Value = value;
                 * m_measurements[_maxpoints - 1].Timestamp = timestamp;*/

                GraphMeasurement measurement = new GraphMeasurement();
                measurement.Symbol    = _symbol;
                measurement.Value     = value;
                measurement.Timestamp = timestamp;
                m_measurements.Add(measurement);
            }
            else
            {
                GraphMeasurement measurement = new GraphMeasurement();
                measurement.Symbol    = _symbol;
                measurement.Value     = value;
                measurement.Timestamp = timestamp;
                m_measurements.Add(measurement);
            }
        }
 public bool Contains(GraphMeasurement value)
 {
     // If value is not of type Int16, this will return false.
     return (List.Contains(value));
 }
 public int Add(GraphMeasurement value)
 {
     return (List.Add(value));
 }
 public void Remove(GraphMeasurement value)
 {
     List.Remove(value);
 }
 public void Insert(int index, GraphMeasurement value)
 {
     List.Insert(index, value);
 }
 public int IndexOf(GraphMeasurement value)
 {
     return (List.IndexOf(value));
 }
 public bool Contains(GraphMeasurement value)
 {
     // If value is not of type Int16, this will return false.
     return(List.Contains(value));
 }
 public void Remove(GraphMeasurement value)
 {
     List.Remove(value);
 }
 public void Insert(int index, GraphMeasurement value)
 {
     List.Insert(index, value);
 }
 public int IndexOf(GraphMeasurement value)
 {
     return(List.IndexOf(value));
 }
 public int Add(GraphMeasurement value)
 {
     return(List.Add(value));
 }