//------------------------------------------------------ public static void AppliqueToForm(Form racine) { if (racine == null) { return; } racine.KeyPreview = true; racine.KeyDown -= m_handlerKey; CSessionClient session = CSessionClient.GetSessionUnique(); IInfoUtilisateur info = session != null?session.GetInfoUtilisateur() : null; bool bIsAdmin = false; if (info != null) { if (info.GetDonneeDroit(CDroitDeBaseSC2I.c_droitInterface) != null) { bIsAdmin = true; racine.KeyDown += m_handlerKey; } } CSetupVisibiliteControles setup = GetSetupForWindow(session, racine); if (setup != null && ( !bIsAdmin || (GetKeyState(0x10) & 0xF000) != 0xF000 || //SHIFT (GetKeyState(0x12) & 0xF000) != 0xF000)) //ALT { setup.Apply(racine, false); } }
//------------------------------------------------------ static void racine_KeyDown(object sender, KeyEventArgs e) { if (e.Alt && e.Shift && e.KeyCode == Keys.F7) { CSessionClient session = CSessionClient.GetSessionUnique(); IInfoUtilisateur info = session != null?session.GetInfoUtilisateur() : null; if (info != null) { if (info.GetDonneeDroit(CDroitDeBaseSC2I.c_droitInterface) != null) { CSetupVisibiliteControles setup = new CSetupVisibiliteControles(); Control ctrl = sender as Control; if (ctrl != null) { Form frm = ctrl.FindForm(); if (frm != null) { setup = GetSetupForWindow(session, frm); CFormSetupFenetreDynamique.ShowArbre(frm, setup); SetSetupForWindow(session, frm, setup); setup.Apply(frm, false); } } } } } }