/// //////////////////////////////////////////////////////////// public void FillNode(TreeNode node, CObjetDonneeAIdNumeriqueAuto objet) { if (objet != null) { string strText = ""; if (m_formuleLibelle != null) { CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(objet); CResultAErreur result = m_formuleLibelle.Eval(ctx); if (result && result.Data != null) { strText = result.Data.ToString(); } } if (strText.Length == 0) { strText = CInterpreteurTextePropriete.GetStringValue(objet, m_strProprieteAffichee, "Non def"); } node.Text = strText; } CInfoNode info; if (node.Tag is CInfoNode) { info = (CInfoNode)node.Tag; } else { info = new CInfoNode(); } info.Objet = objet; node.Tag = info; }
//----------------------------------------------------------------- public static string GetDonneeDynamiqueString(object obj, string strPropriete, string strValeurSiNull) { string strSuite = ""; CDefinitionProprieteDynamique defProp = GetDefinitionProprieteDynamique(strPropriete, ref strSuite); if (defProp != null) { try { object retour = CInterpreteurProprieteDynamique.GetValue(obj, defProp).Data; if (retour == null) { return(strValeurSiNull); } if (strSuite != "") { return(GetDonneeDynamiqueString(retour, strSuite, strValeurSiNull)); } return(retour.ToString()); } catch { return(strValeurSiNull); } } try { return(CInterpreteurTextePropriete.GetStringValue(obj, strPropriete, strValeurSiNull)); } catch { return(strValeurSiNull); } }
//------------------------------------------------------------------ private void SynchroniseTextEtObjet() { if (m_selectedObject == null) { Text = TextNull; } else { Text = CInterpreteurTextePropriete.GetStringValue(m_selectedObject, m_strPropriete, ""); } m_strOldText = Text; }
//------------------------------------------------------------------ private void SynchroniseTextEtObjet() { if (m_selectedEntity == null) { Text = TextNull; } else { foreach (CConfigTextBoxSelectMemoryDb config in m_listeConfigs) { if (config.TypeObjets != null && config.TypeObjets.IsAssignableFrom(m_selectedEntity.GetType())) { Text = CInterpreteurTextePropriete.GetStringValue(m_selectedEntity, config.ProprieteAffichee, ""); break; } } } m_strOldText = Text; UpdateImage(); }
private void InitIntellisense() { if (m_dicIntellisense == null) { m_dicIntellisense = new Dictionary <string, HashSet <CReferenceEntiteMemoryDb> >(); HashSet <string> setMots = new HashSet <string>(); try { if (m_listeConfigs != null && m_bUseIntellisense) { foreach (CConfigTextBoxSelectMemoryDb config in m_listeConfigs) { try { CListeEntitesDeMemoryDbBase lstObjs = new CListeEntitesDeMemoryDbBase(m_currentMemoryDb, config.TypeObjets); CFiltreMemoryDb filtre = config.FiltreDeBase; lstObjs.Filtre = filtre; if (lstObjs.Count() < 4000) { foreach (CEntiteDeMemoryDb obj in lstObjs) { string strText = CInterpreteurTextePropriete.GetStringValue(obj, config.ProprieteAffichee, ""); if (strText.Trim().Length > 0) { strText = strText.Trim(); HashSet <string> lstStrings = new HashSet <string>(); lstStrings.Add(strText); int nIndex = strText.IndexOf(' '); while (nIndex >= 0) { strText = strText.Substring(nIndex + 1).Trim(); lstStrings.Add(strText); nIndex = strText.IndexOf(' '); } foreach (string strMotTmp in strText.Split(' ')) { if (strMotTmp.Length > 2) { if (strMotTmp.Trim().Length > 0) { lstStrings.Add(strMotTmp); } } } CReferenceEntiteMemoryDb refObj = new CReferenceEntiteMemoryDb(obj); foreach (string strMot in lstStrings) { HashSet <CReferenceEntiteMemoryDb> lst = null; foreach (string strMotToutSeul in strMot.Split(' ')) { if (!m_dicIntellisense.TryGetValue(strMotToutSeul.ToUpper(), out lst)) { lst = new HashSet <CReferenceEntiteMemoryDb>(); m_dicIntellisense[strMotToutSeul.ToUpper()] = lst; } lst.Add(refObj); } if (!m_dicIntellisense.TryGetValue(strMot.ToUpper(), out lst)) { lst = new HashSet <CReferenceEntiteMemoryDb>(); m_dicIntellisense[strMot.ToUpper()] = lst; } lst.Add(refObj); setMots.Add(strMot); } } } } } catch { } } } m_textBox.AutoCompleteSource = AutoCompleteSource.CustomSource; m_textBox.AutoCompleteMode = AutoCompleteMode.Suggest; m_textBox.AutoCompleteCustomSource.Clear(); m_textBox.AutoCompleteCustomSource.AddRange(setMots.ToArray()); } catch { } } }
private void InitIntellisense() { if (m_dicIntellisense == null) { m_dicIntellisense = new Dictionary <string, HashSet <CReferenceObjetDonnee> >(); HashSet <string> setMots = new HashSet <string>(); try { if (m_listeConfigs != null && m_bUseIntellisense) { foreach (CConfigTextBoxFiltreRapide config in m_listeConfigs) { try { /*if (!typeof(IObjetALectureTableComplete).IsAssignableFrom(config.TypeObjets)) * continue;//Ne met en intellisense que ce qui est en lectutre table complète*/ CListeObjetsDonnees lstObjs = new CListeObjetsDonnees(CSc2iWin32DataClient.ContexteCourant, config.TypeObjets); CFiltreData filtre = config.FiltreDeBase; lstObjs.Filtre = filtre; if (lstObjs.CountNoLoad < 4000) { foreach (CObjetDonnee obj in lstObjs) { string strText = CInterpreteurTextePropriete.GetStringValue(obj, config.ProprieteAffichee, ""); if (strText.Trim().Length > 0) { strText = strText.Trim(); HashSet <string> lstStrings = new HashSet <string>(); lstStrings.Add(strText); int nIndex = GetIndexSeparateurNextWord(strText); // strText.IndexOf(' '); while (nIndex >= 0) { strText = strText.Substring(nIndex + 1).Trim(); lstStrings.Add(strText); nIndex = GetIndexSeparateurNextWord(strText); //nIndex = strText.IndexOf(' '); } foreach (string strMotTmp in strText.Split(' ')) { if (strMotTmp.Length > 2) { if (strMotTmp.Trim().Length > 0) { lstStrings.Add(strMotTmp); } } } CReferenceObjetDonnee refObj = new CReferenceObjetDonnee(obj); foreach (string strMot in lstStrings) { HashSet <CReferenceObjetDonnee> lst = null; foreach (string strMotToutSeul in strMot.Split(' ')) { if (!m_dicIntellisense.TryGetValue(strMotToutSeul.ToUpper(), out lst)) { lst = new HashSet <CReferenceObjetDonnee>(); m_dicIntellisense[strMotToutSeul.ToUpper()] = lst; } lst.Add(refObj); } if (!m_dicIntellisense.TryGetValue(strMot.ToUpper(), out lst)) { lst = new HashSet <CReferenceObjetDonnee>(); m_dicIntellisense[strMot.ToUpper()] = lst; } lst.Add(refObj); setMots.Add(strMot); } } } } } catch { } } } m_textBox.AutoCompleteSource = AutoCompleteSource.CustomSource; m_textBox.AutoCompleteMode = AutoCompleteMode.Suggest; m_textBox.AutoCompleteCustomSource.Clear(); m_textBox.AutoCompleteCustomSource.AddRange(setMots.ToArray()); } catch { } } }