/// <summary> /// Gets the MOGAssetStatus for a given status name /// </summary> static public int GetStatusIndex(string status) { // Loops through statusInfos ArrayList in order // to find StatusInfo.Text that matches parameter // 'status' try { Tst.TstDictionaryEntry node = mStateTypes.Find(status.ToLower()); if (node != null) { //Debug.WriteLine(status + ":" + ((int)node.Value).ToString(), "GetStatusIndex"); return((int)node.Value); } } catch { } // If there was no match, return error return(GetStatusIndex("unknown")); }
static public bool AddIcon(string directory, string filename, string key) { Tst.TstDictionaryEntry node = mAssetTypes.Find(key); if (node == null) { lock (mAssetTypes) { // Add the active item icon first // Get the image if (DosUtils.FileExist(MOG_ControllerSystem.LocateTool(directory, filename))) { // Get the group image Image myImage = new Bitmap(MOG_ControllerSystem.LocateTool(directory, filename)); // Add the image and the type to the arrayLists mAssetTypeImages.Images.Add(myImage); mAssetTypes.Add(key, mAssetTypeImages.Images.Count - 1); return(true); } } } return(false); }
private static int InternalAddIconToLists(string assetTypeName, string iconFileName, Image image) { int index = 0; lock (mAssetTypes) { try { // Handle any situation where we might not know the filename of the icon if (iconFileName == null) { iconFileName = assetTypeName; } // Do we already have this image loaded? if (mAssetTypeImages.Images.ContainsKey(iconFileName)) { index = mAssetTypeImages.Images.IndexOfKey(iconFileName); //Debug.WriteLine("Returning cached icon - " + iconFileName + " at index - " + index.ToString()); if (mAssetTypes.Find(iconFileName) == null) { mAssetTypes.Add(assetTypeName, index); } //Debug.WriteLine("Returned cached icon - " + iconFileName + " at index - " + index.ToString()); } else { // Add the image and the type to the arrayLists index = mAssetTypeImages.Images.Count; //Debug.WriteLine("Addeding icon - " + assetTypeName + " as index - " + index.ToString() + " with key = " + iconFileName); mAssetTypeImages.Images.Add(iconFileName, image); mAssetTypes.Add(assetTypeName, index); //Debug.WriteLine("Added icon - " + assetTypeName + " as index - " + index.ToString() + " with key = " + iconFileName); } } catch (Exception e) { e.ToString(); } } return(index); }