private void ValidateUploadWorking() { // Ten seconds after we start uploading we check that the events are being received by the server if (DateTime.Now.Subtract(_uploadStartTime).TotalSeconds < 10) { return; } if (CommanderWatcher.CommanderIsTracking(_commanderName)) { _uploadValidated = true; CommanderWatcher.Stop(); return; } // We don't appear to be listed on the server if (DateTime.Now.Subtract(_uploadStartTime).TotalSeconds > 15) { // More than 15 seconds has passed, so we disable upload and warn CommanderWatcher.Stop(); Action action = new Action(() => { checkBoxUpload.Checked = false; MessageBox.Show(this, "Upload has been disabled as server is not receiving your events.\r\nTypical causes are firewall or security software.\r\nPlease resolve issue and try again.", "Upload Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); }); if (checkBoxUpload.InvokeRequired) { checkBoxUpload.Invoke(action); } else { action(); } } }
private void buttonPlayers_Click(object sender, EventArgs e) { if (this.Width == _commanderListHiddenWidth) { this.Width = _normalView.Width; _commanderListShowing = true; CommanderWatcher.Start($"http://{ServerAddress}:11938/DataCollator"); UpdateAvailableCommanders();; CommanderWatcher.OnlineCountChanged += CommanderWatcher_OnlineCountChanged; } else { CommanderWatcher.Stop(); this.Width = _commanderListHiddenWidth; _commanderListShowing = false; CommanderWatcher.OnlineCountChanged -= CommanderWatcher_OnlineCountChanged; } }