public override void Dispose() { if (_parentmeasure != null) { _parentmeasure._yahooweather.WeatherArrive -= OnSourceUpdate; } _parentmeasure = null; }
internal override void Initialize(Rainmeter.API api) { base.Initialize(api); string parentname = api.ReadString("ParentName", ""); foreach (ParentMeasure item in ParentMeasure.ParentMeasures) { if (item.Name == parentname && item.Skin == Skin) { _parentmeasure = item; } } if (_parentmeasure == null) LogHelper.Error("[" + Name + "]" + " Can't find Parent (" + parentname + ")"); else _parentmeasure._yahooweather.WeatherArrive += OnSourceUpdate; }
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)); }