static void Main(string[] args) { Events.Events myEvent = new Events.Events(); myEvent.PerformIntAction += new Events.IntEventHandler( DelegateImplementations.DelegateImplementation.PerformIntAddition); Console.WriteLine(String.Format("Performing Addition = {0}", myEvent.OnPerformIntAction(5, 6))); myEvent.PerformIntAction -= DelegateImplementations.DelegateImplementation.PerformIntAddition; myEvent.PerformIntAction += new Events.IntEventHandler( DelegateImplementations.DelegateImplementation.PerformIntSubtraction); Console.WriteLine(String.Format("Performing Subtraction = {0}", myEvent.OnPerformIntAction(11, 6))); myEvent.PerformIntAction -= DelegateImplementations.DelegateImplementation.PerformIntSubtraction; myEvent.PerformIntAction += new Events.IntEventHandler( DelegateImplementations.DelegateImplementation.PerformIntMultiplication); Console.WriteLine(String.Format("Performing Multiplication = {0}", myEvent.OnPerformIntAction(5, 6))); myEvent.PerformIntAction -= DelegateImplementations.DelegateImplementation.PerformIntMultiplication; myEvent.PerformIntAction += new Events.IntEventHandler( DelegateImplementations.DelegateImplementation.PerformIntDivision); Console.WriteLine(String.Format("Performing Division = {0}", myEvent.OnPerformIntAction(5, 2))); myEvent.PerformIntAction -= DelegateImplementations.DelegateImplementation.PerformIntDivision; Console.ReadKey(); }
static void Main(string[] args) { Events.Events myEvent = new Events.Events(); myEvent.PerformIntAction += new Events.Events.IntEventHandler(PerformIntAddition); Console.WriteLine(myEvent.OnPerformIntAction(5, 6)); Console.ReadKey(); }
internal void Setup() { if (!setup) { Events = new Events.Events(); Logger = new Utils.Logger(); Patcher = new Utils.Patcher(); setup = true; } }
public static void Initialize() { // Admin AdminService = new NUnitTester.Admin.Admin(); ReplaceServiceUrl(AdminService, SystemType.CprBroker); Console.WriteLine(AdminService.Url); AdminApplicationHeader = new NUnitTester.Admin.ApplicationHeader() { ApplicationToken = TestData.BaseAppToken, UserToken = TestData.userToken }; AdminService.ApplicationHeaderValue = AdminApplicationHeader; // Part PartService = new CprBroker.NUnitTester.Part.Part(); ReplaceServiceUrl(PartService, SystemType.CprBroker); Console.WriteLine(PartService.Url); PartApplicationHeader = new Part.ApplicationHeader() { ApplicationToken = TestData.BaseAppToken, UserToken = TestData.userToken }; PartService.ApplicationHeaderValue = PartApplicationHeader; // Subscriptions SubscriptionsService = new NUnitTester.Subscriptions.Subscriptions(); ReplaceServiceUrl(SubscriptionsService, SystemType.EventBroker); Console.WriteLine(SubscriptionsService.Url); SubscriptionsApplicationHeader = new CprBroker.NUnitTester.Subscriptions.ApplicationHeader() { ApplicationToken = TestData.BaseAppToken, UserToken = TestData.userToken }; SubscriptionsService.ApplicationHeaderValue = SubscriptionsApplicationHeader; // Events EventsService = new CprBroker.NUnitTester.Events.Events(); ReplaceServiceUrl(EventsService, SystemType.CprBroker); Console.WriteLine(EventsService.Url); EventsApplicationHeader = new CprBroker.NUnitTester.Events.ApplicationHeader() { ApplicationToken = TestData.BaseAppToken, UserToken = TestData.userToken }; EventsService.ApplicationHeaderValue = EventsApplicationHeader; // Notification NotificationService = new CprBroker.NUnitTester.Notification.Notification(); ReplaceServiceUrl(NotificationService, SystemType.EventBroker); Console.WriteLine(NotificationService.Url); }
static async Task Main(string[] args) { //var client = new SocketIO("http://localhost:3000"); //client.ConnectTimeout = TimeSpan.FromSeconds(5); //client.On("test", args => //{ // string text = JsonConvert.DeserializeObject<string>(args.Text); // Console.WriteLine(text); //}); //client.OnConnected += async () => //{ // for (int i = 0; i < 5; i++) // { // await client.EmitAsync("test", i.ToString()); // await Task.Delay(1000); // } // await client.EmitAsync("close", "close"); //}; //client.OnClosed += Client_OnClosed; //await client.ConnectAsync(); //----------------- // var player1 = new Player ("18534572861", "123456789"); // player1.initListener (); // // player1.init(); // System.Threading.Thread.Sleep (5000); // // var player2 = new Player ("18534572862", "qiushanyu666"); // // Console.WriteLine ($"player1.instanceId:{player1.instanceId}"); // // player2.init(player1.instanceId); var events = new Events.Events(); events.On("test", testHandler); events.On("test", testHandler1); events.Off("test", testHandler); events.Emit("test", Encoding.UTF8.GetBytes("testData")); Console.ReadLine(); }
public ISentence ProcessEvent(Events.Events businessEventId) { return(EventSentenceMap[businessEventId]()); }