public WebStationClient() { eventBus = SimpleEventBus.GetDefaultEventBus(); eventBus.Register(this); foreach (var item in StaticData.AppHostConfig.StationNodes) { IStationDevice dObj = null; string className = item.GetType().GetProperty($"{StaticData.AppHostConfig.Environment}Service").GetValue(item).ToString(); if (Type.GetType(className) == null) { string path = $@"{StaticData.AppHostConfig.AppBinPath}\AgvStationClient.dll"; var assembly = Assembly.LoadFrom(path); var tpe = assembly.GetType(className); dObj = Activator.CreateInstance(tpe) as IStationDevice; } else { dObj = Assembly.GetAssembly(Type.GetType(className)).CreateInstance(className) as IStationDevice; } var proxy = new StationProxyService((AgvStationEnum)Enum.Parse(typeof(AgvStationEnum), item.StationId), dObj); dObj.RawIn_Prod = item.GetType().GetProperty("ProdeuctType").GetValue(item).ToString(); dObj.RawIn_Mate = item.GetType().GetProperty("MaterielType").GetValue(item).ToString(); proxy.SendSingnalrEvent += Proxy_SendSingnalrEvent; proxy.SendLogEvent += Proxy_SendLogEvent; stationProxyServices.Add(proxy); } }
public void PostTest() { var test1 = new TestClass1(); var test2 = new TestClass2(); SimpleEventBus.Register(test1); SimpleEventBus.Register(test2); SimpleEventBus.Post(new TestEvent { Str = "A", Num = 1000 }); Assert.AreEqual("A1", test1.Str); Assert.AreEqual(1001, test1.Num); Assert.AreEqual("A2", test2.Str); Assert.AreEqual(1002, test2.Num); SimpleEventBus.Unregister(test1); SimpleEventBus.Post(new TestEvent { Str = "B", Num = 2000 }); Assert.AreEqual("A1", test1.Str); Assert.AreEqual(1001, test1.Num); Assert.AreEqual("B2", test2.Str); Assert.AreEqual(2002, test2.Num); }
public MainWindow() { InitializeComponent(); //加入窗口关闭监听 this.Closing += Window_Closing; //注册EventBus监听 SimpleEventBus eventBus = SimpleEventBus.GetDefaultEventBus(); eventBus.Register(this); //连接服务端 mClient = new NettyClient(Host, Port); mClient.StartClient(); }
public WebAgvMissionManager() { eventBus = SimpleEventBus.GetDefaultEventBus(); eventBus.Register(this); string className = StaticData.AppHostConfig.GetType().GetProperty($"{StaticData.AppHostConfig.Environment}CarryDevice").GetValue(StaticData.AppHostConfig).ToString(); string path = $@"{StaticData.AppHostConfig.AppBinPath}\RightCarryService.dll"; var assembly = Assembly.LoadFrom(path); var tpe = assembly.GetType(className); RightCarryService.IControlDevice dObj = Activator.CreateInstance(tpe) as IControlDevice; agvMissionManagerClient = new AgvMissionManagerClient(dObj); agvMissionManagerClient.SendAgvMissonEvent += AgvMissionManagerClient_SendAgvMissonEvent; agvMissionManagerClient.SendSignalrEvent += AgvMissionManagerClient_SendSignalrEvent; agvMissionManagerClient.ShowLogEvent += AgvMissionManagerClient_ShowLogEvent; }
private static CqsServer CreateServer() { var cmdBus = new SimpleCommandBus(); cmdBus.Register(typeof (Program).Assembly); var queryBus = new SimpleQueryBus(); queryBus.Register(typeof (Program).Assembly); var requestReplyBus = new SimpleRequestReplyBus(); requestReplyBus.Register(typeof (Program).Assembly); var eventBus = new SimpleEventBus(); eventBus.Register(typeof (Program).Assembly); var server = new CqsServer(cmdBus, queryBus, eventBus, requestReplyBus); server.SerializerFactory = () => new JsonMessageSerializer(); return server; }
private static CqsServer CreateServer() { var cmdBus = new SimpleCommandBus(); cmdBus.Register(typeof(Program).Assembly); var queryBus = new SimpleQueryBus(); queryBus.Register(typeof(Program).Assembly); var requestReplyBus = new SimpleRequestReplyBus(); requestReplyBus.Register(typeof(Program).Assembly); var eventBus = new SimpleEventBus(); eventBus.Register(typeof(Program).Assembly); var server = new CqsServer(cmdBus, queryBus, eventBus, requestReplyBus); server.SerializerFactory = () => new JsonMessageSerializer(); return(server); }
public MainWindow() { InitializeComponent(); _eventBus.Register(this); }
public TaskItemViewModel() { _eventBus.Register(this); Commands = CreateCommands(); }