public Form1()
 {
     InitializeComponent();
     txEnderecoIp.Enabled = false;
     txEnderecoIp.Text    = GetEnderecoIp().ToString();
     presenter            = new ServerPresenter(this);
     usuarioConectadoBindingSource.DataSource = presenter.UsuariosConectados;
     edicaoTarefaBindingSource.DataSource     = presenter.TarefasEmEdicao;
     dataGridView1.DataSource            = usuarioConectadoBindingSource;
     edicaoTarefaDataGridView.DataSource = edicaoTarefaBindingSource;
     _usuarioUpdaterLocker = new object();
     _edicoesUpdaterLocker = new object();
 }
示例#2
0
 public void Init()
 {
     serverPresenter = ServerPresenter.getInstance();
     listener        = new TcpListener(ipEndPoint);
     listener.Start();
     new Thread(async delegate()
     {
         while (index < playerCount)
         {
             clients[index] = await listener.AcceptSocketAsync();
             Connected(index);
             index++;
         }
     }).Start();
 }
示例#3
0
 static void Main(string[] args)
 {
     try
     {
         int port  = int.Parse(args[0]);
         int count = int.Parse(args[1]);
         Console.WriteLine(args[0] + " " + args[1]);
         ServerPresenter.getInstance().Init(port, count);
         GamePresenter.getInstance().Init(count);
         while (!isEnd)
         {
             Thread.Sleep(100);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }