private void renameToolStripMenuItem_Click(object sender, EventArgs e) { InputDialog dialog = new InputDialog(); dialog.WindowTitle = "Rename Files"; dialog.MainInstruction = dialog.WindowTitle; dialog.Content = "Selected files will use this filename when added to the archive."; if (listView.SelectedItems.Count == 1) { dialog.Input = listView.SelectedItems[0].SubItems[2].Text; } if (dialog.ShowDialog() == DialogResult.OK) { foreach (ListViewItem item in listView.SelectedItems) { item.SubItems[2].Text = dialog.Input; FileEntry fileEntry = (FileEntry)item.Tag; fileEntry.FilenameInArchive = dialog.Input; } } }
void ConnectArduino() { while (true) { setStatusText("Waiting for user input..."); string port = null; while (true) { InputDialog ask = new InputDialog(); ask.Content = "The Arduino port must be specified. Please enter the port the Arduino device is connected to (Example: COM4)"; ask.MainInstruction = "Please enter the Arduino port"; ask.WindowTitle = "Arduino port"; if (ask.ShowDialog() == DialogResult.OK) { port = ask.Input; } else return; if (!String.IsNullOrEmpty(port)) break; } setStatusText("Connecting to Arduino on port " + port + "..."); try { Arduino.Init(port); } catch { continue; } setStatusText("Connected!"); break; } }