public override void Construct(MultiformConstructionArgs args) { var myForm = new MyForm("name"); SetUpdater(MainUpdate); SetRenderer(MainRender); }
internal void InternalConstruct(MultiformConstructionArgs args) { TimesActivated++; if (reconstructable && TimesActivated > 1) { Reconstruct(args); } else { Construct(args); } }
/// <summary> /// Activate the multiform with the given name. /// </summary> /// <param name="name"></param> public void Activate(Multiform sender, string name, MultiformConstructionArgs args = null) { if (ActiveMultiforms.ContainsKey(name)) { throw new MultiformManagerException( String.Format("Multiform with name '{0}' has already been constructed.", name)); } if (!RegisteredMultiforms.ContainsKey(name)) { throw new MultiformManagerException( String.Format("No multiform with name '{0}' exists.", name)); } var multiform = RegisteredMultiforms[name]; if (multiform.TransitionConstraints != null) { var constraints = multiform.TransitionConstraints; var senderName = sender == null ? null : sender.Name; if ((constraints.AllowedFrom != null && !constraints.AllowedFrom.Contains(senderName)) || (constraints.NotAllowedFrom != null && constraints.NotAllowedFrom.Contains(senderName))) { if (senderName == null) { throw new MultiformManagerException( String.Format( "The transition constraints on multiform '{0}' prevent it from " + "being used as the initial multiform in the engine.", name ) ); } throw new MultiformManagerException( String.Format( "The transition constraints on multiform '{0}' prevent the multiform '{1}' from " + "being able to transition to it.", name, senderName ) ); } } args = args == null ? new MultiformConstructionArgs(sender) : args; ApplyOrQueueEvent(new ActivateEvent(name, args)); }
public ActivateEvent(string name, MultiformConstructionArgs args) { this.name = name; this.args = args; }
public override void Construct(MultiformConstructionArgs args) { SetUpdater(MainUpdate); SetRenderer(MainRender); }
/// <summary> /// The auxiliary constructor called every time after the first time the multiform is /// activated. This is only used if the multiform is decorated with a ReconstructMultiform /// attribute. /// </summary> public virtual void Reconstruct(MultiformConstructionArgs args) { }
/// <summary> /// The main constructor for the multiform. This is called every time this multiform /// instance is switched to by the MultiformManager. /// </summary> public abstract void Construct(MultiformConstructionArgs args);