//----------------------------------------------------------------- private void itemAddMenu_Click(object sender, EventArgs args) { CModeleTexte modele = new CModeleTexte(CSc2iWin32DataClient.ContexteCourant); modele.CreateNew(); modele.TypeAssocie = TypeObjet; if (CFormPopupEditeModeleTexte.EditeModele(modele)) { CResultAErreur result = modele.CommitEdit(); if (!result) { CFormAlerte.Afficher(result.Erreur.ToString(), EFormAlerteType.Erreur); } else { CTimosAppRegistre.SetModeleTexteForType(ModeleTexte, Contexte, TypeObjet); } } else { if (ModeleTexte != null) { ModeleTexte.CancelEdit(); } } }
public static CParametreTriGantt GetParametreTriGantt(IElementDeGantt eltGantt) { if (eltGantt == null) { return(null); } string strCle = "Gantt sort"; strCle += "-" + eltGantt.GanttBarId; string strSer = new CTimosAppRegistre().GetValue("preferences\\Gantt", strCle, ""); if (strSer != "") { CStringSerializer serializer = new CStringSerializer(strSer, ModeSerialisation.Lecture); CParametreTriGantt tri = null; try { if (serializer.TraiteObject <CParametreTriGantt>(ref tri)) { return(tri); } } catch { } } return(null); }
public static CModeleTexte GetModeleTexteForType(string strContexte, Type tp) { int nId = new CTimosAppRegistre().GetIntValue("Text models", GetCleModeleTexte(strContexte, tp), -1); if (nId > 0) { CModeleTexte modele = new CModeleTexte(CSc2iWin32DataClient.ContexteCourant); if (modele.ReadIfExists(nId)) { return(modele); } } return(null); }
//----------------------------------------------------------------- private void itemEditMenu_Click(object sender, EventArgs args) { CModeleTexte modele = ModeleTexte; if (modele != null) { modele.BeginEdit(); if (CFormPopupEditeModeleTexte.EditeModele(modele)) { modele.CommitEdit(); CTimosAppRegistre.SetModeleTexteForType(ModeleTexte, Contexte, TypeObjet); } else { modele.CancelEdit(); } } }
public static void AddToMenuParent(ToolStripMenuItem menu, string strContexte, object objet) { if (objet == null) { return; } CModeleTexte modeleSel = CTimosAppRegistre.GetModeleTexteForType(strContexte, objet.GetType()); CListeObjetsDonnees liste = new CListeObjetsDonnees(CSc2iWin32DataClient.ContexteCourant, typeof(CModeleTexte)); liste.Filtre = new CFiltreData(CModeleTexte.c_champTypeAssocie + "=@1", objet.GetType().ToString()); foreach (CModeleTexte modele in liste) { CMenuModeleTexte menuModele = new CMenuModeleTexte(modele, strContexte, objet); if (modeleSel != null && modele.Id == modeleSel.Id) { menuModele.Checked = true; } menuModele.MouseUp += new MouseEventHandler(menuModele.menuModele_MouseUp); menu.DropDownItems.Add(menuModele); } CSessionClient session = CSessionClient.GetSessionForIdSession(CSc2iWin32DataClient.ContexteCourant.IdSession); if (session != null) { IInfoUtilisateur info = session.GetInfoUtilisateur(); if (info != null && info.GetDonneeDroit(CDroitDeBaseSC2I.c_droitAdministration) != null) { menu.DropDownItems.Add(new ToolStripSeparator()); CMenuModeleTexte menuModeleAdd = new CMenuModeleTexte(null, strContexte, objet); menuModeleAdd.Text = I.T("Add|124"); menuModeleAdd.Click += new EventHandler(menuModeleAdd.itemAddMenu_Click); menu.DropDownItems.Add(menuModeleAdd); } } if (menu.DropDownItems.Count == 0) { menu.Visible = false; } }
//----------------------------------------------------------------- public void ShowToolTip(object objet) { if (objet == null) { return; } m_lastObjetPopup = objet; CModeleTexte modele = CTimosAppRegistre.GetModeleTexteForType(m_strContexte, objet.GetType()); if (modele != null) { if (m_lastControlMouseMove != null) { Point pt = m_lastControlMouseMove.PointToScreen(m_lastPoint); pt.Offset(16, 16); CRichTextViewerPopup.Popup(pt, modele, objet); } } }
//----------------------------------------------------------------- void menuModele_MouseUp(object sender, MouseEventArgs e) { if ((e.Button & MouseButtons.Right) == MouseButtons.Right) { CModeleTexte modele = ModeleTexte; if (modele != null) { modele.BeginEdit(); if (CFormPopupEditeModeleTexte.EditeModele(modele)) { modele.CommitEdit(); CTimosAppRegistre.SetModeleTexteForType(ModeleTexte, Contexte, TypeObjet); } else { modele.CancelEdit(); } } } else { CTimosAppRegistre.SetModeleTexteForType(ModeleTexte, Contexte, TypeObjet); } }