Example #1
0
        //List<bool> userstati;
        public Chat(int id)
        {
            InitializeComponent();
            screens = new List<Chatscreen>();
            Admin = new Administrator();
            lblName.Text = Admin.LogIn(id);

            //Check online users
            BGWuser = new BackgroundWorker();
            BGWuser.DoWork += BGWuser_DoWork;
            BGWuser.RunWorkerCompleted += BGWuser_RunWorkerCompleted;
            BGWuser.ProgressChanged += BGWuser_ProgressChanged;
            BGWuser.WorkerReportsProgress = true;
            BGWuser.RunWorkerAsync();

            Admin.GoOnline();

            //Check active chats
            BGWchatroom = new BackgroundWorker();
            BGWchatroom.DoWork += BGWchatroom_DoWork;
            BGWchatroom.RunWorkerCompleted += BGWchatroom_RunWorkerCompleted;
            BGWchatroom.ProgressChanged += BGWchatroom_ProgressChanged;
            BGWchatroom.WorkerReportsProgress = true;
            BGWchatroom.RunWorkerAsync();
        }
Example #2
0
        public Chatscreen(Administrator a, List<string> users, Form previous)
        {
            InitializeComponent();
            this.Admin = a;
            this.usernames = users;
            messages = new List<string>();
            this.Previous = previous;

            //Check online users
            BGWuser = new BackgroundWorker();
            BGWuser.DoWork += BGWuser_DoWork;
            BGWuser.RunWorkerCompleted += BGWuser_RunWorkerCompleted;
            BGWuser.ProgressChanged += BGWuser_ProgressChanged;
            BGWuser.WorkerReportsProgress = true;
            BGWuser.RunWorkerAsync();

            BGWmsg = new BackgroundWorker();
            BGWmsg.DoWork += BGWmsg_DoWork;
            BGWmsg.RunWorkerCompleted += BGWmsg_RunWorkerCompleted;
            BGWmsg.ProgressChanged += BGWmsg_ProgressChanged;
            BGWmsg.WorkerReportsProgress = true;
            BGWmsg.RunWorkerAsync();
        }