예제 #1
0
         public DeviceListItem(DeviceLogisticInfo device) {
            _device = device;

            Text = _device.DeviceId.LocalId.ToString();

            SubItems.Add((_device.Operator != null) ? _device.Operator.Id.ToString(false) : "N/A");
            SubItems.Add((!_device.VehicleId.IsEmpty) ? _device.VehicleId.LocalId.ToString() : "N/A");
            SubItems.Add((_device.VehicleSN != null) ? _device.VehicleSN : "N/A");
            SubItems.Add((_device.LicensePlate != null) ? _device.LicensePlate : "N/A");

            if (_device.ImageVersionNumber != 0) {
               var v = SwlVersion.FromInt32(_device.ImageVersionNumber);
               SubItems.Add(string.Format("{0:000}.{1:000}.{2:00000}", v.Major, v.Minor, v.Release));
            } else {
               SubItems.Add("");
            }

            if (_device.ConfigVersionNumber != 0) {
               var v = SwlVersion.FromInt32(_device.ConfigVersionNumber);
               SubItems.Add(string.Format("{0:000}.{1:000}.{2:00000}", v.Major, v.Minor, v.Release));
            } else {
               SubItems.Add("");
            }
            SubItems.Add((!_device.PlatformId.IsEmpty) ? _device.PlatformId.LocalId.ToString() : "N/A");

            SubItems.Add((!_device.BatteryId.IsEmpty) ? _device.BatteryId.LocalId.ToString() : "N/A");
            SubItems.Add((_device.BatterySN != null) ? _device.BatterySN : "N/A");
         }
예제 #2
0
         public DeviceListItem(DeviceLogisticInfo device) {
            _device = device;

            Text = _device.DeviceId.LocalId.ToString();

            SubItems.Add((_device.Operator != null) ? _device.Operator.Id.ToString(false) : "N/A");
            SubItems.Add((!_device.VehicleId.IsEmpty) ? _device.VehicleId.LocalId.ToString() : "N/A");
            SubItems.Add((_device.VehicleSN != null) ? _device.VehicleSN : "N/A");
            SubItems.Add((_device.LicensePlate != null) ? _device.LicensePlate : "N/A");

            if (_device.ImageVersionNumber != 0) {
               SubItems.Add(SwlVersion.FromInt32(_device.ImageVersionNumber).Format());
            } else {
               SubItems.Add("");
            }

            if (_device.ConfigVersionNumber != 0) {
               SubItems.Add(SwlVersion.FromInt32(_device.ConfigVersionNumber).Format());
            } else {
               SubItems.Add("");
            }
         }
예제 #3
0
      private void _btnDeviceAddOnClick(object sender, EventArgs e) {
         if (_selectedTask == null) {
            MessageBox.Show("Select task first", "Task not selected", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            return;
         }

         var exclDev = new List<DeviceLogisticInfo>();

         foreach (var item in listDevices.Items) {
            var deviceItem = (DeviceListItem)item;

            var di = new DeviceLogisticInfo();
            di.DeviceId = deviceItem.Device.DeviceId;
            exclDev.Add(di);
         }

         var frm = new FrmSelectDevice(exclDev);
         var dr = frm.ShowDialog(this);
         if (dr != DialogResult.OK) {
            return;
         }

         if ((frm.SelectedDevices == null) || (frm.SelectedDevices.Count == 0)) {
            return;
         }

         var req = new AddDevicesToDiagnosticsTask();
         req.TaskId = _selectedTask.TaskId;
         req.DeviceIds = frm.SelectedDevices.Select(d => d.DeviceId).ToArray();

         SendRequest(req);
      }