private void toolStripStatusLabel1_Click(object sender, EventArgs e) { EnterNameForm enterNameForm = new EnterNameForm(); if (enterNameForm.ShowDialog(this) == DialogResult.OK) { // Wait for the pop up to complete } enterNameForm.Dispose(); if (yourName.Length < 1) { MessageBox.Show("Unable to get your name from either the registry or the popup box. How did you already mess the application up so badly?", "Y U NO HAVE NAME??", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } if (yourName.Length > 64) { MessageBox.Show("Your name can't be longer than 128 characters, you registry-hacking scrub!", "Y U TRY HACK??", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } toolStripStatusLabel1.Text = "Nickname: " + yourName + ". (Click to change.)"; }
private void ORSForm1_Load(object sender, EventArgs e) { localIP = LocalIPAddress(); this.Text += " v " + productVersion; this.Icon = Properties.Resources.problem; notifyIcon1.Icon = Properties.Resources.smallproblem; notifyIcon1.Text = "ORS v " + productVersion; try { RegistryKey orsNameRegKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Office Rageface Sender", false); yourName = orsNameRegKey.GetValue("Name").ToString(); orsNameRegKey.Close(); yourName = yourName.Replace("|", ""); } catch { EnterNameForm enterNameForm = new EnterNameForm(); if (enterNameForm.ShowDialog(this) == DialogResult.OK) { // Wait for the pop up to complete } enterNameForm.Dispose(); } if (yourName.Length < 1) { MessageBox.Show("Unable to get your name from either the registry or the popup box. How did you already mess the application up so badly?", "Y U NO HAVE NAME??", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } if (yourName.Length > 64) { MessageBox.Show("Your name can't be longer than 64 characters, you registry-hacking scrub!", "Y U TRY HACK??", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } toolStripStatusLabel1.Text = "Nickname: " + yourName + ". (Click to change.)"; if (!Directory.Exists("Images")) { MessageBox.Show("A directory named 'Images' was just created where this executable is running from. Dump all your favorite images in this directory. New images that others send to you will automatically be dumped here. If you move this executable, be sure to move the images directory too.", "Y U NO HAVE IMAGES??", MessageBoxButtons.OK, MessageBoxIcon.Information); Directory.CreateDirectory("Images"); } else { UpdateImagesListAndContextMenu(); } tcpListenerSocket = new TcpListener(IPAddress.Parse(localIP), tcpPort); BackgroundWorker tcpListenerBackgroundWorker = new BackgroundWorker(); tcpListenerBackgroundWorker.WorkerReportsProgress = false; tcpListenerBackgroundWorker.DoWork += new DoWorkEventHandler(tcpListenerBackgroundWorker_DoWork); tcpListenerBackgroundWorker.RunWorkerAsync(); _countdownTimer.Interval = 1000; //ms _countdownTimer.Tick += new EventHandler(_countdownTimer_Tick); _countdownTimer.Enabled = true; }