public void RefreshNodes() { foreach (TreeNode objTypeNode in treCharacterList.Nodes) { foreach (TreeNode objCharacterNode in objTypeNode.Nodes) { CharacterCache objCache = objCharacterNode.Tag as CharacterCache; if (objCache != null) { objCharacterNode.Text = objCache.CalculatedName(); objCharacterNode.ToolTipText = objCache.FilePath.CheapReplace(Utils.GetStartupPath, () => '<' + Application.ProductName + '>'); if (!string.IsNullOrEmpty(objCache.ErrorText)) { objCharacterNode.ForeColor = Color.Red; objCharacterNode.ToolTipText += Environment.NewLine + Environment.NewLine + LanguageManager.GetString( "String_Error", GlobalOptions.Language) + LanguageManager.GetString( "String_Colon", GlobalOptions.Language) + Environment.NewLine + objCache.ErrorText; } else { objCharacterNode.ForeColor = SystemColors.WindowText; } } } } }
/// <summary> /// Generates a character cache, which prevents us from repeatedly loading XmlNodes or caching a full character. /// </summary> /// <param name="strFile"></param> private static TreeNode CacheCharacter(string strFile) { CharacterCache objCache = new CharacterCache(strFile); TreeNode objNode = new TreeNode { Text = objCache.CalculatedName(), ToolTipText = objCache.FilePath.CheapReplace(Utils.GetStartupPath, () => '<' + Application.ProductName + '>'), Tag = objCache }; if (!string.IsNullOrEmpty(objCache.ErrorText)) { objNode.ForeColor = Color.Red; objNode.ToolTipText += Environment.NewLine + Environment.NewLine + LanguageManager.GetString("String_Error") + LanguageManager.GetString("String_Colon") + Environment.NewLine + objCache.ErrorText; } return(objNode); }
/// <summary> /// Generates a character cache, which prevents us from repeatedly loading XmlNodes or caching a full character. /// </summary> /// <param name="strFile"></param> private TreeNode CacheCharacter(string strFile) { CharacterCache objCache = new CharacterCache(strFile); if(!_lstCharacterCache.TryAdd(strFile, objCache)) _lstCharacterCache[strFile] = objCache; TreeNode objNode = new TreeNode { ContextMenuStrip = cmsRoster, Text = objCache.CalculatedName(), ToolTipText = objCache.FilePath.CheapReplace(Utils.GetStartupPath, () => '<' + Application.ProductName + '>'), Tag = strFile }; if(!string.IsNullOrEmpty(objCache.ErrorText)) { objNode.ForeColor = Color.Red; objNode.ToolTipText += Environment.NewLine + Environment.NewLine + LanguageManager.GetString("String_Error", GlobalOptions.Language) + LanguageManager.GetString("String_Colon", GlobalOptions.Language) + Environment.NewLine + objCache.ErrorText; } return objNode; }