Ejemplo n.º 1
0
 public void ServerLoop()
 {
     while (true)
     {
         // TODO: collect messages
         OnThreadStateChange?.Invoke(this, new ThreadStateEventArgs(CommonLibrary.Model.Common.ThreadState.Dummy));
         Thread.Sleep(2000);
     }
 }
Ejemplo n.º 2
0
        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
            }
        }
Ejemplo n.º 3
0
        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;
     }
 }
Ejemplo n.º 6
0
        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));
            }
        }
Ejemplo n.º 8
0
 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);
     }
 }