private void StartRun(object sender, RoutedEventArgs e) { int urlType = 5; if ((Boolean)lengthFive.IsChecked) { urlType = 5; } if ((Boolean)lengthSix.IsChecked) { urlType = 6; } if ((Boolean)lengthSeven.IsChecked) { urlType = 7; } int parsedResult; int.TryParse(this.runLength.Text, out parsedResult); if (parsedResult == 0) { MessageBox.Show("Length is not a number or is zero!", "Exception", MessageBoxButton.OK, MessageBoxImage.Warning); } if (selectedDirectory.Text == "") { MessageBox.Show("Please select a directory!", "Exception", MessageBoxButton.OK, MessageBoxImage.Warning); } RID.KickOff(selectedDirectory.Text, urlType, parsedResult); }