private static void ReleasePackage(FWidget widget) { if (widget != null) { UIPackageManager.GetInstance().ReleasePackage(widget.package); } }
//不受ViewManager管理 public static FWidget Create(Type cls, Action <FWidget> callback, object args = null) { System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly(); FWidget widget = asm.CreateInstance(cls.FullName) as FWidget; if (widget != null) { string packageName = widget.package; string componentName = widget.component; widget.__isCreating = true; FComponent.Create <FComponent>(packageName, componentName, widget.isAsync, (fComponent) => { widget.__isCreating = false; if (widget.__isDisposed) { widget.__isDisposed = false; fComponent.Dispose(); return; } OnCreateSuccess(fComponent.GetObject(), widget, args); callback?.Invoke(widget); }); } return(widget); }
public static T Create <T>(FWidget parent = null, object args = null) where T : FWidget, new() { T view = Create(typeof(T), null, args) as T; if (parent != null) { parent.AddChild(view); } return(view); }
private static void OnCreateSuccess(GObject obj, FWidget widget, object args = null) { if (obj == null) { return; } widget.SetArgs(args); widget.InitWithObj(obj); RetainPackage(widget); }