Skip to content

Commit

Permalink
Fix Style-Cop Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-hawker committed Nov 3, 2020
1 parent 5767df4 commit 288a0cc
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
Expand Down
21 changes: 11 additions & 10 deletions Microsoft.Toolkit.Uwp.UI.Controls/ColorPicker/ColorPicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1306:Field names should begin with lower-case letter", Justification = "Only template parts start with a capital letter. This differentiates them from other fields.")]
public partial class ColorPicker : Windows.UI.Xaml.Controls.ColorPicker
{
internal Color CheckerBackgroundColor { get; set; } = Color.FromArgb(0x19, 0x80, 0x80, 0x80); // Overridden later

/// <summary>
/// The period that scheduled color updates will be applied.
/// This is only used when updating colors using the ScheduleColorUpdate() method.
Expand All @@ -68,7 +70,6 @@ public partial class ColorPicker : Windows.UI.Xaml.Controls.ColorPicker

private Dictionary<Slider, Size> cachedSliderSizes = new Dictionary<Slider, Size>();
private bool callbacksConnected = false;
internal Color checkerBackgroundColor = Color.FromArgb(0x19, 0x80, 0x80, 0x80); // Overridden later
private bool eventsConnected = false;
private bool isInitialized = false;

Expand Down Expand Up @@ -132,7 +133,7 @@ public ColorPicker()

// Checkered background color is found only one time for performance
// This may need to change in the future if theme changes should be supported
this.checkerBackgroundColor = (Color)Application.Current.Resources["SystemListLowColor"];
this.CheckerBackgroundColor = (Color)Application.Current.Resources["SystemListLowColor"];

this.ConnectCallbacks(true);
this.SetDefaultPalette();
Expand Down Expand Up @@ -173,7 +174,7 @@ private static bool IsColorEmpty(Color color)
/// </summary>
protected override void OnApplyTemplate()
{
// TODO: We need to disconnect old events first.
//// TODO: We need to disconnect old events first.

this.ColorSpectrumControl = this.GetTemplateChild<ColorSpectrum>(nameof(ColorSpectrumControl));
this.ColorSpectrumAlphaSlider = this.GetTemplateChild<Slider>(nameof(ColorSpectrumAlphaSlider));
Expand Down Expand Up @@ -1068,7 +1069,7 @@ private async void UpdateChannelSliderBackground(Slider slider)
this.GetActiveColorRepresentation(),
ColorChannel.Channel1,
baseColor,
this.checkerBackgroundColor);
this.CheckerBackgroundColor);
}
else if (object.ReferenceEquals(slider, this.Channel2Slider))
{
Expand All @@ -1079,7 +1080,7 @@ private async void UpdateChannelSliderBackground(Slider slider)
this.GetActiveColorRepresentation(),
ColorChannel.Channel2,
baseColor,
this.checkerBackgroundColor);
this.CheckerBackgroundColor);
}
else if (object.ReferenceEquals(slider, this.Channel3Slider))
{
Expand All @@ -1090,7 +1091,7 @@ private async void UpdateChannelSliderBackground(Slider slider)
this.GetActiveColorRepresentation(),
ColorChannel.Channel3,
baseColor,
this.checkerBackgroundColor);
this.CheckerBackgroundColor);
}
else if (object.ReferenceEquals(slider, this.AlphaChannelSlider))
{
Expand All @@ -1101,7 +1102,7 @@ private async void UpdateChannelSliderBackground(Slider slider)
this.GetActiveColorRepresentation(),
ColorChannel.Alpha,
baseColor,
this.checkerBackgroundColor);
this.CheckerBackgroundColor);
}
else if (object.ReferenceEquals(slider, this.ColorSpectrumAlphaSlider))
{
Expand All @@ -1112,7 +1113,7 @@ private async void UpdateChannelSliderBackground(Slider slider)
this.GetActiveColorRepresentation(),
ColorChannel.Alpha,
baseColor,
this.checkerBackgroundColor);
this.CheckerBackgroundColor);
}
else if (object.ReferenceEquals(slider, this.ColorSpectrumThirdDimensionSlider))
{
Expand All @@ -1123,7 +1124,7 @@ private async void UpdateChannelSliderBackground(Slider slider)
ColorRepresentation.Hsva, // Always HSV
this.GetActiveColorSpectrumThirdDimension(),
baseColor,
this.checkerBackgroundColor);
this.CheckerBackgroundColor);
}

if (bitmap != null)
Expand Down Expand Up @@ -1293,7 +1294,7 @@ private async void CheckeredBackgroundBorder_Loaded(object sender, RoutedEventAr
{
await ColorPickerRenderingHelpers.UpdateBorderBackgroundWithCheckerAsync(
sender as Border,
checkerBackgroundColor);
CheckerBackgroundColor);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ public Style FlyoutPresenterStyle
/// </summary>
public static readonly DependencyProperty FlyoutPresenterStyleProperty = DependencyProperty.Register("FlyoutPresenterStyle", typeof(Style), typeof(ColorPickerButton), new PropertyMetadata(default(Style)));

#pragma warning disable CS0419 // Ambiguous reference in cref attribute
/// <summary>
/// Gets or sets the selected <see cref="Windows.UI.Color"/> the user has picked from the <see cref="ColorPicker"/>.
/// </summary>
#pragma warning restore CS0419 // Ambiguous reference in cref attribute
public Color SelectedColor
{
get { return (Color)GetValue(SelectedColorProperty); }
Expand Down Expand Up @@ -149,7 +151,7 @@ private async void CheckeredBackgroundBorder_Loaded(object sender, RoutedEventAr
{
await ColorPickerRenderingHelpers.UpdateBorderBackgroundWithCheckerAsync(
sender as Border,
ColorPicker.checkerBackgroundColor); // TODO: Check initialization
ColorPicker.CheckerBackgroundColor); // TODO: Check initialization
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public class ColorPickerSlider : Slider
private Size oldSize;
private Size measuredSize;

/// <inheritdoc/>
/// <summary>
/// Initializes a new instance of the <see cref="ColorPickerSlider"/> class.
/// </summary>
public ColorPickerSlider()
: base()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ private void ValueChanged(object sender, EventArgs e)
CaseCollectionChanged?.Invoke(this, EventArgs.Empty);
}

/// <summary>
/// Initializes a new instance of the <see cref="CaseCollection"/> class.
/// </summary>
public CaseCollection()
{
}
Expand Down

0 comments on commit 288a0cc

Please sign in to comment.