public DeviceSimulatorViewModel(IDeviceSimulatorService deviceSimulatorService, 
                                        SimDeviceViewModel simDeviceViewModel,
                                        HeaderDevicesSimulatorViewModel addDevicesSimulatorNameViewModel,
                                        LoadDeviceSimulatorViewModel loadDeviceSimulatorViewModel)
        {
            _deviceSimulatorService = deviceSimulatorService;
            _selectedSimDevice = simDeviceViewModel;
            _headerDevicesSimulatorViewModel = addDevicesSimulatorNameViewModel;
            _loadDeviceSimulatorViewModel = loadDeviceSimulatorViewModel;

            //Default Add device win
            _headerDevicesSimulatorViewModel.Qty = 10;
            _headerDevicesSimulatorViewModel.QtyXml = 5;
            _headerDevicesSimulatorViewModel.SendTime = 2;

            //_simDeviceList = simDeviceList;
            _simDeviceList = new ObservableCollection<SimDeviceViewModel>();
            //Load default all data
            //_simDeviceList = _deviceSimulatorService.LoadAllSimDeviceViewModel();

            _statusWorkingList = deviceSimulatorService.GetAllStatusWorking();
            
            //Set pic control
            IconStartProperty = "Start-Disabled-icon.png";
            IconPauseProperty = "Pause-Disabled-icon.png";
            IconStopProperty = "Stop-Disabled-icon.png";
            StartText = "Start";

            SendCommand = new RelayCommand(Send, new Func<bool>(() =>
            {
                if (SelectedSimDevice == null) return false;
                return !string.IsNullOrEmpty(SelectedSimDevice.Imei);
            }));
        }
        public IList<SimDeviceViewModel> AddDevices(int qtyDevices, int qtyXml, int sendTime)
        {
            IList<SimDeviceViewModel> retSimDevices = new List<SimDeviceViewModel>();
            Random r = new Random();
            for (int i = 0; i < qtyDevices; i++)
            {
                var simDevice = new SimDeviceViewModel
                {
                    Imei = "SIM" + Convert.ToString(r.Next(0, 1000)).PadLeft(4, '0'),
                    Description = "Test",
                    SendTime = sendTime,
                    SendTotal = qtyXml,
                    Status = 0,
                    SendComplete = 0
                };

                retSimDevices.Add(simDevice);
            }
            return retSimDevices;
        }
        private List<SimDeviceViewModel> PreSimDevices()
        {
            var simDeviceViewModel = new List<SimDeviceViewModel>();

            string[] descs = { "James", "John", "Danny", "Michelle", "Tina", "Rachel", "Todd", "Elaine", "Tonya", "Derek", "Mike" };
            string[] imei = { "SIM001A", "SIM0002", "SIM0003", "SIM000X", "SIM00TT", "SIM00YU", "SIM0088", "SIM00PP", "SIM0078", "SIM00WW", "SIM00QW" };

            Random r2 = new Random();
            Random r = new Random();
            for (int i = 0; i < 10; i++)
            {
                int index = r.Next(0, 11);
                SimDeviceViewModel p = new SimDeviceViewModel
                {
                    Imei = imei[index],
                    Description = descs[index],
                    SendTotal = r2.Next(10, 90),
                };
                simDeviceViewModel.Add(p);
            }           

            return simDeviceViewModel;
        }
        public string SendPacket(SimDeviceViewModel simDeviceViewModel)
        {
            string ret = "";
            var simDevice = _header.GetByChildId(simDeviceViewModel.Id);

            simDevice.SendComplete = simDeviceViewModel.SendComplete;
            simDevice.Status = simDeviceViewModel.Status;
            simDevice.SendTime = simDeviceViewModel.SendTime;

            ret = _deviceSimService.SendPacket(simDevice);

            lock (_session)
            {
                _session.Persist(simDevice);
            }

            return ret;
        }
 public string SendPacket(SimDeviceViewModel simDeviceViewModel)
 {
     throw new NotImplementedException();
 }