public void DelegateTest() { ConsoleDelegate d = ConsoleMethod; //ConsoleDelegate t = new ConsoleDelegate("sada"); d("Something"); //Assert.AreEqual("", 1); }
/// <summary> /// Parancs regisztráló függvény. /// </summary> public void RegisterHandler(string command, ConsoleDelegate method) { if (ConsoleMethodMap.ContainsKey(command)) { ConsoleMethodMap[command].Method += method; } else { ConsoleMethodMap.Add(command, new ConsoleMethod(method)); } }
/// <summary> /// Parancs eltávolító függvény. /// </summary> public void RemoveHandler(string command, ConsoleDelegate method) { if (ConsoleMethodMap.ContainsKey(command)) { ConsoleMethodMap[command].Method -= method; if (ConsoleMethodMap[command].Method.IsNull()) { ConsoleMethodMap.Remove(command); } } }
public ConsoleMethod(ConsoleDelegate method) { Method = method; }
/// <summary> /// Parancs eltávolító függvény. /// </summary> public static void RemoveHandler(string command, ConsoleDelegate method) { if(ConsoleMethodMap.ContainsKey(command)) { ConsoleMethodMap[command].Method -= method; if(ConsoleMethodMap[command].Method.IsNull()) ConsoleMethodMap.Remove(command); } }
/// <summary> /// Parancs regisztráló függvény. /// </summary> public static void RegisterHandler(string command, ConsoleDelegate method) { if(ConsoleMethodMap.ContainsKey(command)) ConsoleMethodMap[command].Method += method; else ConsoleMethodMap.Add(command, new ConsoleMethod(method)); }