Skip to content

Commit f4de153

Browse files
committed
Fix warnings
1 parent 4ec0dd7 commit f4de153

File tree

15 files changed

+54
-56
lines changed

15 files changed

+54
-56
lines changed

src/BasicSample/AssemblyInfo.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1+
using System;
12
using System.Windows;
23

3-
[assembly: ThemeInfo(
4-
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5-
//(used if a resource is not found in the page,
6-
// or application resource dictionaries)
7-
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8-
//(used if a resource is not found in the page,
9-
// app, or any theme specific resource dictionaries)
10-
)]
4+
[assembly: CLSCompliant(true)]
5+
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]

src/BasicSample/DataItem.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace BasicSample
1+
#pragma warning disable CA5394 // Do not use insecure randomness
2+
3+
namespace BasicSample
24
{
35
using System;
46
using System.Windows;

src/BasicSample/DataProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Collections.ObjectModel;
55
using System.Linq;
66

7-
public class DataProvider
7+
public static class DataProvider
88
{
99
/// <summary>
1010
/// Provide a simple list of 100 random items.

src/DataGridExtensions/ColumnStyles.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@ private static void Columns_CollectionChanged(DataGridColumnStyleCollection styl
5959
if (args.Action != NotifyCollectionChangedAction.Add)
6060
return;
6161

62-
var column = (DataGridColumn?)args.NewItems![0];
62+
if (args.NewItems?[0] is not DataGridColumn column)
63+
return;
6364

6465
ApplyStyle(styles, column);
6566
}
6667

67-
private static void ApplyStyle(DataGridColumnStyleCollection styles, DependencyObject? column)
68+
private static void ApplyStyle(DataGridColumnStyleCollection styles, DependencyObject column)
6869
{
69-
var columnType = column?.GetType();
70+
var columnType = column.GetType();
7071

7172
var style = styles.FirstOrDefault(s => s.ColumnType == columnType);
7273
if (style == null)

src/DataGridExtensions/DataGridFilterColumn.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ internal static bool Matches(this DataGridColumn? column, DataGrid dataGrid, obj
242242
/// Examines the property path and returns the objects value for this column.
243243
/// Filtering is applied on the SortMemberPath, this is the path used to create the binding.
244244
/// </summary>
245-
internal static object? GetCellContentData(this DataGridColumn? column, object? item)
245+
internal static object? GetCellContentData(this DataGridColumn column, object? item)
246246
{
247-
var propertyPath = column?.SortMemberPath;
247+
var propertyPath = column.SortMemberPath;
248248
if (item == null || string.IsNullOrEmpty(propertyPath))
249249
{
250250
return null;

src/DataGridExtensions/ListBoxSelectAllBehavior.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,11 @@ private void ListBox_SelectionChanged(object? sender, EventArgs? e)
7272
{
7373
_isListBoxUpdating = true;
7474

75-
if (listBox.Items.Count == listBox.SelectedItems.Count)
76-
{
77-
AreAllFilesSelected = true;
78-
}
79-
else if (listBox.SelectedItems.Count == 0)
80-
{
81-
AreAllFilesSelected = false;
82-
}
83-
else
84-
{
85-
AreAllFilesSelected = null;
86-
}
75+
AreAllFilesSelected = listBox.Items.Count == listBox.SelectedItems.Count
76+
? true
77+
: listBox.SelectedItems.Count == 0
78+
? false
79+
: null;
8780
}
8881
finally
8982
{
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using System;
2+
using System.Windows;
3+
4+
[assembly: CLSCompliant(false)]
5+
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]

src/DataGridExtensionsSample/Controls/FilterWithPopupControl.xaml.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,31 +84,31 @@ private void Filter_Changed()
8484
Maximum = filter.Max;
8585
}
8686

87-
public class ContentFilter : IContentFilter
88-
{
89-
public ContentFilter(double min, double max)
90-
{
91-
Min = min;
92-
Max = max;
93-
}
87+
}
9488

95-
public double Min { get; }
89+
public class ContentFilter : IContentFilter
90+
{
91+
public ContentFilter(double min, double max)
92+
{
93+
Min = min;
94+
Max = max;
95+
}
9696

97-
public double Max { get; }
97+
public double Min { get; }
9898

99-
public bool IsMatch(object? value)
100-
{
101-
if (value == null)
102-
return false;
99+
public double Max { get; }
103100

104-
if (!double.TryParse(value.ToString(), out var number))
105-
{
106-
return false;
107-
}
101+
public bool IsMatch(object? value)
102+
{
103+
if (value == null)
104+
return false;
108105

109-
return (number >= Min) && (number <= Max);
106+
if (!double.TryParse(value.ToString(), out var number))
107+
{
108+
return false;
110109
}
111-
}
112110

111+
return (number >= Min) && (number <= Max);
112+
}
113113
}
114114
}

src/DataGridExtensionsSample/Controls/IntegerGreatherThanFilterControl.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ private void Filter_Changed(object newValue)
5252
textBox.Text = (newValue as ContentFilter)?.Value ?? string.Empty;
5353
}
5454

55-
class ContentFilter : IContentFilter
55+
private class ContentFilter : IContentFilter
5656
{
57-
readonly int _threshold;
57+
private readonly int _threshold;
5858

5959
public ContentFilter(int threshold)
6060
{

src/DataGridExtensionsSample/Infrastructure/DataItem.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace DataGridExtensionsSample.Infrastructure
1+
#pragma warning disable CA5394 // Do not use insecure randomness
2+
3+
namespace DataGridExtensionsSample.Infrastructure
24
{
35
using System;
46
using System.Windows;

0 commit comments

Comments
 (0)