private void VideoRoom_Load(object sender, EventArgs e) { CameraSelect.Items.Add("Screen Share"); if (MessengerWindow.isadmin) { IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(Server.GetLocalIPAddress()), 45456); server = new Server(Server.GetLocalIPAddress(), 45456); server.CreateServer(1, MessengerWindow.password); StatLabel.Text = "Waiting for connections"; join_button.Enabled = false; Thread adminth = new Thread(new ThreadStart(Admin)); adminth.Start(); } else { StatLabel.Text = ""; } FilterInfoCollection filterInfoCollection = new FilterInfoCollection(FilterCategory.VideoInputDevice); foreach (FilterInfo filterInfo in filterInfoCollection) { CameraSelect.Items.Add(filterInfo.Name); } CameraSelect.SelectedIndex = 0; }
private void confirm_pass_Click(object sender, EventArgs e) { if (ServerPass.Text == "") { MessageBox.Show("You need to enter a key for the server", "No Key Entered", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (UsernameBox.Text == "") { MessengerWindow.username = "******"; } else { MessengerWindow.username = UsernameBox.Text; } Server server = new Server(Server.GetLocalIPAddress(), 45455); int error = server.CreateServer(int.Parse(Max_Person.Text), ServerPass.Text); if (error == 1) { MessageBox.Show("No internet connection detected", "No Internet", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (error == 2) { MessageBox.Show("Failed to create a server", "Failed to create a server", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { MessengerWindow.server = server; MessengerWindow.isadmin = true; MessengerWindow.password = ServerPass.Text; this.Hide(); var Messenger = new MessengerWindow(); Messenger.Closed += (s, args) => this.Close(); Messenger.Show(); } }