Example #1
0
 static protected void SetStaticProperty(IntPtr handle, IntPtr value)
 {
     try
     {
         StaticProperty property = Class.getStaticProperty(handle);
         property?.SetValue(value);
     }
     catch { }
 }
Example #2
0
        static private StaticProperty getStaticProperty(IntPtr handle)
        {
            StaticProperty property = Base.FindInstance <StaticProperty>(handle);

            if (null == property && !sStaticProperties.TryGetValue(handle, out property))
            {
                Entry.LogWarning("No static property for handle {0}", handle.ToString());
            }
            return(property);
        }
Example #3
0
 static protected IntPtr GetStaticProperty(IntPtr handle)
 {
     try
     {
         StaticProperty property = Class.getStaticProperty(handle);
         return(property?.GetValue() ?? IntPtr.Zero);
     }
     catch
     {
         return(IntPtr.Zero);
     }
 }
Example #4
0
        public Property BindStaticProperty <TValue>(string name, Func <Type, string, TValue> getter, Action <Type, string, TValue> setter)
        {
            IntPtr         handle  = Entry.Class.BindStaticProperty(this, name, null != getter, null != setter);
            StaticProperty existed = null;

            if (sStaticProperties.TryGetValue(handle, out existed))
            {
                Entry.LogError("[{0}] There is already an instance [{1}] referring to handle [{2}]!", string.Concat(mFullname, ".", name), existed.Fullname, handle.ToString());
                return(existed);
            }
            StaticProperty property = new StaticProperty <TValue>(mContext, handle, name, this, getter, setter);

            sStaticProperties.Add(handle, property);
            return(property);
        }