public void SetAction(Action Action) { // if (!Action.WorksOnLayoutView) // { // das ist jetzt besser gelöst mit "OnlyThisView" etc. // frame.AssureModelView(); // geht nur mit ModelView! // } if (Action.ChangeTabInControlCenter) { Action.returnToTabPage = frame.GetActivePropertyDisplay(); frame.ShowPropertyDisplay("Action"); } Action.ActionStack = this; Action.OnSetAction(); // erstes Ereigniss für die neue Aktion (noch nicht auf dem Stack) Frame.RaiseActionStartedEvent(Action); Action OldAction = null; if (Actions.Count > 0) { OldAction = Actions.Peek() as Action; } // folgende Schleife ist notwendig, da bei Inactivate eine Aktion sich // selbst entfernen kann. Dann aber bekommt die drunterliegende ein Activate // was gleich wieder von einem Inactivate gefolgt werden muss while (OldAction != null) { OldAction.OnInactivate(Action, false); // alte Aktion inaktivieren (kann sich auch verabschieden) if (Actions.Count > 0) { if (OldAction != Actions.Peek()) { OldAction = Actions.Peek() as Action; } else { OldAction = null; } } else { OldAction = null; } } Actions.Push(Action); Action.OnActivate(OldAction, true); }