示例#1
0
 private static void ReleasePackage(FWidget widget)
 {
     if (widget != null)
     {
         UIPackageManager.GetInstance().ReleasePackage(widget.package);
     }
 }
示例#2
0
        //不受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);
        }
示例#3
0
        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);
        }
示例#4
0
        private static void OnCreateSuccess(GObject obj, FWidget widget, object args = null)
        {
            if (obj == null)
            {
                return;
            }

            widget.SetArgs(args);
            widget.InitWithObj(obj);

            RetainPackage(widget);
        }