예제 #1
0
        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);
        }
예제 #2
0
 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;
     }
 }
예제 #3
0
        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");
        }
예제 #4
0
 public void AddBackgroundProvider(DrawableComponent newBackgroundProvider)
 {
     backgroundProviders.Add(newBackgroundProvider);
     newBackgroundProvider.IsEnabled = true;
     newBackgroundProvider.Initialize();
 }