/// <summary> /// Handles a click on the "Start" button. /// </summary> private void HandleStart() { if (_needsExtraInfo && !TryGetExtraInfo()) { _popup.Message = $"PROVIDE THE MODE {_matchMode.InfoName().ToUpper()} BEFORE STARTING A MATCH"; _popup.Show(); return; } MatchSettings settings; if (_needsExtraInfo) { settings = new MatchSettings(_matchMode, _extraInfo); } else { settings = new MatchSettings(_matchMode); } OnStartMatch?.Invoke(settings); bool TryGetExtraInfo() { var culture = CultureInfo.InvariantCulture; if (int.TryParse(_extraInfoInput.text, NumberStyles.Integer, culture, out var value) && value > 0) { _extraInfo = (uint)value; return(true); } return(false); } }
private void Button_Click(object sender, RoutedEventArgs e) { try { throw new ArgumentException("Test"); } catch (Exception ex) { _logger.LogError(ex, "Error Button clicked"); var popup = new ErrorPopup("Test", ex); popup.Show(); } }