示例#1
0
        private Rest(string url, string projectName, IServiceCollection services, double sec, string login = "", string password = "")
        {
            _lite                 = new LiteClient(projectName);
            Url                   = url;
            ProjectName           = projectName;
            _client               = new RestClient(Url);
            _client.Authenticator = new HttpBasicAuthenticator(username: login, password: password);
            RestState.Client      = this;
            ICoreConfig config = new ClientConfig(_lite);

            services.AddSingleton(_lite);
            services.AddSingleton(config);
            timer          = new Timer();
            timer.Interval = sec * 1000;
            timer.Elapsed += updateService;
        }
示例#2
0
 public ClientConfig(LiteClient client)
 {
     _client = client;
     GetConfig();
 }