public static JavascriptTool ToJavascriptTool(object t) { try { JavascriptTool jt = (JavascriptTool)t; return(jt); } catch (Exception ex) { //TODO: error handling return(null); } }
public void AddNewTool() { NewToolDialog ntd = new NewToolDialog(this); ntd.ShowDialog(); ToolData.ToolTypes tt = ntd.CurrentToolType; Tool temp; if (CurrentProject != null) { temp = CurrentProject.Tools.Where(x => x.Language.ToLower() == tt.ToString().ToLower()).FirstOrDefault(); } else { temp = Tools.Where(x => x.Language.ToLower() == tt.ToString().ToLower()).FirstOrDefault(); } if (temp == null) { switch (tt) { case ToolData.ToolTypes.Javascript: JavascriptTool jt = new JavascriptTool(); if (CurrentProject != null) { CurrentProject.Tools.Add(jt); } else { Tools.Add(jt); } break; } } }