Exemple #1
0
        /// <inheritdoc />
        public ICardContextLayer RequestLayer(ICardContextLayer layer, SearchMode mode)
        {
            if (layers.Count == 0)
            {
                throw new Exception("CardContextStack.requestLayer(): no layers defined in the stack");
            }
            switch (mode)
            {
            case SearchMode.Bottom:
                return(layers[layers.Count - 1]);

            case SearchMode.Next:
                return(layers.Following(l => l.LayerId == layer.LayerId));

            case SearchMode.Previous:
                return(layers.Preceding(l => l.LayerId == layer.LayerId));

            case SearchMode.Top:
                return(layers[0]);

            default:
                throw new NotSupportedException(String.Format("CardContextStack.requestLayer(): Seek mode '{0}' unknown", mode));
            }
        }
Exemple #2
0
        /// <summary>
        /// Encapsulates an <see cref="ICardContextLayer"/> and add <see cref="ICardContextLayerObservable"/> behaviour.
        /// </summary>
        /// <param name="layer">Card context to encapsulate.</param>
        /// <returns></returns>
        public static ICardContextLayerObservable ToObservableLayer(this ICardContextLayer layer)
        {
            var layerObservable = layer as ICardContextLayerObservable;

            return(layerObservable ?? new CardContextLayerObservable(layer));
        }
Exemple #3
0
        /// <inheritdoc />
        public ICardContextLayer RequestLayer(ICardContextLayer layer, SearchMode mode)
        {
            var stack = (ICardContextStack)context;

            return(stack.RequestLayer(layer, mode));
        }
Exemple #4
0
        /// <inheritdoc />
        public void ReleaseLayer(ICardContextLayer layer)
        {
            var stack = (ICardContextStack)context;

            stack.ReleaseLayer(layer);
        }
Exemple #5
0
        /// <inheritdoc />
        public void AddLayer(ICardContextLayer layer)
        {
            var stack = (ICardContextStack)context;

            stack.AddLayer(layer);
        }
Exemple #6
0
 /// <inheritdoc />
 public void ReleaseLayer(ICardContextLayer layer)
 {
     layers.Remove(layer);
 }
Exemple #7
0
 /// <inheritdoc />
 public void AddLayer(ICardContextLayer layer)
 {
     layers.Add(layer);
     layer.SetStack(this);
 }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 /// <param name="contextLayer"><b>ICardContext</b> instance to wrap.</param>
 public CardContextLayerObservable(ICardContextLayer contextLayer)
     : base(contextLayer)
 {
 }