public static void AttachTo(IMediaFile mediaFile, TimeSpan fadeOnStart, TimeSpan fadeOnEnd, TimeSpan fadeOnPause, TimeSpan fadeOnResume) { Pair <WeakReference, WeakReference> pair; VolumeFader fader; fader = new VolumeFader(mediaFile, fadeOnStart, fadeOnEnd, fadeOnPause, fadeOnResume); pair = new Pair <WeakReference, WeakReference>(new WeakReference(fader), new WeakReference(mediaFile)); for (int i = 0; i < m_VolumeFaders.Count; i++) { Pair <WeakReference, WeakReference> pair2; pair2 = (Pair <WeakReference, WeakReference>)m_VolumeFaders[i]; if (((WeakReference)pair2.Left).Target == null || ((WeakReference)pair2.Right).Target == null) { m_VolumeFaders[i] = pair; return; } } m_VolumeFaders.Add(pair); }
public static void AttachTo(IMediaFile mediaFile, TimeSpan fadeOnStart, TimeSpan fadeOnEnd, TimeSpan fadeOnPause, TimeSpan fadeOnResume) { Pair<WeakReference, WeakReference> pair; VolumeFader fader; fader = new VolumeFader(mediaFile, fadeOnStart, fadeOnEnd, fadeOnPause, fadeOnResume); pair = new Pair<WeakReference, WeakReference>(new WeakReference(fader), new WeakReference(mediaFile)); for (int i = 0; i < m_VolumeFaders.Count; i++) { Pair<WeakReference, WeakReference> pair2; pair2 = (Pair<WeakReference, WeakReference>)m_VolumeFaders[i]; if (((WeakReference)pair2.Left).Target == null || ((WeakReference)pair2.Right).Target == null) { m_VolumeFaders[i] = pair; return; } } m_VolumeFaders.Add(pair); }