Ejemplo n.º 1
0
        protected override void ExecuteInTargetProcess(RemoteConnection connection)
        {
            var sender = CfrV8Accessor.Wrap(this.sender);
            var e      = new CfrV8AccessorSetEventArgs(eventArgsId);

            sender.raise_Set(sender, e);
        }
Ejemplo n.º 2
0
        internal void RaisePropertySet(CfrV8AccessorSetEventArgs e)
        {
            var h = PropertySet;

            if (h == null)
            {
                //TODO: this causes the browser to crash.
                //so for the time being, we silently ignore
                //set requests when there is no application
                //defined set event.
                //e.Exception = "Property is readonly.";
                e.SetReturnValue(true);
            }
            else
            {
                if (WillInvoke)
                {
                    Browser.RenderThreadInvoke((MethodInvoker)(() => h.Invoke(this, e)));
                }
                else
                {
                    h.Invoke(this, e);
                }
            }
        }
Ejemplo n.º 3
0
        private void PropertySet(object sender, CfrV8AccessorSetEventArgs e)
        {
            var prop = PropertyMap.FirstOrDefault(p => p.Key == e.Name).Value;

            if (prop != null)
            {
                object value = ReadV8Value(e.Value, prop.PropertyType);
                prop.SetMethod.Invoke(this, new object[] { value });
                e.SetReturnValue(true);
                return;
            }

            var field = FieldMap.FirstOrDefault(f => f.Key == e.Name).Value;

            if (field != null)
            {
                object value = ReadV8Value(e.Value, field.FieldType);
                field.SetValue(this, value);
                e.SetReturnValue(true);
                return;
            }

            e.Exception = $"There is no property named { e.Name }.";
            e.SetReturnValue(false);
        }
Ejemplo n.º 4
0
        private void Hotel_Phone_PropertySet(object sender, CfrV8AccessorSetEventArgs e)
        {
            if (e.Value.IsString)
            {
                SettingHelper.HotelPhone = e.Value.StringValue;
                return;
            }

            e.Exception = "String value expected";
        }
Ejemplo n.º 5
0
        private void Deposit_PropertySet(object sender, CfrV8AccessorSetEventArgs e)
        {
            if (e.Value.IsInt)
            {
                SettingHelper.Deposit = e.Value.IntValue;
                return;
            }

            e.Exception = "Number value expected";
        }
Ejemplo n.º 6
0
        private void Time_Checkin_PropertySet(object sender, CfrV8AccessorSetEventArgs e)
        {
            if (e.Value.IsString)
            {
                SettingHelper.TimeCheckin = e.Value.StringValue;
                return;
            }

            e.Exception = "String value expected";
        }
Ejemplo n.º 7
0
        internal void raise_Set(object sender, CfrV8AccessorSetEventArgs e)
        {
            var handler = m_Set;

            if (handler == null)
            {
                return;
            }
            handler(this, e);
            e.m_isInvalid = true;
        }
        void v8Accessor_Set(object sender, CfrV8AccessorSetEventArgs e)
        {
            JSProperty property;

            if (jsProperties.TryGetValue(e.Name, out property))
            {
                ((JSDynamicProperty)property).RaisePropertySet(e);
            }
            else
            {
                //this should never be reached
                e.SetReturnValue(false);
            }
        }
Ejemplo n.º 9
0
        protected override void RemoteProcedure()
        {
            var self = (CfrV8Accessor)System.Runtime.InteropServices.GCHandle.FromIntPtr(gcHandlePtr).Target;

            if (self == null || self.CallbacksDisabled)
            {
                return;
            }
            var e = new CfrV8AccessorSetEventArgs(this);

            self.m_Set?.Invoke(self, e);
            e.m_isInvalid  = true;
            object_release = e.m_object_wrapped == null? 1 : 0;
            value_release  = e.m_value_wrapped == null? 1 : 0;
            exception      = e.m_exception_wrapped;
            __retval       = e.m_returnValue ? 1 : 0;
        }
Ejemplo n.º 10
0
 private void SQL_User_PropertySet(object sender, CfrV8AccessorSetEventArgs e)
 {
     Settings.Default.SQL_USER = e.Value.StringValue;
 }
Ejemplo n.º 11
0
 private void SQL_Password_PropertySet(object sender, CfrV8AccessorSetEventArgs e)
 {
     Settings.Default.SQL_PASSWORD = e.Value.StringValue;
 }
Ejemplo n.º 12
0
 private void SQL_Port_PropertySet(object sender, CfrV8AccessorSetEventArgs e)
 {
     Settings.Default.SQL_PORT = e.Value.IntValue;
 }
Ejemplo n.º 13
0
 private void SQL_Database_PropertySet(object sender, CfrV8AccessorSetEventArgs e)
 {
     Settings.Default.SQL_DATABASE = e.Value.StringValue;
 }