コード例 #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
ファイル: ApiFactory.cs プロジェクト: yuanshouji/AutumnBox
 /// <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
ファイル: ApiFactory.cs プロジェクト: yuanshouji/AutumnBox
 /// <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));
 }