示例#1
0
 public TPLinkSmartDimmer(string hostName, int port = 9999, DimmerOptions opts = null) : base(hostName, port)
 {
     Task.Run(async() =>
     {
         this._options = opts ?? new DimmerOptions();
         await Refresh().ConfigureAwait(false);
     }).GetAwaiter().GetResult();
 }
示例#2
0
        public static async Task <TPLinkSmartDimmer> Create(string hostname, int port = 9999, DimmerOptions opts = null)
        {
            var d = new TPLinkSmartDimmer()
            {
                Hostname = hostname, Port = port
            };

            d._options = opts ?? new DimmerOptions();
            await d.Refresh().ConfigureAwait(false);

            return(d);
        }