Exemple #1
0
        private int Add(string id, BitmapProvider provider)
        {
            lock (this)
            {
                Task <ManagedBitmap> bitmap = new Task <ManagedBitmap>(
                    delegate()
                {
                    try
                    {
                        return(provider());
                    }
                    catch (Exception exception)
                    {
                        if (EnableTrace)
                        {
                            Program.Log(LogCat.Cache, String.Format(
                                            "{0} ImageCache: provider threw exception: {2}{1}",
                                            DateTime.Now,
                                            Environment.NewLine,
                                            exception));
                        }
                    }
                    return(ManagedBitmap.CreateFromGDI(new Bitmap(Properties.Resources.InvalidPlaceHolder)));
                });

                Entry entry = new Entry(id, bitmap);
                entry.BitmapCompleted += delegate(object sender, EventArgs args) { SwapOutOverLimit(); };
                entries.Insert(0, entry);
                Trace("add", entry);

                PurgeDisposeList();
                return(0);
            }
        }
Exemple #2
0
        // operations

        public BitmapHolder Query(string id, BitmapProvider provider)
        {
            BitmapHolder holder;

            lock (this)
            {
                Entry entry;
                {
                    bool added = false;

                    int i = entries.FindIndex(delegate(Entry candidate) { return(String.Equals(id, candidate.Id, StringComparison.OrdinalIgnoreCase)); });
                    if (i < 0)
                    {
                        i     = Add(id, provider);
                        added = true;
                    }
                    entry  = entries[i];
                    holder = new BitmapHolder(this, entry);
                    if (added || entry.SwappedOut)
                    {
                        entry.EnsureBitmapTaskStarted(); // start creation, or initiate swap-in before any swap-out is started below (swap-in gets disk access priority)
                    }

                    entries.RemoveAt(i);
                    entries.Insert(0, entry);

                    hits = unchecked (hits + 1);
                }

                PurgeDisposeList();
            }

            return(holder);
        }
Exemple #3
0
        public static Ice.DispatchStatus helloWorld___(BitmapProvider obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.istr();
            is__.startReadEncaps();
            string something;

            something = is__.readString();
            is__.endReadEncaps();
            IceInternal.BasicStream os__ = inS__.ostr();
            string ret__ = obj__.helloWorld(something, current__);

            os__.writeString(ret__);
            return(Ice.DispatchStatus.DispatchOK);
        }
Exemple #4
0
        public static Ice.DispatchStatus getBitmap___(BitmapProvider obj__, IceInternal.Incoming inS__, Ice.Current current__)
        {
            checkMode__(Ice.OperationMode.Normal, current__.mode);
            IceInternal.BasicStream is__ = inS__.istr();
            is__.startReadEncaps();
            float ex;

            ex = is__.readFloat();
            float ey;

            ey = is__.readFloat();
            float ez;

            ez = is__.readFloat();
            float dx;

            dx = is__.readFloat();
            float dy;

            dy = is__.readFloat();
            float dz;

            dz = is__.readFloat();
            float ax;

            ax = is__.readFloat();
            float ay;

            ay = is__.readFloat();
            float az;

            az = is__.readFloat();
            float timer;

            timer = is__.readFloat();
            float depthOfField;

            depthOfField = is__.readFloat();
            float transparentColor;

            transparentColor = is__.readFloat();
            is__.endReadEncaps();
            IceInternal.BasicStream os__ = inS__.ostr();
            byte[] ret__ = obj__.getBitmap(ex, ey, ez, dx, dy, dz, ax, ay, az, timer, depthOfField, transparentColor, current__);
            os__.writeByteSeq(ret__);
            return(Ice.DispatchStatus.DispatchOK);
        }
Exemple #5
0
        public string helloWorld(string something, _System.Collections.Generic.Dictionary <string, string> context__)
        {
            Ice.Current current__ = new Ice.Current();
            initCurrent__(ref current__, "helloWorld", Ice.OperationMode.Normal, context__);
            string result__ = null;

            IceInternal.Direct.RunDelegate run__ = delegate(Ice.Object obj__)
            {
                BitmapProvider servant__ = null;
                try
                {
                    servant__ = (BitmapProvider)obj__;
                }
                catch (_System.InvalidCastException)
                {
                    throw new Ice.OperationNotExistException(current__.id, current__.facet, current__.operation);
                }
                result__ = servant__.helloWorld(something, current__);
                return(Ice.DispatchStatus.DispatchOK);
            };
            IceInternal.Direct direct__ = null;
            try
            {
                direct__ = new IceInternal.Direct(current__, run__);
                try
                {
                    Ice.DispatchStatus status__ = direct__.servant().collocDispatch__(direct__);
                    _System.Diagnostics.Debug.Assert(status__ == Ice.DispatchStatus.DispatchOK);
                }
                finally
                {
                    direct__.destroy();
                }
            }
            catch (Ice.SystemException)
            {
                throw;
            }
            catch (_System.Exception ex__)
            {
                IceInternal.LocalExceptionWrapper.throwWrapper(ex__);
            }
            return(result__);
        }
        public FilterConfigurationModel(IConfigurableInputProvider inputProvider)
        {
            this.inputProvider = inputProvider;
            AcceptCommand      = new AcceptFilterConfigurationCommand(this);
            Filters            = new ObservableCollection <FilterModel>();

            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                BitmapProvider provider = inputProvider as BitmapProvider;
                if (provider != null)
                {
                    foreach (IFilter filter in provider.Filters)
                    {
                        Filters.Add(new FilterModel(filter));
                    }
                    provider.FilterUpdated += NewFrame;
                }
            }
        }
Exemple #7
0
 public byte[] getBitmap(float ex, float ey, float ez, float dx, float dy, float dz, float ax, float ay, float az, float timer, float depthOfField, float transparentColor, _System.Collections.Generic.Dictionary <string, string> context__)
 {
     Ice.Current current__ = new Ice.Current();
     initCurrent__(ref current__, "getBitmap", Ice.OperationMode.Normal, context__);
     byte[] result__ = null;
     IceInternal.Direct.RunDelegate run__ = delegate(Ice.Object obj__)
     {
         BitmapProvider servant__ = null;
         try
         {
             servant__ = (BitmapProvider)obj__;
         }
         catch (_System.InvalidCastException)
         {
             throw new Ice.OperationNotExistException(current__.id, current__.facet, current__.operation);
         }
         result__ = servant__.getBitmap(ex, ey, ez, dx, dy, dz, ax, ay, az, timer, depthOfField, transparentColor, current__);
         return(Ice.DispatchStatus.DispatchOK);
     };
     IceInternal.Direct direct__ = null;
     try
     {
         direct__ = new IceInternal.Direct(current__, run__);
         try
         {
             Ice.DispatchStatus status__ = direct__.servant().collocDispatch__(direct__);
             _System.Diagnostics.Debug.Assert(status__ == Ice.DispatchStatus.DispatchOK);
         }
         finally
         {
             direct__.destroy();
         }
     }
     catch (Ice.SystemException)
     {
         throw;
     }
     catch (_System.Exception ex__)
     {
         IceInternal.LocalExceptionWrapper.throwWrapper(ex__);
     }
     return(result__);
 }
 public BoxBuilder(AddonConfigProvider config, BitmapProvider bitmapProvider)
 {
     _addonConfig    = config;
     _bitmapProvider = bitmapProvider;
 }