public DrawableComponent SetCurrent <T>() { DrawableComponent provider = providers.Find(p => p is T); if (provider != null && !provider.IsEnabled) { foreach (DrawableComponent otherProvdider in providers) { otherProvdider.IsEnabled = false; } provider.IsEnabled = true; } return(provider); }
public void AddProvider(DrawableComponent newProvider, bool enable) { providers.Add(newProvider); if (enable) { foreach (DrawableComponent provider in providers) { provider.IsEnabled = false; } newProvider.IsEnabled = true; } else { newProvider.IsEnabled = false; } }
public DrawableComponent GetProviderByType <T>() { DrawableComponent result = providers.Find(p => p is T); if (result != null) { return(result); } else { result = backgroundProviders.Find(p => p is T); if (result != null) { return(result); } } throw new ArgumentException("Invalid Provider Type"); }
public void AddBackgroundProvider(DrawableComponent newBackgroundProvider) { backgroundProviders.Add(newBackgroundProvider); newBackgroundProvider.IsEnabled = true; newBackgroundProvider.Initialize(); }