コード例 #1
0
ファイル: KeyTime.cs プロジェクト: dragonxu/CSHTML5
        internal static object INTERNAL_ConvertFromString(string keyTimeCode)
        {
            try
            {
                if (keyTimeCode == "Uniform")
                {
                    throw new NotImplementedException("The Value \"Uniform\" for keyTime is not supported yet.");
                }
                else if (keyTimeCode == "Paced")
                {
                    throw new NotImplementedException("The Value \"Paced\" for keyTime is not supported yet.");
                }
                else if (keyTimeCode.EndsWith("%"))
                {
                    throw new NotImplementedException("The percentage values for keyTime are not supported yet.");
                }
                else
                {
#if BRIDGE
                    TimeSpan timeSpan = INTERNAL_BridgeWorkarounds.TimeSpanParse(keyTimeCode, false);
#else
                    TimeSpan timeSpan = TimeSpan.Parse(keyTimeCode);
#endif
                    return(new KeyTime(timeSpan));
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Invalid KeyTime: " + keyTimeCode, ex);
            }
        }
コード例 #2
0
        ///// <summary>
        ///// Subtracts the specified Windows.UI.Xaml.Duration from this Windows.UI.Xaml.Duration.
        ///// </summary>
        ///// <param name="duration">The Windows.UI.Xaml.Duration to subtract from this Windows.UI.Xaml.Duration.</param>
        ///// <returns>The subtracted Windows.UI.Xaml.Duration.</returns>
        //public Duration Subtract(Duration duration);

        ///// <summary>
        ///// Converts a Windows.UI.Xaml.Duration to a System.String representation.
        ///// </summary>
        ///// <returns>A System.String representation of this Windows.UI.Xaml.Duration.</returns>
        //public override string ToString();

        internal static object INTERNAL_ConvertFromString(string p)
        {
#if BRIDGE
            TimeSpan timeSpan = INTERNAL_BridgeWorkarounds.TimeSpanParse(p);
#else
            TimeSpan timeSpan = TimeSpan.Parse(p);
#endif
            return(new Duration(timeSpan));
        }
コード例 #3
0
        static object ConvertTimeSpanFromString(string str)
        {
            try
            {
#if BRIDGE
                TimeSpan returnValue = INTERNAL_BridgeWorkarounds.TimeSpanParse(str);
#else
                TimeSpan returnValue = TimeSpan.Parse(str);
#endif
                return(returnValue);
            }
            catch
            {
                throw new Exception("Xaml exception: cannot convert \"" + str + "\" to TimeSpan. " + AdviseToFixTheError);
            }
        }
コード例 #4
0
        ///// <summary>
        ///// Subtracts the specified Windows.UI.Xaml.Duration from this Windows.UI.Xaml.Duration.
        ///// </summary>
        ///// <param name="duration">The Windows.UI.Xaml.Duration to subtract from this Windows.UI.Xaml.Duration.</param>
        ///// <returns>The subtracted Windows.UI.Xaml.Duration.</returns>
        //public Duration Subtract(Duration duration);

        ///// <summary>
        ///// Converts a Windows.UI.Xaml.Duration to a System.String representation.
        ///// </summary>
        ///// <returns>A System.String representation of this Windows.UI.Xaml.Duration.</returns>
        //public override string ToString();

        internal static object INTERNAL_ConvertFromString(string p)
        {
            if (p.ToLower() == "forever")
            {
                return(Duration.Forever);
            }
            if (p.ToLower() == "automatic")
            {
                return(Duration.Automatic);
            }
#if BRIDGE
            TimeSpan timeSpan = INTERNAL_BridgeWorkarounds.TimeSpanParse(p);
#else
            TimeSpan timeSpan = TimeSpan.Parse(p);
#endif
            return(new Duration(timeSpan));
        }