-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/color picker fixes #454
base: develop
Are you sure you want to change the base?
Conversation
|
||
try | ||
{ | ||
var match = _colors.First(c => c.Value == color).Name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FirstOrDefault instead? then there won't be exceptions (better for performance, etc)
try | ||
{ | ||
var match = _colors.First(c => c.Value == color).Name; | ||
if (match is not null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!string.IsNullOrWhiteSpace(match))
try | ||
{ | ||
var color = (Color)ColorConverter.ConvertFromString(_colorTextBox.Text); | ||
var match = _colors.First(c => c.Value == color); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FirstOrDefault, safely handle exceptions
{ | ||
var regex = new System.Text.RegularExpressions.Regex("^[a-fA-F0-9]+$"); | ||
|
||
if (!regex.IsMatch(((TextBox)sender).Text)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cast sender to TextBox just once
Description of Change
Fixes related to ORCOMP-652 , ORCOMP-648 , ORCOMP-653
Issues Resolved
API Changes
None
Platforms Affected
Behavioral Changes
None
Testing Procedure
PR Checklist