public static void DownloadSuccessResult(DispatchEventArgs e) { var data = e.ResultData.First(); Console.WriteLine("key = {0}, value = {1}", data.Key, data.Value); Console.WriteLine("name = {0}, id = {1}", e.Name, e.Id); }
public static void DispatchWork(object sender, DispatchEventArgs e) { if (e.Type == "ClientRequest") { try { typeof(DispatchHandler).GetMethod(e.Command).Invoke(null, new object[] { e }); } catch (Exception ex) { string error = ex.ToString(); //Log } } }
static void Main(string[] args) { var data = new DispatchEventArgs(); data.Command = "DownloadSuccessResult"; data.Id = System.Guid.NewGuid().ToString(); data.Name = "Factory"; var collection = new KeyValueCollection(); collection.Add(new KeyValuePair { Key = "StoreName", Value = "LUL" }); data.ResultData = collection; data.Type = "ClientRequest"; DispatchWork(null, data); Console.ReadKey(); }