Exemple #1
0
        /// <summary>
        /// Create a new CfrV8Value object of type Date. This function should only be
        /// called from within the scope of a CfrRenderProcessHandler,
        /// CfrV8Handler or CfrV8Accessor callback, or in combination with calling
        /// enter() and exit() on a stored CfrV8Context reference.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
        /// </remarks>
        public static CfrV8Value CreateDate(CfrTime date)
        {
            var call = new CfxV8ValueCreateDateRemoteCall();

            call.date = CfrObject.Unwrap(date).ptr;
            call.RequestExecution();
            return(CfrV8Value.Wrap(new RemotePtr(call.__retval)));
        }
Exemple #2
0
        /// <summary>
        /// Create a new CfrV8Value object of type Date. This function should only be
        /// called from within the scope of a CfrRenderProcessHandler,
        /// CfrV8Handler or CfrV8Accessor callback, or in combination with calling
        /// enter() and exit() on a stored CfrV8Context reference.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
        /// </remarks>
        public static CfrV8Value CreateDate(CfrTime date)
        {
            var call = new CfxV8ValueCreateDateRenderProcessCall();

            call.date = CfrObject.Unwrap(date);
            call.RequestExecution(CfxRemoteCallContext.CurrentContext.connection);
            return(CfrV8Value.Wrap(call.__retval));
        }
        /// <summary>
        /// Create a new CfrV8Value object of type Date. This function should only be
        /// called from within the scope of a CfrRenderProcessHandler,
        /// CfrV8Handler or CfrV8Accessor callback, or in combination with calling
        /// enter() and exit() on a stored CfrV8Context reference.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
        /// </remarks>
        public static CfrV8Value CreateDate(CfrTime date)
        {
            var connection = CfxRemoteCallContext.CurrentContext.connection;
            var call       = new CfxV8ValueCreateDateRemoteCall();

            if (!CfrObject.CheckConnection(date, connection))
            {
                throw new ArgumentException("Render process connection mismatch.", "date");
            }
            call.date = CfrObject.Unwrap(date).ptr;
            call.RequestExecution(connection);
            return(CfrV8Value.Wrap(new RemotePtr(connection, call.__retval)));
        }
Exemple #4
0
        public static CfrTime FromUniversalTime(DateTime time)
        {
            if (time.Kind != DateTimeKind.Utc)
                throw new ArgumentException("time must be of kind DateTimeKind.Utc", "time");

            var r = new CfrTime();
            r.Year = time.Year;
            r.Month = time.Month;
            r.DayOfMonth = time.Day;
            r.DayOfWeek = (int)time.DayOfWeek;
            r.Hour = time.Hour;
            r.Minute = time.Minute;
            r.Second = time.Second;
            r.Millisecond = time.Millisecond;
            return r;
        }
Exemple #5
0
        internal static CfrTime Wrap(RemotePtr remotePtr)
        {
            if (remotePtr == RemotePtr.Zero)
            {
                return(null);
            }
            var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache;

            lock (weakCache) {
                var cfrObj = (CfrTime)weakCache.Get(remotePtr.ptr);
                if (cfrObj == null)
                {
                    cfrObj = new CfrTime(remotePtr);
                    weakCache.Add(remotePtr.ptr, cfrObj);
                }
                return(cfrObj);
            }
        }
Exemple #6
0
        internal static CfrTime Wrap(IntPtr proxyId)
        {
            if (proxyId == IntPtr.Zero)
            {
                return(null);
            }
            var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache;

            lock (weakCache) {
                var cfrObj = (CfrTime)weakCache.Get(proxyId);
                if (cfrObj == null)
                {
                    cfrObj = new CfrTime(proxyId);
                    weakCache.Add(proxyId, cfrObj);
                }
                return(cfrObj);
            }
        }
Exemple #7
0
        public static CfrTime FromUniversalTime(DateTime time)
        {
            if (time.Kind != DateTimeKind.Utc)
            {
                throw new ArgumentException("time must be of kind DateTimeKind.Utc", "time");
            }

            var r = new CfrTime();

            r.Year        = time.Year;
            r.Month       = time.Month;
            r.DayOfMonth  = time.Day;
            r.DayOfWeek   = (int)time.DayOfWeek;
            r.Hour        = time.Hour;
            r.Minute      = time.Minute;
            r.Second      = time.Second;
            r.Millisecond = time.Millisecond;
            return(r);
        }
Exemple #8
0
 public DateTime ToUniversalTime(CfrTime time)
 {
     return(new DateTime(time.Year, time.Month, time.DayOfMonth, time.Hour, time.Minute, time.Second, time.Millisecond, DateTimeKind.Utc));
 }
Exemple #9
0
 public DateTime ToUniversalTime(CfrTime time)
 {
     return new DateTime(time.Year, time.Month, time.DayOfMonth, time.Hour, time.Minute, time.Second, time.Millisecond, DateTimeKind.Utc);
 }