Beispiel #1
0
		protected override StyleValue Div(StyleValue right)
		{
			if(right is StyleColor)
			{
				var other = right as StyleColor;
				return new StyleColor {Value = Value/other.Value};
			}
			if(right is StyleNumber)
			{
				var other = right as StyleNumber;
				if(!string.IsNullOrEmpty(other.UnitOfMeasure))
				{
					throw new ArgumentException();
				}
				return new StyleColor {Value = (int)(Value/other.Value)};
			}
			throw new ArgumentException();
		}
Beispiel #2
0
		protected virtual StyleValue Div(StyleValue right)
		{
			return new StyleNumber(0);
		}
Beispiel #3
0
		protected override StyleValue Sub(StyleValue right)
		{
			if (right is StyleNumber)
			{
				var other = right as StyleNumber;
				if (!CanOperateOn(other)) throw new ArgumentException();
				return new StyleNumber(Value - other.Value, UnitOfMeasure ?? other.UnitOfMeasure);
			}
			throw new ArgumentException();
		}