public void ProcessLayouting() { if (Layoutable.Parent == null) //TODO:improve this //cancel layouting for object without parent, maybe some were in queue when //removed from a listbox { #if DEBUG_LAYOUTING Debug.WriteLine("ERROR: processLayouting, no parent for: " + this.ToString()); #endif return; } #if DEBUG_LAYOUTING LQITime.Start(); Debug.WriteLine("=> " + this.ToString()); #endif LayoutingTries++; if (!Layoutable.UpdateLayout(LayoutType)) { #if DEBUG_LAYOUTING Debug.WriteLine("\t\tRequeued"); #endif if (LayoutingTries < Interface.MaxLayoutingTries) { Layoutable.RegisteredLayoutings |= LayoutType; (Layoutable as GraphicObject).CurrentInterface.LayoutingQueue.Enqueue(this); } else if (DiscardCount < Interface.MaxDiscardCount) { #if DEBUG_LAYOUTING Debug.WriteLine("\t\tDiscarded"); #endif LayoutingTries = 0; DiscardCount++; Layoutable.RegisteredLayoutings |= LayoutType; (Layoutable as GraphicObject).CurrentInterface.DiscardQueue.Enqueue(this); } #if DEBUG_LAYOUTING else { Debug.WriteLine("\tDELETED => " + this.ToString()); } #endif } #if DEBUG_LAYOUTING else { if (LayoutingTries > 2 || DiscardCount > 0) { Debug.WriteLine(this.ToString()); } } LQITime.Stop(); #endif }
public void ProcessLayouting() { GraphicObject go = Layoutable as GraphicObject; // if (go == null) { // Debug.WriteLine ("ERROR: processLayouting on something else than a graphic object: " + this.ToString ()); // return; // } go.parentRWLock.EnterReadLock(); if (go.Parent == null) //TODO:improve this //cancel layouting for object without parent, maybe some were in queue when //removed from a listbox { #if DEBUG_UPDATE || DEBUG_LAYOUTING Debug.WriteLine("ERROR: processLayouting, no parent for: " + this.ToString()); #endif go.parentRWLock.ExitReadLock(); return; } #if DEBUG_LAYOUTING LQITime.Start(); Debug.WriteLine("=> " + this.ToString()); #endif LayoutingTries++; if (!Layoutable.UpdateLayout(LayoutType)) { #if DEBUG_LAYOUTING Debug.WriteLine("\t\tRequeued"); #endif if (LayoutingTries < Interface.MaxLayoutingTries) { Layoutable.RegisteredLayoutings |= LayoutType; (Layoutable as GraphicObject).IFace.LayoutingQueue.Enqueue(this); } else if (DiscardCount < Interface.MaxDiscardCount) { #if DEBUG_LAYOUTING Debug.WriteLine("\t\tDiscarded"); #endif LayoutingTries = 0; DiscardCount++; Layoutable.RegisteredLayoutings |= LayoutType; (Layoutable as GraphicObject).IFace.DiscardQueue.Enqueue(this); } // #if DEBUG_LAYOUTING else { Debug.WriteLine("\tDELETED => " + this.ToString()); } // #endif } else { if (LayoutingTries > 2 || DiscardCount > 0) { Debug.WriteLine(this.ToString()); } } #if DEBUG_LAYOUTING LQITime.Stop(); #endif go.parentRWLock.ExitReadLock(); }