public RunForm(SequenceData sequenceToRun) { this.runningSequence = sequenceToRun; if (WordGenerator.MainClientForm.instance.studentEdition) { MessageBox.Show("Your Cicero Professional Edition (C) License expired on March 31. You are now running a temporary 24 hour STUDENT EDITION license. Please see http://web.mit.edu/~akeshet/www/Cicero/apr1.html for license renewal information.", "License expired -- temporary STUDENT EDITION license."); } IPAddress lclhst = null; IPEndPoint ipe = null; CameraPCsSocketList = new List<Socket>(); connectedPCs = new List<SettingsData.IPAdresses>(); bool errorOccured = false; foreach (SettingsData.IPAdresses ipAdress in Storage.settingsData.CameraPCs) { errorOccured = false; if (ipAdress.inUse) { try { lclhst = Dns.GetHostEntry(ipAdress.pcAddress).AddressList[0]; ipe = new IPEndPoint(lclhst, ipAdress.Port); CameraPCsSocketList.Add(new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp)); CameraPCsSocketList[CameraPCsSocketList.Count - 1].Blocking = false; CameraPCsSocketList[CameraPCsSocketList.Count - 1].SendTimeout = 100; CameraPCsSocketList[CameraPCsSocketList.Count - 1].ReceiveTimeout = 100; } catch { errorOccured = true; } if (errorOccured) continue; else { connectedPCs.Add(ipAdress); try { CameraPCsSocketList[CameraPCsSocketList.Count - 1].Connect(ipe); } catch { } } } } if (Storage.settingsData.CameraPCs.Count != 0) { getConfirmationThread = new Thread(new ThreadStart(getConfirmationEntryPoint)); getConfirmationThread.Start(); } // Supress hotkeys in main form when this form is runnings. This will be cleared when the run form closes. WordGenerator.MainClientForm.instance.suppressHotkeys = true; InitializeComponent(); runFormStatus = RunFormStatus.Inactive; formCreationTime = DateTime.Now; // hotkey registration hotkeyButtons = new Dictionary<int, Button>(); // fortune cookie if (WordGenerator.MainClientForm.instance.fortunes != null) { List<string> forts = WordGenerator.MainClientForm.instance.fortunes; Random rand = new Random(); fortuneCookieLabel.Text = forts[rand.Next(forts.Count - 1)]; } }
private void setStatus(RunFormStatus status) { if (this.InvokeRequired) { Action<RunFormStatus> callback = setStatus; this.Invoke(callback, new object[] { status }); } else { runFormStatus = status; switch (runFormStatus) { case RunFormStatus.Inactive: stopButton.Enabled = false; closeButton.Enabled = false; progressBar.Enabled = false; runAgainButton.Enabled = false; abortAfterThis.Enabled = false; break; case RunFormStatus.StartingRun: stopButton.Enabled = true; closeButton.Enabled = false; progressBar.Enabled = false; runAgainButton.Enabled = false; abortAfterThis.Enabled = true; break; case RunFormStatus.FinishedRun: stopButton.Enabled = false; closeButton.Enabled = true; progressBar.Enabled = false; if ((this.runType == RunType.Run_Iteration_Zero || this.runType == RunType.Run_Current_Iteration) && !isIdle) { runAgainButton.Enabled = true; } abortAfterThis.Enabled = false; if (userAborted && this.isBackgroundRunform) { this.Close(); } break; case RunFormStatus.Running: stopButton.Enabled = true; closeButton.Enabled = false; progressBar.Enabled = true; runAgainButton.Enabled = false; abortAfterThis.Enabled = true; break; case RunFormStatus.ClosableOnly: stopButton.Enabled = false; closeButton.Enabled = true; progressBar.Enabled = false; runAgainButton.Enabled = false; abortAfterThis.Enabled = false; break; } } }