private void InitOperationsPrev() { m_panelOperationsPrev.SuspendDrawing(); if (m_panelOperationsPrev.Controls.Count > 0) { m_ctrlPrevOperation = (CEditeurOperationsPreventives)m_panelOperationsPrev.Controls[0]; m_ctrlPrevOperation.Visible = false; } if (Intervention.Operations.Count > 0) { CEditeurOperationsPreventives ctrl = null; if (m_ctrlPrevOperation != null) { ctrl = m_ctrlPrevOperation; m_ctrlPrevOperation = null; } else { ctrl = new CEditeurOperationsPreventives(); m_panelOperationsPrev.Controls.Add(ctrl); } ctrl.Dock = DockStyle.Fill; ctrl.BringToFront(); ctrl.Visible = true; ctrl.LockEdition = !m_gestionnaireModeEdition.ModeEdition; ctrl.Init(Intervention); ctrl.Focus(); m_lnkAddOperation.Enabled = false; } else { m_ctrlPrevOperation = null; foreach (Control control in m_panelOperationsPrev.Controls) { if (control is CEditeurOperationsPreventives) { m_panelOperationsPrev.Controls.Remove(control); } } } m_panelOperationsPrev.ResumeDrawing(); }
//-------------------------------------------------------------- private void AjouterOperationsPrev() { CResultAErreur result = CResultAErreur.True; if (Intervention.ElementAIntervention != null) { CEditeurOperationsPreventives ctrl = new CEditeurOperationsPreventives(); m_panelOperationsPrev.Controls.Add(ctrl); ctrl.Dock = DockStyle.Fill; ctrl.BringToFront(); ctrl.Visible = true; ctrl.LockEdition = !m_gestionnaireModeEdition.ModeEdition; ctrl.Init(Intervention); ctrl.Focus(); m_lnkAddOperation.Enabled = false; } else { result.EmpileErreur(I.T("There is no Site associated to this Intervention|1167")); CFormAlerte.Afficher(result.Erreur); } }