public static void Pulse() { if (!Enabled) { return; } if (ZetaDia.Globals.IsLoadingWorld) { return; } if (!Service.IsConnected) { Service.Connect(); CommunicationThread.ThreadStart(); } if (ZetaDia.IsInGame) { InGamePulse(); } else { OutOfGamePulse(); } GameUI.SafeCheckClickButtons(); }
// Implicitly kills the processing thread and waits for it to join before returning public void KillCommunicationThreadAndWait() { KillCommunicationThreadFlag = true; if (CommunicationThread.IsAlive) { CommunicationThread.Join(); } }
// Implicitly kills the processing thread and waits for it to join before returning public void KillCommunicationThreadAndWait() { CommunicationMutex.WaitOne(); KillCommunicationThreadFlag = true; CommunicationMutex.ReleaseMutex(); CommunicationThread.Join(); }
private void BotMain_OnStart(IBot bot) { if (!Service.IsConnected) { Service.Connect(); CommunicationThread.ThreadStart(); } SelectBehavior(); CurrentBehavior.Activate(); }
private void BotMain_OnStop(IBot bot) { if (Service.IsConnected) { Service.Disconnect(); CommunicationThread.ThreadShutdown(); CurrentParty.Clear(); ServerMessage = null; ClientMessages.Clear(); } CurrentBehavior.Deactivate(); }
public void OnEnabled() { Enabled = true; Log.Info(" v{0} Enabled", Version); BotMain.OnStart += BotMain_OnStart; BotMain.OnStop += BotMain_OnStop; CurrentBehavior = DefaultBehavior; EventManager.Enable(); BotHistory.Enable(); TabUi.InstallTab(); ChangeMonitor.Enable(); Service.Connect(); CommunicationThread.ThreadStart(); // When start button is clicked, hooks are cleared, TreeHooks.Instance.OnHooksCleared += OnHooksCleared; }
private void Enable() { if (!Application.Current.CheckAccess()) { return; } Enabled = true; TrinityCombat.Party = new AutoFollowPartyProvider(); Log.Info(" v{0} Enabled", Version); BotMain.OnStart += BotMain_OnStart; BotMain.OnStop += BotMain_OnStop; CurrentBehavior = DefaultBehavior; EventManager.Enable(); TabUi.InstallTab(); ChangeMonitor.Enable(); Server.ServerStartAttempts = 0; Client.ConnectionAttempts = 0; Service.Connect(); CommunicationThread.ThreadStart(); TreeHooks.Instance.OnHooksCleared += OnHooksCleared; }
public void AddCommunications_SuccessTest() { var customerRoleType = new PartyRoleType("Customer"); var customerRole = new PartyRole(customerRoleType); var customerRelationshipType = new PartyRelationshipType("Customers relationship"); var customerRelationship = new PartyRelationship(customerRelationshipType); customerRelationship.AddRole(customerRole); var vlad = new Person(); customerRelationship.Assign(customerRole, vlad); var ilona = new Person(); customerRelationship.Assign(customerRole, ilona); var customerServiceRepresentativeRoleType = new PartyRoleType("CustomerServiceRepresentative"); var customerServiceRepresentativeRole = new PartyRole(customerServiceRepresentativeRoleType); var communicationRelationshipType = new PartyRelationshipType("Communication relationship"); var communicationRelationship = new Communication(communicationRelationshipType); communicationRelationship.AddRole(customerServiceRepresentativeRole); communicationRelationship.Assign(customerServiceRepresentativeRole, vlad); communicationRelationship.Assign(customerServiceRepresentativeRole, ilona); var customerCommunicationManager = new CustomerCommunicationManager(); var customerServiceCase = new CustomerServiceCase(new CustomerServiceCaseIdentifier(Guid.NewGuid())); customerCommunicationManager.AddCustomerServiceCases(customerServiceCase); var thread1 = new CommunicationThread(); customerServiceCase.AddThread(thread1); var communication = new Communication(communicationRelationshipType); thread1.AddCommunication(communicationRelationship); }
public static void Main() { TcpListener server = null; try { // Set the TcpListener port . Int32 port = 5678; //To ask an IP Address every time that the server start Console.WriteLine("Write an IP to start the server:"); String ip = Console.ReadLine(); IPAddress localAddr = IPAddress.Parse(ip); //To have the same IP Address when the server start //IPAddress localAddr = IPAddress.Parse("192.168.1.138"); // TcpListener server = new TcpListener(serverIP,port); server = new TcpListener(localAddr, port); // Start listening for client requests. server.Start(); // Enter the listening loop. while (true) { Console.WriteLine("Waiting for a connection... "); // Perform a blocking call to accept requests. TcpClient client = server.AcceptTcpClient(); //if you have a successful connection Console.WriteLine("Connected!"); // Get a stream object for reading and writing NetworkStream stream = client.GetStream(); //Initializing thread with the stream and the client that sent a message CommunicationThread thread = new CommunicationThread(stream, client); //Starting thread to receive data from a client Thread receive = new Thread(new ThreadStart(thread.ThreadReceiveGPS)); receive.Start(); ////Starting a second thread to send data to a client Thread send = new Thread(new ThreadStart(thread.ThreadSendGPS)); send.Start(); } } catch (SocketException e) { Console.WriteLine("SocketException: {0}", e); } finally { // Stop listening for new clients. server.Stop(); } Console.WriteLine("\nHit enter to continue..."); Console.Read(); }
public RTPRobotCommunicator() { _thread = new CommunicationThread(this); _thread.Start(); }
public RemoteRobotCommunicator() { _thread = new CommunicationThread (this); _thread.Start (); }
private void On(CommunicationThreadStarted @event) { _lastThreadId = @event.ThreadId; var thread = new CommunicationThread(this, @event.ThreadId, @event.Topic, @event.Description); _threads.Add(thread); }