コード例 #1
0
        /// <summary>
        /// 检查账号或者手机号是否存在
        /// </summary>
        /// <param name="accountMode"></param>
        /// <param name="account"></param>
        /// <param name="notId"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task <Result <bool> > GetUserAnyAsync(AccountMode accountMode, string account, long notId, CancellationToken cancellationToken = default)
        {
            var res = await adminUserService.AnyByAccountAsync(accountMode, account, notId, cancellationToken);

            return(RestFull.Success(data: res));
        }
コード例 #2
0
        public static IAppHost AddBot <TBot>(this IAppHost app, string configName, AccountMode mode = AccountMode.Unspecified)
        {
            throw new NotImplementedException();

            //return app;
        }
コード例 #3
0
        /// <summary>
        /// 获取账号信息(根据账号或手机号码)
        /// </summary>
        /// <param name="accountMode"></param>
        /// <param name="account"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task <Result <AdminUserDto> > GetUserByAccountAsync(AccountMode accountMode, string account, CancellationToken cancellationToken = default)
        {
            var res = await adminUserService.GetByAccountAsync(accountMode, account, cancellationToken);

            return(RestFull.Success(data: res));
        }
コード例 #4
0
 private void handleLogout(object sender, EventArgs args)
 {
     mode    = AccountMode.MAIN;
     Visible = Visibility.Collapsed;
 }
コード例 #5
0
 public async Task <Result <bool> > GetUserAnyAsync([Required] AccountMode accountMode, [Required] string account, [Required] long notId, CancellationToken cancellationToken = default)
 {
     return(await adminAppService.GetUserAnyAsync(accountMode, account, notId, cancellationToken));
 }
コード例 #6
0
 public async Task <Result <AdminUserDto> > GetUserByAccountAsync([Required] AccountMode accountMode, [Required] string account, CancellationToken cancellationToken = default)
 {
     return(await adminAppService.GetUserByAccountAsync(accountMode, account, cancellationToken));
 }
コード例 #7
0
        public static IAppHost AddTrading(this IAppHost appHost, TradingOptions defaultOptions = null, AccountMode accountModesAllowed = AccountMode.Unspecified)
        {
            if (defaultOptions == null)
            {
                defaultOptions = DefaultTradingOptions;
            }

            // FUTURE: find another way to get this to app during ConfigureServices
            TypeNamingContext tnc = ManualSingleton <TypeNamingContext> .GuaranteedInstance;

            tnc.UseShortNamesForDataAssemblies = true;

            PrioritizeAndThrottleDataJobs();

            appHost.ConfigureServices((Action <IServiceCollection>)(serviceCollection =>
            {
                //var Configuration = LionFire.Structures.ManualSingleton<IConfigurationRoot>.Instance;
                //serviceCollection.Configure<TradingOptions>(opt => Configuration.GetSection("Trading").Bind(opt));

                //app.ServiceCollection.AddSingleton<IAccountProvider, AccountProvider>(); FUTURE
                var tradingOptions = "Default".Load <TradingOptions>().Result;
                if (tradingOptions == null)
                {
                    tradingOptions = defaultOptions;
                }
                if (accountModesAllowed != AccountMode.Unspecified)
                {
                    defaultOptions.AccountModes &= accountModesAllowed;
                }
                //tradingOptions.EnableAutoSave();

                var tradingContext = new TradingContext((TradingOptions)tradingOptions);

                //DependencyContext.Current.AddSingleton(tradingOptions);
                //DependencyContext.Current.AddSingleton(tradingContext);
                serviceCollection.AddSingleton((TradingContext)tradingContext);
                serviceCollection.AddSingleton((TradingOptions)tradingContext.Options);

                //DependencyContext.SetSingletonDefault<TypeNamingContext>(tnc);  RECENTCHANGE - should no lonber be needed now that the app's IServiceProvider is used as the default for DependencyContext.

                serviceCollection.AddSingleton(tnc);
            }));


            AssetInstantiationStrategy.Enable();

            return(appHost);
        }