예제 #1
0
        //-----------------------------------------------------------------
        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();
                }
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        //-----------------------------------------------------------------
        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();
                }
            }
        }
예제 #5
0
        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;
            }
        }
예제 #6
0
        //-----------------------------------------------------------------
        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);
                }
            }
        }
예제 #7
0
 //-----------------------------------------------------------------
 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);
     }
 }