public static void Initialize(ref IntPtr data, IntPtr rm) { Rainmeter.API api = new Rainmeter.API(rm); string parent = api.ReadString("ParentName", ""); Measure measure; if (String.IsNullOrEmpty(parent)) { measure = new ParentMeasure(); } else { measure = new ChildMeasure(); } measure.Initialize(api); data = GCHandle.ToIntPtr(GCHandle.Alloc(measure)); }
internal override void Initialize(Rainmeter.API api) { base.Initialize(api); string parentname = api.ReadString("ParentName", ""); if (string.IsNullOrEmpty(parentname) == false) { foreach (ParentMeasure measure in ParentMeasure.ParentMeasures) { if (measure.Name == parentname && measure.Skin == Skin) { _parentmeasure = measure; return; } } } if (_parentmeasure == null) { LogHelper.Error("ParentName= " + parentname + " 没找到"); } }