Ejemplo n.º 1
0
 public MediatorForOptions(IDeviceOptionRepository deviceOptionRep,
                           IExchangeOptionRepository exchangeOptionRep,
                           ISerialPortOptionRepository serialPortOptionRep,
                           ITcpIpOptionRepository tcpIpOptionRep,
                           IHttpOptionRepository httpOptionRep)
 {
     _deviceOptionRep     = deviceOptionRep;
     _exchangeOptionRep   = exchangeOptionRep;
     _serialPortOptionRep = serialPortOptionRep;
     _tcpIpOptionRep      = tcpIpOptionRep;
     _httpOptionRep       = httpOptionRep;
 }
Ejemplo n.º 2
0
        public static async Task InitializeAsync(this ISerialPortOptionRepository rep)
        {
            //Если есть хотя бы 1 элемент то НЕ иннициализировать
            if (await rep.CountAsync(option => true) > 0)
            {
                return;
            }

            //var serials = new List<SerialOption>
            //{
            //    new SerialOption
            //    {
            //        Id = 1,
            //        Port = "COM1",
            //        BaudRate = 9600,
            //        DataBits = 8,
            //        DtrEnable = false,
            //        Parity = Parity.Even,
            //        StopBits = StopBits.One,
            //        AutoStart = true
            //    },
            //    //new SerialOption
            //    //{
            //    //    Id = 2,
            //    //    Port = "COM2",
            //    //    BaudRate = 9600,
            //    //    DataBits = 8,
            //    //    DtrEnable = false,
            //    //    Parity = Parity.Even,
            //    //    StopBits = StopBits.One,
            //    //    AutoStart = true
            //    //}
            //};

            //await rep.AddRangeAsync(serials);
        }