/* * Link up the Host to the Target and initialize but do not start the timer * */ public void BindToTarget(LayoutToLayoutTarget t) { Target = t; t.Host = this; translation = new TranslateTransform(0, 0); RenderTransform = translation; Refresher = new DispatcherTimer(); Refresher.Interval = TimeSpan.FromMilliseconds(timeSpan); Refresher.Tick += OnAnimStateInvalidated; UpdateFromTarget(); }
/* * Break the cyclical reference * */ public void ReleaseFromTarget() { Target.Host = null; Target = null; }
/* * If the host gets unloaded, break the cyclical reference to make sure the GC does its job * */ void OnUnload(object sender, RoutedEventArgs e) { Target.Host = null; Target = null; }