Exemplo n.º 1
0
 public static void Main()
 {
     ClientController controller = ClientController.Instance;
     ClientModel model = new ClientModel();
     LoginForm loginForm = new LoginForm(controller);
     controller.setView(loginForm);
     controller.setModel(model);
     loginForm.setModelController(model, controller);
     Application.Run(loginForm);
 }
Exemplo n.º 2
0
        /**
         * Inloggen
         */
        private void loginToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                lblStatus.Text = "Verbinden...";

                /**
                 * Loginform openen
                 */
                LoginForm loginDialog = new LoginForm();
                loginDialog.ShowDialog(this);
                if (!String.IsNullOrEmpty(loginDialog.UserName))
                {
                    //Verbinding maken
                    remoteFactory = new ChannelFactory<IChatService>("ChatConfig");
                    remoteProxy = remoteFactory.CreateChannel();
                    clientUser = remoteProxy.ClientConnect(loginDialog.UserName);

                    if (clientUser != null)
                    {
                        usersTimer.Enabled = true;
                        messagesTimer.Enabled = true;
                        loginToolStripMenuItem.Enabled = false;
                        btnSend.Enabled = true;
                        txtMessage.Enabled = true;
                        isConnected = true;
                        lblStatus.Text = "Verbonden als: " + clientUser.UserName;
                    }
                }
                else
                    lblStatus.Text = "Verbinding verbroken";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Er is een fout opgetreden\nClient kan geen verbinding maken\n:"+ex.Message,
                    "FATAL ERROR",MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }