Ejemplo n.º 1
0
		/// <summary>
		/// Divides two datastrings.
		/// </summary>
		public static DataString operator /(DataString d1, DataString d2)
		{
			DataString result = new DataString((UnitConverter)d1.Converter, d1.Unit.DefaultSymbol);
			double x = 0.0;
			double y = 0.0;
			double z = 0.0;

			d1.GetValue(out x);
			d1.Converter.ConvertToStandard(x, d1.Unit.DefaultSymbol, out x);

			d2.GetValue(out y);
			d2.Converter.ConvertToStandard(y, d2.Unit.DefaultSymbol, out y);

			z = x / y;
			d1.Converter.ConvertFromStandard(z, d1.Unit.DefaultSymbol, out z);

			result.SetUnit(d1.Unit.DefaultSymbol);
			result.SetValue(z);
			return result;
		}
Ejemplo n.º 2
0
        public DataString CreateDataString(string unitSymbol)
        {
            DataString ds = new DataString(this, unitSymbol);

            return(ds);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new data string, used as a bridge to the user interface.
        /// </summary>
        /// <returns>The newly created data string.</returns>
        public DataString CreateDataString()
        {
            DataString ds = new DataString(this, "");

            return(ds);
        }