Skip to content
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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

Conversation

Dmitry-VF
Copy link
Contributor

Description of Change

Fixes related to ORCOMP-652 , ORCOMP-648 , ORCOMP-653

Issues Resolved

  • fixes #

API Changes

None

Platforms Affected

  • All
  • WPF
  • UWP
  • iOS
  • Android

Behavioral Changes

None

Testing Procedure

PR Checklist

  • I have included examples or tests
  • I have updated the change log
  • I am listed in the CONTRIBUTORS file
  • Rebased on top of the target branch at time of PR
  • Changes adhere to coding standard

@Dmitry-VF Dmitry-VF self-assigned this Jan 10, 2022

try
{
var match = _colors.First(c => c.Value == color).Name;
Copy link
Member

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)
Copy link
Member

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);
Copy link
Member

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))
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants