public void ServerLoop() { while (true) { // TODO: collect messages OnThreadStateChange?.Invoke(this, new ThreadStateEventArgs(CommonLibrary.Model.Common.ThreadState.Dummy)); Thread.Sleep(2000); } }
public void Start() { if (this.Status == ServerStatus.Initialized) { _timer.Start(); this.Status = ServerStatus.Running; this._thread_mre.Set(); _network_handling_thread.Start(); OnThreadStateChange?.Invoke(this, new ThreadStateEventArgs(ThreadStateType.Begin)); //_log_console.AuthNetworkThreadMessage(ThreadStateType.Begin); // d } }
public void Stop() { if (_timer.Enabled) { _timer.Stop(); } if (this.Status == ServerStatus.Running) { _thread_mre.Reset(); OnThreadStateChange?.Invoke(this, new ThreadStateEventArgs(CommonLibrary.Model.Common.ThreadState.Stop)); //_log_console.AuthNetworkThreadMessage(ThreadStateType.Stop); // d this.Status = ServerStatus.Stopped; } }
public void Resume() { if (!_timer.Enabled) { _timer.Start(); } if (this.Status == ServerStatus.Stopped || this.Status == ServerStatus.Initialized) { this.DbServer.Start(); this.AuthServer.Start(); this._thread_mre.Set(); OnThreadStateChange?.Invoke(this, new ThreadStateEventArgs(CommonLibrary.Model.Common.ThreadState.Resume)); this.Status = ServerStatus.Running; } }
public void Stop() { if (_timer.Enabled) { _timer.Stop(); } if (this.Status == ServerStatus.Running) { this.AuthServer.Stop(); this.DbServer.Stop(); this._thread_mre.Reset(); OnThreadStateChange?.Invoke(this, new ThreadStateEventArgs(CommonLibrary.Model.Common.ThreadState.Stop)); this.Status = ServerStatus.Stopped; } }
public void Resume() { if (!_timer.Enabled) { _timer.Start(); } if (this.Status == ServerStatus.Stopped || this.Status == ServerStatus.Initialized) { _thread_mre.Set(); OnThreadStateChange?.Invoke(this, new ThreadStateEventArgs(ThreadStateType.Resume)); //_log_console.AuthNetworkThreadMessage(ThreadStateType.Resume); // d this.Status = ServerStatus.Running; } }
public void Start() { if (this.Status == ServerStatus.Initialized) { _timer.Start(); this.DbServer.Start(); this.AuthServer.Start(); this.Status = ServerStatus.Running; this._thread_mre.Set(); _tcp_listener.Start(); _network_handling_thread.Start(); OnThreadStateChange?.Invoke(this, new ThreadStateEventArgs(CommonLibrary.Model.Common.ThreadState.Begin)); } }
public void ServerLoop() { while (true) { _thread_mre.WaitOne(); if (Status == ServerStatus.Uninitialized) { OnThreadStateChange?.Invoke(this, new ThreadStateEventArgs(ThreadStateType.End)); _main_mre.Set(); _main_mre.Reset(); //_log_console.AuthNetworkThreadMessage(ThreadStateType.End); // d // finish tasks and terminate return; } // TODO: collect messages OnThreadStateChange?.Invoke(this, new ThreadStateEventArgs(ThreadStateType.Dummy)); Thread.Sleep(2000); } }