示例#1
0
 public object GetByType(Type type)
 {
     if (type == typeof(ILeafUI))
     {
         return(OpenFxLoader.BaseApi.NewLeafUI());
     }
     else if (type.Name.StartsWith(nameof(ILogger)))
     {
         return(LoggerFactory.Auto(leafInstance.GetType().Name));
     }
     else if (type == typeof(IDevice))
     {
         return(OpenFxLoader.BaseApi.SelectedDevice);
     }
     else if (type == typeof(Dictionary <string, object>))
     {
         return(ExtData);
     }
     else if (type == typeof(IEmbeddedFileManager))
     {
         return(new LeafEmb(leafInstance.GetType().Assembly));
     }
     else if (type == typeof(ICommandExecutor))
     {
         return(new HestExecutor());
     }
     else
     {
         return(OpenApiFactory.Get(type, leafInstance));
     }
 }
示例#2
0
        public override void Destory()
        {
            base.Destory();
            IStorageManager storageManager = OpenApiFactory.Get <IStorageManager>(this);

            storageManager.ClearCache();
        }
示例#3
0
 /// <summary>
 /// 初始化各种懒加载工厂方法
 /// </summary>
 private void InitFactory()
 {
     _lazyApp = new Lazy <IAppManager>(() =>
     {
         return(OpenApiFactory.Get <IAppManager>(this));
     });
     _lazyUX = new Lazy <IUx>(() =>
     {
         return(OpenApiFactory.Get <IUx>(this));
     });
     _lazyLogger = new Lazy <ILogger>(() =>
     {
         return(LoggerFactory.Auto(LoggingTag));
     });
     _lazyTmp = new Lazy <ITemporaryFloder>(() =>
     {
         return(OpenApiFactory.Get <ITemporaryFloder>(this));
     });
     _lazyEmb = new Lazy <IEmbeddedFileManager>(() =>
     {
         return(OpenApiFactory.Get <IEmbeddedFileManager>(this));
     });
 }
示例#4
0
 /// <summary>
 /// 平凡的,常见的API获取方法
 /// </summary>
 /// <param name="apiType"></param>
 /// <param name="requester"></param>
 /// <param name="arg"></param>
 /// <returns></returns>
 public static object Get(Type apiType, object requester, object arg = null)
 {
     return(OpenApiFactory.Get(apiType, requester, arg));
 }
示例#5
0
 /// <summary>
 /// 泛型的API获取方法
 /// </summary>
 /// <typeparam name="TApi"></typeparam>
 /// <param name="requester"></param>
 /// <param name="arg"></param>
 /// <returns></returns>
 public static TApi Get <TApi>(object requester = null, object arg = null)
 {
     return(OpenApiFactory.Get <TApi>(requester, arg));
 }