public static void Initialize(ref IntPtr data, IntPtr rm) { Rainmeter.API api = new Rainmeter.API(rm); string parentname = api.ReadString("ParentName", ""); Measure measure; if (string.IsNullOrEmpty(parentname)) { 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 item in ParentMeasure.ParentMeasures) { if (item.Name.Equals(parentname) && Skin == item.Skin) _patentmeasure = item; } } if (_patentmeasure == null) { LogHelper.Error("ParentName= " + parentname + " 没找到"); return; } _patentmeasure.Data.WeatherArrive += OnSourceUpdate; }
public override void Dispose() { if (_patentmeasure != null) { _patentmeasure.Data.WeatherArrive -= OnSourceUpdate; } _patentmeasure = null; }