private bool SetContainerContext(ContextInfo ci, IMediaContainer context) { bool retVal = false; bool fwd = false, bk = false; // check against forward contexts fwd = IsValidContext(context, ci.ForwardContexts, false); // check against current/entire context if (fwd == false) { bk = IsValidContext(context, ci.EntireContext, false); } // if selecting a valid context... if (fwd) { // going forward, so push the desired context // to our stack context lock (this) { ci.m_Context.Push(context); // if new context is a root container, set the server context if ((context.IsRootContainer) && (!(context is CpRootCollectionContainer))) { CpRootContainer root = context as CpRootContainer; if (root != null) { ci.m_ServerContext = root.Server; } } } retVal = true; } else if (bk) { lock(this) { // going back, so pop the stack until // we get to the desired context // and then refresh while ((this.CurrentContext != context) && (this.m_Context.m_Context.Count > 1)) { this.m_Context.m_Context.Pop(); } if (this.m_Context.m_Context.Count == 1) { this.m_Context.m_ServerContext = null; } } retVal = true; } return retVal; }
public void SetContext(ContextInfo ci) { // we'll track our progress using m_PendingContext this.m_PendingContext = new ContextInfo(); this.m_PendingContext.m_Context.Push(this.m_Roots.AllRoots); this.m_TargetContext = ci; // iterate through the container context in reverse order, // try to change context each time IList list = ci.EntireContext; for (int i= list.Count-1; i > 0; i--) { //TODO: } }
private void Init(int capacity) { this.m_Children = new ArrayList(); this.m_Roots = ContainerDiscovery.GetInstance(); this.m_Context = new ContextInfo(); this.m_Context.m_Context.Push(this.m_Roots.AllRoots); this.m_HistorySize = capacity; if (this.m_HistorySize > 0) { this.m_History = new ArrayList(capacity); } else { this.m_History = new ArrayList(); } }
public object Clone() { ContextInfo ci = new ContextInfo(); ci.m_Context = this.m_Context; ci.m_ServerContext = this.m_ServerContext; return ci; }