Exemplo n.º 1
0
        void IRedraw.Redraw()
        {
            IBitmapConsumer cons = trans;

            cons.Process();
            pan.Refresh();
        }
        /// <summary>
        /// Gets names of providers
        /// </summary>
        /// <param name="consumer">Consumer</param>
        /// <returns>Names of providers</returns>
        public static IEnumerable <string> GetProviders(this IBitmapConsumer consumer)
        {
            IAssociatedObject ao = consumer as IAssociatedObject;

            foreach (IBitmapProvider p in consumer.Providers)
            {
                yield return(ao.GetRelativeName(p as IAssociatedObject));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Updates consumer
        /// </summary>
        /// <param name="consumer">Consumer</param>
        public static void Update(IBitmapConsumer consumer)
        {
            IEnumerable <IBitmapProvider> providers = consumer.Providers;

            foreach (IBitmapProvider provider in providers)
            {
                if (provider is IBitmapConsumer)
                {
                    IBitmapConsumer c = provider as IBitmapConsumer;
                    Update(c);
                }
            }
            consumer.Process();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets provider for consumer
        /// </summary>
        /// <param name="provider">Provider</param>
        /// <param name="consumer">Consumer</param>
        /// <param name="mutipleProviders">The multiple providers flag</param>
        /// <returns>The provider</returns>
        public static IBitmapProvider GetProvider(IBitmapProvider provider, IBitmapConsumer consumer, bool mutipleProviders)
        {
            if (provider == null)
            {
                return(null);
            }
            if (!mutipleProviders)
            {
                if ((provider != null) & consumer.Providers != null)
                {
                    // throw new Exception("Bitmap provider already exists");
                }
            }
            ICategoryObject t = provider as ICategoryObject;
            ICategoryObject s = consumer as ICategoryObject;

            if (s.Object != null & t.Object != null)
            {
                INamedComponent ns = s.Object as INamedComponent;
                INamedComponent nt = t.Object as INamedComponent;
                if (nt != null & ns != null)
                {
                    if (nt.Desktop == ns.Desktop)
                    {
                        if (nt.Ord >= ns.Ord)
                        {
                            throw new Exception(SetProviderBefore);
                        }
                    }
                    else
                    {
                        if (nt.Root.Ord >= ns.Root.Ord)
                        {
                            throw new Exception(SetProviderBefore);
                        }
                    }
                }
            }
            return(provider);
        }