Exemplo n.º 1
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);
      }
Exemplo n.º 2
0
      private void _btnAddTargetOnClick(object sender, EventArgs e) {
         if (_campaignInfo.PlatformId.IsEmpty == true) {
            MessageBox.Show("Select platform", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return;
         }

         if (_campaignInfo.DstInstallId.IsEmpty == true) {
            MessageBox.Show("Select target installation", "Target installation is empty", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return;
         }

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

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

         if (_campaignTargetsInfo == null) {
            _campaignTargetsInfo = new List<CampaignTargetInfoEx>();
         }

         _insertTargets(frm.SelectedDevices);
      }