/// <summary> /// The post load operation /// </summary> public override bool PostLoad() { //return base.PostLoad(); if (!isLoaded) { return(false); } if (isPostLoaded) { return(true); } desktop.SetObjectNames(); PureObjectLabel.SetLabels(desktop.Objects); PureArrowLabel.SetLabels(desktop.Arrows); IEnumerable <IArrowLabel> arrows = desktop.Arrows; // SetParents(desktop); IEnumerable <object> components = desktop.Components; foreach (INamedComponent nc in components) { nc.Desktop = desktop; //nc.Parent = Object as INamedComponent; if (nc is IObjectLabel) { IObjectLabel ol = nc as IObjectLabel; if (ol.Object is IObjectContainer) { IObjectContainer oc = ol.Object as IObjectContainer; bool b = oc.PostLoad(); if (!b) { return(false); } } } } foreach (IArrowLabel arrow in arrows) { arrow.Desktop = desktop; ICategoryObject source = arrow.Arrow.Source; if (source == null) { arrow.Arrow.Source = arrow.Source.Object; } ICategoryObject target = arrow.Arrow.Target; if (target == null) { arrow.Arrow.Target = arrow.Target.Object; } IAssociatedObject ass = arrow.Arrow as IAssociatedObject; ass.Object = arrow; } return(true); }
/// <summary> /// Expands children /// </summary> public void Expand() { IObjectContainer cont = Object as IObjectContainer; cont.Load(); cont.PostLoad(); if (cont is ICategoryObject) { ICategoryObject ca = cont as ICategoryObject; ca.Object = this; } Dictionary <string, object> table = cont.Interface; foreach (string name in table.Keys) { INamedComponent c = cont[name]; object[] o = table[name] as object[]; ChildObjectLabel l = new ChildObjectLabel(this, name, c, o); inter.Add(l); ContainerPerformer.Children[c as IObjectLabel] = l; } }
/// <summary> /// The post load operation /// </summary> /// <returns></returns> public bool PostLoad() { try { PureObjectLabel.SetLabels(this.Objects); PureArrowLabel.SetLabels(this.Arrows); this.SetParents(); IEnumerable <object> components = Components; foreach (INamedComponent nc in components) { nc.Desktop = this; table[nc.Name] = nc; if (nc is IObjectLabel) { IObjectLabel ol = nc as IObjectLabel; if (ol.Object is IObjectContainer) { IObjectContainer oc = ol.Object as IObjectContainer; bool b = oc.PostLoad(); if (!b) { return(false); } } } } foreach (IArrowLabel arrow in arrows) { IObjectLabel source = null; IObjectLabel target = null; if (arrow.SourceNumber is Int32) { source = objects[(int)arrow.SourceNumber] as IObjectLabel; } else { object[] os = arrow.SourceNumber as object[]; IObjectLabel so = objects[(int)os[0]] as IObjectLabel; IObjectContainer sc = so.Object as IObjectContainer; source = sc[os[1] as string] as IObjectLabel; } if (arrow.TargetNumber is Int32) { target = objects[(int)arrow.TargetNumber] as IObjectLabel; } else { object[] ot = arrow.TargetNumber as object[]; IObjectLabel to = objects[(int)ot[0]] as IObjectLabel; IObjectContainer tc = to.Object as IObjectContainer; target = tc[ot[1] as string] as IObjectLabel; } arrow.Arrow.Source = source.Object; arrow.Arrow.Target = target.Object; arrow.Source = source; arrow.Target = target; IAssociatedObject ass = arrow.Arrow as IAssociatedObject; ass.Object = arrow; } return(true); } catch (Exception ex) { ex.ShowError(10); if (exceptions != null) { exceptions.Add(ex); } } return(false); }