From 4f709fc83bb3262ab78367eb3360a42e743ead59 Mon Sep 17 00:00:00 2001 From: Martijn Scheepers Date: Tue, 21 Apr 2020 22:52:58 +0200 Subject: [PATCH 1/8] Use the sort header in the table --- src/MatBlazor.Demo/Demo/DemoTable.razor | 188 ++++++++- src/MatBlazor.Demo/Doc/DocMatTable.razor | 375 +++++++++--------- .../Components/MatTable/MatTable.razor | 12 +- 3 files changed, 386 insertions(+), 189 deletions(-) diff --git a/src/MatBlazor.Demo/Demo/DemoTable.razor b/src/MatBlazor.Demo/Demo/DemoTable.razor index 76d9e226..24abb206 100644 --- a/src/MatBlazor.Demo/Demo/DemoTable.razor +++ b/src/MatBlazor.Demo/Demo/DemoTable.razor @@ -48,7 +48,7 @@ - Name @@ -99,7 +99,7 @@
Filter Example, Pull Data from API, Single Row Selection / Hover
- Id @@ -133,7 +133,7 @@ - @@ -169,3 +169,185 @@ ")> + +
Example sort header table
+ + + + + + Dessert (100g) + Calories + Fat (g) + Carbs (g) + Protein (g) + + + + @context.Name + @context.Calories + @context.Fat + @context.Carbs + @context.Protein + + + + @code + { + class Dessert + { + public int Calories { get; set; } + public int Carbs { get; set; } + public int Fat { get; set; } + public string Name { get; set; } + public int Protein { get; set; } + } + + Dessert[] desserts = new[] + { + new Dessert() {Name = "Frozen yogurt", Calories = 159, Fat = 6, Carbs = 24, Protein = 4}, + new Dessert() {Name = "Ice cream sandwich", Calories = 237, Fat = 9, Carbs = 37, Protein = 4}, + new Dessert() {Name = "Eclair", Calories = 262, Fat = 16, Carbs = 24, Protein = 6}, + new Dessert() {Name = "Cupcake", Calories = 305, Fat = 4, Carbs = 67, Protein = 4}, + new Dessert() {Name = "Gingerbread", Calories = 356, Fat = 16, Carbs = 49, Protein = 4}, + }; + + void SortData(MatSortChangedEvent sort) + { + sortedData = desserts.ToArray(); + if (!(sort == null || sort.Direction == MatSortDirection.None || string.IsNullOrEmpty(sort.SortId))) + { + Comparison comparison = null; + switch (sort.SortId) + { + case "name": + comparison = (s1, s2) => string.Compare(s1.Name, s2.Name, StringComparison.InvariantCultureIgnoreCase); + break; + case "calories": + comparison = (s1, s2) => s1.Calories.CompareTo(s2.Calories); + break; + case "fat": + comparison = (s1, s2) => s1.Fat.CompareTo(s2.Fat); + break; + case "carbs": + comparison = (s1, s2) => s1.Carbs.CompareTo(s2.Carbs); + break; + case "protein": + comparison = (s1, s2) => s1.Protein.CompareTo(s2.Protein); + break; + } + if (comparison != null) + { + if (sort.Direction == MatSortDirection.Desc) + { + Array.Sort(sortedData, (s1, s2) => -1 * comparison(s1, s2)); + } + else + { + Array.Sort(sortedData, comparison); + } + } + } + } + + Dessert[] sortedData = null; + + protected override void OnInitialized() + { + base.OnInitialized(); + SortData(null); + } + } + + + + + + + Dessert (100g) + Calories + Fat (g) + Carbs (g) + Protein (g) + + + + @context.Name + @context.Calories + @context.Fat + @context.Carbs + @context.Protein + + + + @code + { + class Dessert + { + public int Calories { get; set; } + public int Carbs { get; set; } + public int Fat { get; set; } + public string Name { get; set; } + public int Protein { get; set; } + } + + Dessert[] desserts = new[] + { + new Dessert() {Name = ""Frozen yogurt"", Calories = 159, Fat = 6, Carbs = 24, Protein = 4}, + new Dessert() {Name = ""Ice cream sandwich"", Calories = 237, Fat = 9, Carbs = 37, Protein = 4}, + new Dessert() {Name = ""Eclair"", Calories = 262, Fat = 16, Carbs = 24, Protein = 6}, + new Dessert() {Name = ""Cupcake"", Calories = 305, Fat = 4, Carbs = 67, Protein = 4}, + new Dessert() {Name = ""Gingerbread"", Calories = 356, Fat = 16, Carbs = 49, Protein = 4}, + }; + + void SortData(MatSortChangedEvent sort) + { + sortedData = desserts.ToArray(); + if (!(sort == null || sort.Direction == MatSortDirection.None || string.IsNullOrEmpty(sort.SortId))) + { + Comparison comparison = null; + switch (sort.SortId) + { + case ""name"": + comparison = (s1, s2) => string.Compare(s1.Name, s2.Name, StringComparison.InvariantCultureIgnoreCase); + break; + case ""calories"": + comparison = (s1, s2) => s1.Calories.CompareTo(s2.Calories); + break; + case ""fat"": + comparison = (s1, s2) => s1.Fat.CompareTo(s2.Fat); + break; + case ""carbs"": + comparison = (s1, s2) => s1.Carbs.CompareTo(s2.Carbs); + break; + case ""protein"": + comparison = (s1, s2) => s1.Protein.CompareTo(s2.Protein); + break; + } + if (comparison != null) + { + if (sort.Direction == MatSortDirection.Desc) + { + Array.Sort(sortedData, (s1, s2) => -1 * comparison(s1, s2)); + } + else + { + Array.Sort(sortedData, comparison); + } + } + } + } + + Dessert[] sortedData = null; + + protected override void OnInitialized() + { + base.OnInitialized(); + SortData(null); + } + } + + ")> + + \ No newline at end of file diff --git a/src/MatBlazor.Demo/Doc/DocMatTable.razor b/src/MatBlazor.Demo/Doc/DocMatTable.razor index d59c2a7d..2dc73980 100644 --- a/src/MatBlazor.Demo/Doc/DocMatTable.razor +++ b/src/MatBlazor.Demo/Doc/DocMatTable.razor @@ -9,189 +9,194 @@

Mat Table display a table data.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
TableItemGeneric argument
AllowSelectionBooleanSpecifies weather you can select a single row.
ApiUrlStringSpecifies the API Url form for the table data
AttributesDictionary<String,Object>Gets or sets a collection of additional attributes that will be applied to the created element.
ClassStringSpecifies one or more classnames for an DOM element.
DebounceMillisecondsInt32Specifies the delay duration between user input on the Search Term Field. Default 800
DescendingBoolean
DescendingParamNameString
FilterByColumnNameStringSpecifies which column is used for the filter / search term. If this is populated the Search Textbox will be visible.
HeaderRowClassStringSpecifies a custom class for the MatTableHeader row
IdString
ItemsIEnumerable<TableItem>Specifies the data for the table.
LoadInitialDataBooleanSpecifies where to Load the Initial Table Data
MatTableHeaderRenderFragment
MatTableRowRenderFragment<TableItem>
PageLabelString
PageParamNameString
PageRecordCountLabelString
PageSizeInt32The number of rows per page.
PageSizeParamNameString
PageSizesPageSizeStructure[]Not Functioning
PagingDataPropertyNameString
PagingRecordsCountPropertyNameString
RefBackForwardRef
RequestApiOnlyOnceBooleanSpecifies whether to Request the API only once.
RowClassStringSpecifies a custom class for the MatTableRow
SearchTermFieldLabelStringSpecifies the Label for the Filter / Search Term Textbox
SearchTermFieldPlaceHolderStringSpecifies the Placeholder for the Filter / Search Term Textbox
SearchTermParamNameString
ShowFooterBooleanSpecifies the Table Footer visibility.
ShowPagingBooleanSpecifies the Paging visibility
SortByString
SortByParamNameString
StripedBooleanDetermines if table has alternating color rows.
StyleStringSpecifies an inline style for an DOM element.
RefElementReferenceReturned ElementRef reference for DOM element.
NameTypeDescription
TableItemGeneric argument
AllowSelectionBooleanSpecifies weather you can select a single row.
ApiUrlStringSpecifies the API Url form for the table data
AttributesDictionary<String,Object>Gets or sets a collection of additional attributes that will be applied to the created element.
ClassStringSpecifies one or more classnames for an DOM element.
DebounceMillisecondsInt32Specifies the delay duration between user input on the Search Term Field. Default 800
DescendingBoolean
DescendingParamNameString
FilterByColumnNameStringSpecifies which column is used for the filter / search term. If this is populated the Search Textbox will be visible.
HeaderRowClassStringSpecifies a custom class for the MatTableHeader row
IdString
ItemsIEnumerable<TableItem>Specifies the data for the table.
LoadInitialDataBooleanSpecifies where to Load the Initial Table Data
MatTableHeaderRenderFragment
MatTableRowRenderFragment<TableItem>
PageLabelString
PageParamNameString
PageRecordCountLabelString
PageSizeInt32The number of rows per page.
PageSizeParamNameString
PageSizesPageSizeStructure[]Not Functioning
PagingDataPropertyNameString
PagingRecordsCountPropertyNameString
RefBackForwardRef
RequestApiOnlyOnceBooleanSpecifies whether to Request the API only once.
RowClassStringSpecifies a custom class for the MatTableRow
SearchTermFieldLabelStringSpecifies the Label for the Filter / Search Term Textbox
SearchTermFieldPlaceHolderStringSpecifies the Placeholder for the Filter / Search Term Textbox
SearchTermParamNameString
ShowFooterBooleanSpecifies the Table Footer visibility.
ShowPagingBooleanSpecifies the Paging visibility
SortByString
SortByParamNameString
StripedBooleanDetermines if table has alternating color rows.
StyleStringSpecifies an inline style for an DOM element.
RefElementReferenceReturned ElementRef reference for DOM element.
UseSortHeaderRowBooleanUse only MatSortHeaderRow
diff --git a/src/MatBlazor/Components/MatTable/MatTable.razor b/src/MatBlazor/Components/MatTable/MatTable.razor index 207b7a20..0f1aeec1 100644 --- a/src/MatBlazor/Components/MatTable/MatTable.razor +++ b/src/MatBlazor/Components/MatTable/MatTable.razor @@ -16,7 +16,14 @@ - @MatTableHeader + @if (UseSortHeaderRow) + { + @MatTableHeader + } + else + { + @MatTableHeader + } @if (ItemList != null) @@ -91,6 +98,9 @@ [Parameter] public RenderFragment MatTableHeader { get; set; } + [Parameter] + public bool UseSortHeaderRow { get; set; } = false; + [Parameter] public RenderFragment MatTableRow { get; set; } From fb2625adfc503d05daf532689808311569acc8a7 Mon Sep 17 00:00:00 2001 From: Martijn Scheepers Date: Wed, 22 Apr 2020 19:41:10 +0200 Subject: [PATCH 2/8] Card mdc-card--stroked needs to be mdc-card--outlined --- src/MatBlazor.Demo/Demo/DemoMatCard.razor | 6 +++--- src/MatBlazor.Demo/Doc/DocMatCard.razor | 10 +++++----- src/MatBlazor/Components/MatCard/BaseMatCard.cs | 15 +++++++++------ src/MatBlazor/MatBlazor.xml | 5 +++++ 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/MatBlazor.Demo/Demo/DemoMatCard.razor b/src/MatBlazor.Demo/Demo/DemoMatCard.razor index 3e695930..c920fb53 100644 --- a/src/MatBlazor.Demo/Demo/DemoMatCard.razor +++ b/src/MatBlazor.Demo/Demo/DemoMatCard.razor @@ -269,11 +269,11 @@ -Material Design Card example with header +Material Design Card example with header and outlined(Unelevated) - +
Our Changing Planet @@ -303,7 +303,7 @@ +
Our Changing Planet diff --git a/src/MatBlazor.Demo/Doc/DocMatCard.razor b/src/MatBlazor.Demo/Doc/DocMatCard.razor index 1c242e46..194d85d0 100644 --- a/src/MatBlazor.Demo/Doc/DocMatCard.razor +++ b/src/MatBlazor.Demo/Doc/DocMatCard.razor @@ -35,13 +35,13 @@
- - - + + + - - + + diff --git a/src/MatBlazor/Components/MatCard/BaseMatCard.cs b/src/MatBlazor/Components/MatCard/BaseMatCard.cs index d8fec87e..5f4d9ab7 100644 --- a/src/MatBlazor/Components/MatCard/BaseMatCard.cs +++ b/src/MatBlazor/Components/MatCard/BaseMatCard.cs @@ -12,20 +12,23 @@ public BaseMatCard() ClassMapper .Add("mat-card") .Add("mdc-card") - .If("mdc-card--stroked", () => this.Stroke); + .If("mdc-card--outlined", () => this.Outlined); } + + /// + /// Unelevated outlined card. + /// [Parameter] - public bool Stroke + public bool Outlined { - get => _stroke; - set { _stroke = value; } + get => _outlined; + set { _outlined = value; } } [Parameter] public RenderFragment ChildContent { get; set; } - - private bool _stroke; + private bool _outlined; } } \ No newline at end of file diff --git a/src/MatBlazor/MatBlazor.xml b/src/MatBlazor/MatBlazor.xml index 67ee1d88..45a00184 100644 --- a/src/MatBlazor/MatBlazor.xml +++ b/src/MatBlazor/MatBlazor.xml @@ -286,6 +286,11 @@ Card component for Blazor contain content and actions about a single subject. + + + Unelevated outlined card. + + Material Design Checkboxes for Blazor, allow the user to select multiple options from a set. From 089ac8127f0515388eca02aa4b89bd57f6ff87a4 Mon Sep 17 00:00:00 2001 From: Martijn Scheepers Date: Wed, 22 Apr 2020 19:46:58 +0200 Subject: [PATCH 3/8] Fix documentation for commit 4f709fc83bb3262ab78367eb3360a42e743ead59 --- src/MatBlazor.Demo/Demo/DemoTable.razor | 8 +- src/MatBlazor.Demo/Doc/DocMatTable.razor | 380 +++++++++--------- .../Components/MatTable/BaseMatTable.cs | 7 + .../Components/MatTable/MatTable.razor | 3 - src/MatBlazor/MatBlazor.xml | 5 + 5 files changed, 206 insertions(+), 197 deletions(-) diff --git a/src/MatBlazor.Demo/Demo/DemoTable.razor b/src/MatBlazor.Demo/Demo/DemoTable.razor index 24abb206..db7200b8 100644 --- a/src/MatBlazor.Demo/Demo/DemoTable.razor +++ b/src/MatBlazor.Demo/Demo/DemoTable.razor @@ -48,7 +48,7 @@ - @@ -133,8 +133,8 @@ - @@ -261,7 +261,7 @@ - diff --git a/src/MatBlazor.Demo/Doc/DocMatTable.razor b/src/MatBlazor.Demo/Doc/DocMatTable.razor index 2dc73980..9e62677c 100644 --- a/src/MatBlazor.Demo/Doc/DocMatTable.razor +++ b/src/MatBlazor.Demo/Doc/DocMatTable.razor @@ -9,194 +9,194 @@

Mat Table display a table data.

RefBackForwardRefOutlinedBooleanUnelevated outlined card.
StrokeBooleanRefBackForwardRef
Name Id
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
TableItemGeneric argument
AllowSelectionBooleanSpecifies weather you can select a single row.
ApiUrlStringSpecifies the API Url form for the table data
AttributesDictionary<String,Object>Gets or sets a collection of additional attributes that will be applied to the created element.
ClassStringSpecifies one or more classnames for an DOM element.
DebounceMillisecondsInt32Specifies the delay duration between user input on the Search Term Field. Default 800
DescendingBoolean
DescendingParamNameString
FilterByColumnNameStringSpecifies which column is used for the filter / search term. If this is populated the Search Textbox will be visible.
HeaderRowClassStringSpecifies a custom class for the MatTableHeader row
IdString
ItemsIEnumerable<TableItem>Specifies the data for the table.
LoadInitialDataBooleanSpecifies where to Load the Initial Table Data
MatTableHeaderRenderFragment
MatTableRowRenderFragment<TableItem>
PageLabelString
PageParamNameString
PageRecordCountLabelString
PageSizeInt32The number of rows per page.
PageSizeParamNameString
PageSizesPageSizeStructure[]Not Functioning
PagingDataPropertyNameString
PagingRecordsCountPropertyNameString
RefBackForwardRef
RequestApiOnlyOnceBooleanSpecifies whether to Request the API only once.
RowClassStringSpecifies a custom class for the MatTableRow
SearchTermFieldLabelStringSpecifies the Label for the Filter / Search Term Textbox
SearchTermFieldPlaceHolderStringSpecifies the Placeholder for the Filter / Search Term Textbox
SearchTermParamNameString
ShowFooterBooleanSpecifies the Table Footer visibility.
ShowPagingBooleanSpecifies the Paging visibility
SortByString
SortByParamNameString
StripedBooleanDetermines if table has alternating color rows.
StyleStringSpecifies an inline style for an DOM element.
RefElementReferenceReturned ElementRef reference for DOM element.
UseSortHeaderRowBooleanUse only MatSortHeaderRow
NameTypeDescription
TableItemGeneric argument
AllowSelectionBooleanSpecifies weather you can select a single row.
ApiUrlStringSpecifies the API Url form for the table data
AttributesDictionary<String,Object>Gets or sets a collection of additional attributes that will be applied to the created element.
ClassStringSpecifies one or more classnames for an DOM element.
DebounceMillisecondsInt32Specifies the delay duration between user input on the Search Term Field. Default 800
DescendingBoolean
DescendingParamNameString
FilterByColumnNameStringSpecifies which column is used for the filter / search term. If this is populated the Search Textbox will be visible.
HeaderRowClassStringSpecifies a custom class for the MatTableHeader row
IdString
ItemsIEnumerable<TableItem>Specifies the data for the table.
LoadInitialDataBooleanSpecifies where to Load the Initial Table Data
MatTableHeaderRenderFragment
MatTableRowRenderFragment<TableItem>
PageLabelString
PageParamNameString
PageRecordCountLabelString
PageSizeInt32The number of rows per page.
PageSizeParamNameString
PageSizesPageSizeStructure[]Not Functioning
PagingDataPropertyNameString
PagingRecordsCountPropertyNameString
RefBackForwardRef
RequestApiOnlyOnceBooleanSpecifies whether to Request the API only once.
RowClassStringSpecifies a custom class for the MatTableRow
SearchTermFieldLabelStringSpecifies the Label for the Filter / Search Term Textbox
SearchTermFieldPlaceHolderStringSpecifies the Placeholder for the Filter / Search Term Textbox
SearchTermParamNameString
ShowFooterBooleanSpecifies the Table Footer visibility.
ShowPagingBooleanSpecifies the Paging visibility
SortByString
SortByParamNameString
StripedBooleanDetermines if table has alternating color rows.
StyleStringSpecifies an inline style for an DOM element.
UseSortHeaderRowBooleanUse only the sort header.
RefElementReferenceReturned ElementRef reference for DOM element.
diff --git a/src/MatBlazor/Components/MatTable/BaseMatTable.cs b/src/MatBlazor/Components/MatTable/BaseMatTable.cs index 8b6fae77..0e23c00a 100644 --- a/src/MatBlazor/Components/MatTable/BaseMatTable.cs +++ b/src/MatBlazor/Components/MatTable/BaseMatTable.cs @@ -164,6 +164,13 @@ public string SearchTermFieldPlaceHolder [Parameter] public int PageSize { get; set; } = 5; + + /// + /// Use only the sort header. + /// + [Parameter] + public bool UseSortHeaderRow { get; set; } = false; + public BaseMatTable() { ClassMapper diff --git a/src/MatBlazor/Components/MatTable/MatTable.razor b/src/MatBlazor/Components/MatTable/MatTable.razor index 0f1aeec1..cacb9b8c 100644 --- a/src/MatBlazor/Components/MatTable/MatTable.razor +++ b/src/MatBlazor/Components/MatTable/MatTable.razor @@ -98,9 +98,6 @@ [Parameter] public RenderFragment MatTableHeader { get; set; } - [Parameter] - public bool UseSortHeaderRow { get; set; } = false; - [Parameter] public RenderFragment MatTableRow { get; set; } diff --git a/src/MatBlazor/MatBlazor.xml b/src/MatBlazor/MatBlazor.xml index 45a00184..993ab63d 100644 --- a/src/MatBlazor/MatBlazor.xml +++ b/src/MatBlazor/MatBlazor.xml @@ -621,6 +621,11 @@ The number of rows per page. + + + Use only the sort header. + + Mat Table Row display a table row From fecd1a5e2d3ae5db97dd3ef756d949b2ebd77626 Mon Sep 17 00:00:00 2001 From: Martijn Scheepers Date: Sun, 26 Apr 2020 10:54:53 +0200 Subject: [PATCH 4/8] Changed sex to gender --- src/MatBlazor.Demo/Demo/DemoEditContext.razor | 56 +++++++++---------- .../Demo/DemoMatRadioButton.razor | 12 ++-- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/MatBlazor.Demo/Demo/DemoEditContext.razor b/src/MatBlazor.Demo/Demo/DemoEditContext.razor index 76ad80a4..904372c4 100644 --- a/src/MatBlazor.Demo/Demo/DemoEditContext.razor +++ b/src/MatBlazor.Demo/Demo/DemoEditContext.razor @@ -40,17 +40,17 @@

- + M W

- +

- +

@@ -60,7 +60,7 @@ HelperText="ValidationDisabled" HelperTextPersistent="true"/>

- +

@@ -97,20 +97,20 @@

- + M W - +

- - + +

- - + +

@@ -132,17 +132,17 @@ @code { - class SexDef + class GenderDef { public string Name { get; set; } - public SexDef(string name) + public GenderDef(string name) { Name = name; } } - string[] SexItems = new[] + string[] GenderItems = new[] { "", "M", @@ -177,7 +177,7 @@ public string Password { get; set; } [Required] - public string Sex { get; set; } + public string Gender { get; set; } [Required] [CustomValidation(typeof(LoginModel), nameof(RequiredDateTime))] @@ -250,17 +250,17 @@

- + M W

- +

- v)""> + v)"">

@@ -270,7 +270,7 @@ HelperText=""ValidationDisabled"" HelperTextPersistent=""true""/>

- +

@@ -307,20 +307,20 @@ myModel.EndDate)""/>

- + M W - myModel.Sex)""/> + myModel.Gender)""/>

- - myModel.Sex)""/> + + myModel.Gender)""/>

- v)""> - myModel.Sex)""/> + v)""> + myModel.Gender)""/>

@@ -342,17 +342,17 @@ @code { - class SexDef + class GenderDef { public string Name { get; set; } - public SexDef(string name) + public GenderDef(string name) { Name = name; } } - string[] SexItems = new[] + string[] GenderItems = new[] { """", ""M"", @@ -387,7 +387,7 @@ public string Password { get; set; } [Required] - public string Sex { get; set; } + public string Gender { get; set; } [Required] [CustomValidation(typeof(LoginModel), nameof(RequiredDateTime))] diff --git a/src/MatBlazor.Demo/Demo/DemoMatRadioButton.razor b/src/MatBlazor.Demo/Demo/DemoMatRadioButton.razor index cb3f96b4..b8f01261 100644 --- a/src/MatBlazor.Demo/Demo/DemoMatRadioButton.razor +++ b/src/MatBlazor.Demo/Demo/DemoMatRadioButton.razor @@ -218,15 +218,15 @@
Enum
- + @code { - Sex sex; + Gender gender; - enum Sex + enum Gender { None, Male, @@ -239,15 +239,15 @@ ())""> + ())""> @code { - Sex sex; + Gender gender; - enum Sex + enum Gender { None, Male, From 6d6ff627e617342f19ab6f54cd98de0a518dbd36 Mon Sep 17 00:00:00 2001 From: Martijn Scheepers Date: Sun, 26 Apr 2020 11:43:25 +0200 Subject: [PATCH 5/8] Warning: ignore async result --- src/MatBlazor/Components/MatIconButton/BaseMatIconButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MatBlazor/Components/MatIconButton/BaseMatIconButton.cs b/src/MatBlazor/Components/MatIconButton/BaseMatIconButton.cs index 54b4a4ff..f2495ca3 100644 --- a/src/MatBlazor/Components/MatIconButton/BaseMatIconButton.cs +++ b/src/MatBlazor/Components/MatIconButton/BaseMatIconButton.cs @@ -115,7 +115,7 @@ protected async Task OnClickHandler(MouseEventArgs ev) } else { - OnClick.InvokeAsync(ev); + _ = OnClick.InvokeAsync(ev); if (Command?.CanExecute(CommandParameter) ?? false) { Command.Execute(CommandParameter); From 4d1a5d63e0aa875d385b445a8d660dc6e7f96fa5 Mon Sep 17 00:00:00 2001 From: Martijn Scheepers Date: Sun, 26 Apr 2020 11:53:06 +0200 Subject: [PATCH 6/8] Warning: await async call --- src/MatBlazor/Components/MatNavMenu/MatNavSubMenuHeader.razor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MatBlazor/Components/MatNavMenu/MatNavSubMenuHeader.razor b/src/MatBlazor/Components/MatNavMenu/MatNavSubMenuHeader.razor index 0bd79f3f..758833be 100644 --- a/src/MatBlazor/Components/MatNavMenu/MatNavSubMenuHeader.razor +++ b/src/MatBlazor/Components/MatNavMenu/MatNavSubMenuHeader.razor @@ -2,7 +2,7 @@ @using Microsoft.AspNetCore.Components @inherits BaseMatDomComponent -
+
@ChildContent @@ -31,6 +31,6 @@ protected async void OnClickHandler(MouseEventArgs e) { - this.NavSubMenu.ToggleAsync(); + await this.NavSubMenu.ToggleAsync(); } } \ No newline at end of file From a50b134ef0f0b92c4fe1bd43d8f64c526fb92b4f Mon Sep 17 00:00:00 2001 From: Martijn Scheepers Date: Sun, 26 Apr 2020 12:01:18 +0200 Subject: [PATCH 7/8] Warnings: do not declare variable if not used. --- .../Components/MatPaginator/BaseMatPaginator.cs | 6 +++--- src/MatBlazor/Core/MatBlazorSwitchTByte.cs | 6 +++--- src/MatBlazor/Core/MatBlazorSwitchTByteNull.cs | 8 ++++---- src/MatBlazor/Core/MatBlazorSwitchTChar.cs | 6 +++--- src/MatBlazor/Core/MatBlazorSwitchTCharNull.cs | 8 ++++---- src/MatBlazor/Core/MatBlazorSwitchTDecimal.cs | 8 ++++---- src/MatBlazor/Core/MatBlazorSwitchTDecimalNull.cs | 8 ++++---- src/MatBlazor/Core/MatBlazorSwitchTDouble.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTDoubleNull.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTFloat.cs | 8 ++++---- src/MatBlazor/Core/MatBlazorSwitchTFloatNull.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTInt.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTIntNull.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTLong.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTLongNull.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTSByte.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTSByteNull.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTShort.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTShortNull.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTUInt.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTUIntNull.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTULong.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTULongNull.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTUShort.cs | 10 +++++----- src/MatBlazor/Core/MatBlazorSwitchTUShortNull.cs | 10 +++++----- 25 files changed, 114 insertions(+), 114 deletions(-) diff --git a/src/MatBlazor/Components/MatPaginator/BaseMatPaginator.cs b/src/MatBlazor/Components/MatPaginator/BaseMatPaginator.cs index 9bde485b..5e79c205 100644 --- a/src/MatBlazor/Components/MatPaginator/BaseMatPaginator.cs +++ b/src/MatBlazor/Components/MatPaginator/BaseMatPaginator.cs @@ -47,7 +47,7 @@ protected int CalculateTotalPages(int pageSize) return int.MaxValue; } - return Math.Max(0, (int) Math.Ceiling((decimal) Length / PageSize)); + return Math.Max(0, (int)Math.Ceiling((decimal)Length / PageSize)); } public async Task NavigateToPage(MatPaginatorAction direction, int pageSize) @@ -62,7 +62,7 @@ public async Task NavigateToPage(MatPaginatorAction direction, int pageSize) { page = ((CurrentPageIndex * PageSize) / pageSize); } - catch (OverflowException e) + catch (OverflowException) { } } @@ -92,7 +92,7 @@ public async Task NavigateToPage(MatPaginatorAction direction, int pageSize) } } } - catch (Exception e) + catch (Exception) { } diff --git a/src/MatBlazor/Core/MatBlazorSwitchTByte.cs b/src/MatBlazor/Core/MatBlazorSwitchTByte.cs index b435358c..e0711685 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTByte.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTByte.cs @@ -11,10 +11,10 @@ public override byte Increase(byte v, byte step, byte max) { try { - var v2 = (byte) (v + step); + var v2 = (byte)(v + step); return v2 <= max ? v2 : max; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -30,7 +30,7 @@ public override byte Decrease(byte v, byte step, byte min) var v2 = (byte)(v - step); return v2 >= min ? v2 : min; } - catch (OverflowException e) + catch (OverflowException) { return min; } diff --git a/src/MatBlazor/Core/MatBlazorSwitchTByteNull.cs b/src/MatBlazor/Core/MatBlazorSwitchTByteNull.cs index 7c26dd69..e010bf58 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTByteNull.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTByteNull.cs @@ -11,10 +11,10 @@ public class MatBlazorSwitchTByteNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? (byte?) ((v ?? 0) + (step ?? 0)) : null; + var v2 = (v.HasValue || step.HasValue) ? (byte?)((v ?? 0) + (step ?? 0)) : null; return (max.HasValue && v2.HasValue) ? (v2.Value <= max.Value ? v2.Value : max.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public class MatBlazorSwitchTByteNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? (byte?) ((v ?? 0) - (step ?? 0)) : null; + var v2 = (v.HasValue || step.HasValue) ? (byte?)((v ?? 0) - (step ?? 0)) : null; return (min.HasValue && v2.HasValue) ? (v2.Value >= min.Value ? v2.Value : min.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return min; } diff --git a/src/MatBlazor/Core/MatBlazorSwitchTChar.cs b/src/MatBlazor/Core/MatBlazorSwitchTChar.cs index 6e4432d3..bc561e6a 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTChar.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTChar.cs @@ -10,10 +10,10 @@ public override char Increase(char v, char step, char max) { try { - var v2 = (char) (v + step); + var v2 = (char)(v + step); return v2 <= max ? v2 : max; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -29,7 +29,7 @@ public override char Decrease(char v, char step, char min) var v2 = (char)(v - step); return v2 >= min ? v2 : min; } - catch (OverflowException e) + catch (OverflowException) { return min; } diff --git a/src/MatBlazor/Core/MatBlazorSwitchTCharNull.cs b/src/MatBlazor/Core/MatBlazorSwitchTCharNull.cs index 736fa406..2139b2d9 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTCharNull.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTCharNull.cs @@ -10,10 +10,10 @@ public class MatBlazorSwitchTCharNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? (char?) ((v ?? 0) + (step ?? 0)) : null; + var v2 = (v.HasValue || step.HasValue) ? (char?)((v ?? 0) + (step ?? 0)) : null; return (max.HasValue && v2.HasValue) ? (v2.Value <= max.Value ? v2.Value : max.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -26,10 +26,10 @@ public class MatBlazorSwitchTCharNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? (char?) ((v ?? 0) - (step ?? 0)) : null; + var v2 = (v.HasValue || step.HasValue) ? (char?)((v ?? 0) - (step ?? 0)) : null; return (min.HasValue && v2.HasValue) ? (v2.Value >= min.Value ? v2.Value : min.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return min; } diff --git a/src/MatBlazor/Core/MatBlazorSwitchTDecimal.cs b/src/MatBlazor/Core/MatBlazorSwitchTDecimal.cs index 99fcbc94..41264ce0 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTDecimal.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTDecimal.cs @@ -14,10 +14,10 @@ public override decimal Increase(decimal v, decimal step, decimal max) { try { - var v2 = (decimal) (v + step); + var v2 = (decimal)(v + step); return v2 <= max ? v2 : max; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -30,10 +30,10 @@ public override decimal Decrease(decimal v, decimal step, decimal min) { try { - var v2 = (decimal) (v - step); + var v2 = (decimal)(v - step); return v2 >= min ? v2 : min; } - catch (OverflowException e) + catch (OverflowException) { return min; } diff --git a/src/MatBlazor/Core/MatBlazorSwitchTDecimalNull.cs b/src/MatBlazor/Core/MatBlazorSwitchTDecimalNull.cs index 328bccf4..876bae67 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTDecimalNull.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTDecimalNull.cs @@ -11,10 +11,10 @@ public class MatBlazorSwitchTDecimalNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (decimal?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (decimal?)null; return (max.HasValue && v2.HasValue) ? (v2.Value <= max.Value ? v2.Value : max.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public class MatBlazorSwitchTDecimalNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (decimal?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (decimal?)null; return (min.HasValue && v2.HasValue) ? (v2.Value >= min.Value ? v2.Value : min.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return min; } diff --git a/src/MatBlazor/Core/MatBlazorSwitchTDouble.cs b/src/MatBlazor/Core/MatBlazorSwitchTDouble.cs index a667ae2f..b860a091 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTDouble.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTDouble.cs @@ -11,10 +11,10 @@ public override double Increase(double v, double step, double max) { try { - var v2 = (double) (v + step); + var v2 = (double)(v + step); return v2 <= max ? v2 : max; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public override double Decrease(double v, double step, double min) { try { - var v2 = (double) (v - step); + var v2 = (double)(v - step); return v2 >= min ? v2 : min; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -74,7 +74,7 @@ public override double FromBoolNull(bool? v, bool indeterminate) public override double FromDecimal(decimal v) { - return (double) v; + return (double)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTDoubleNull.cs b/src/MatBlazor/Core/MatBlazorSwitchTDoubleNull.cs index 999b7b49..ce55e6e8 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTDoubleNull.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTDoubleNull.cs @@ -11,10 +11,10 @@ public class MatBlazorSwitchTDoubleNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (double?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (double?)null; return (max.HasValue && v2.HasValue) ? (v2.Value <= max.Value ? v2.Value : max.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public class MatBlazorSwitchTDoubleNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (double?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (double?)null; return (min.HasValue && v2.HasValue) ? (v2.Value >= min.Value ? v2.Value : min.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -84,7 +84,7 @@ public override string FormatValueAsString(double? v, string format) public override double? FromDecimal(decimal v) { - return (double) v; + return (double)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTFloat.cs b/src/MatBlazor/Core/MatBlazorSwitchTFloat.cs index 04bbead8..11b17a8c 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTFloat.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTFloat.cs @@ -11,10 +11,10 @@ public override float Increase(float v, float step, float max) { try { - var v2 = (float) (v + step); + var v2 = (float)(v + step); return v2 <= max ? v2 : max; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -30,7 +30,7 @@ public override float Decrease(float v, float step, float min) var v2 = (float)(v - step); return v2 >= min ? v2 : min; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -73,7 +73,7 @@ public override float FromBoolNull(bool? v, bool indeterminate) public override float FromDecimal(decimal v) { - return (float) v; + return (float)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTFloatNull.cs b/src/MatBlazor/Core/MatBlazorSwitchTFloatNull.cs index 53bc4c0a..dcce6971 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTFloatNull.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTFloatNull.cs @@ -11,10 +11,10 @@ public class MatBlazorSwitchTFloatNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (float?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (float?)null; return (max.HasValue && v2.HasValue) ? (v2.Value <= max.Value ? v2.Value : max.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public class MatBlazorSwitchTFloatNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (float?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (float?)null; return (min.HasValue && v2.HasValue) ? (v2.Value >= min.Value ? v2.Value : min.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -83,7 +83,7 @@ public override string FormatValueAsString(float? v, string format) public override float? FromDecimal(decimal v) { - return (float) v; + return (float)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTInt.cs b/src/MatBlazor/Core/MatBlazorSwitchTInt.cs index cd1e9368..b52c7d8c 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTInt.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTInt.cs @@ -11,10 +11,10 @@ public override int Increase(int v, int step, int max) { try { - var v2 = (int) (v + step); + var v2 = (int)(v + step); return v2 <= max ? v2 : max; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public override int Decrease(int v, int step, int min) { try { - var v2 = (int) (v - step); + var v2 = (int)(v - step); return v2 >= min ? v2 : min; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -74,7 +74,7 @@ public override int FromBoolNull(bool? v, bool indeterminate) public override int FromDecimal(decimal v) { - return (int) v; + return (int)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTIntNull.cs b/src/MatBlazor/Core/MatBlazorSwitchTIntNull.cs index 558025df..7b8efe4f 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTIntNull.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTIntNull.cs @@ -11,10 +11,10 @@ public class MatBlazorSwitchTIntNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (int?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (int?)null; return (max.HasValue && v2.HasValue) ? (v2.Value <= max.Value ? v2.Value : max.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public class MatBlazorSwitchTIntNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (int?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (int?)null; return (min.HasValue && v2.HasValue) ? (v2.Value >= min.Value ? v2.Value : min.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -79,7 +79,7 @@ public override string FormatValueAsString(int? v, string format) public override int? FromDecimal(decimal v) { - return (int) v; + return (int)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTLong.cs b/src/MatBlazor/Core/MatBlazorSwitchTLong.cs index 45ec67d3..af49971e 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTLong.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTLong.cs @@ -11,10 +11,10 @@ public override long Increase(long v, long step, long max) { try { - var v2 = (long) (v + step); + var v2 = (long)(v + step); return v2 <= max ? v2 : max; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public override long Decrease(long v, long step, long min) { try { - var v2 = (long) (v - step); + var v2 = (long)(v - step); return v2 >= min ? v2 : min; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -74,7 +74,7 @@ public override long FromBoolNull(bool? v, bool indeterminate) public override long FromDecimal(decimal v) { - return (long) v; + return (long)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTLongNull.cs b/src/MatBlazor/Core/MatBlazorSwitchTLongNull.cs index bf8dacfd..833f6189 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTLongNull.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTLongNull.cs @@ -11,10 +11,10 @@ public class MatBlazorSwitchTLongNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (long?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (long?)null; return (max.HasValue && v2.HasValue) ? (v2.Value <= max.Value ? v2.Value : max.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public class MatBlazorSwitchTLongNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (long?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (long?)null; return (min.HasValue && v2.HasValue) ? (v2.Value >= min.Value ? v2.Value : min.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -79,7 +79,7 @@ public override string FormatValueAsString(long? v, string format) public override long? FromDecimal(decimal v) { - return (long) v; + return (long)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTSByte.cs b/src/MatBlazor/Core/MatBlazorSwitchTSByte.cs index 19fbc370..23936ba0 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTSByte.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTSByte.cs @@ -11,10 +11,10 @@ public override sbyte Increase(sbyte v, sbyte step, sbyte max) { try { - var v2 = (sbyte) (v + step); + var v2 = (sbyte)(v + step); return v2 <= max ? v2 : max; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public override sbyte Decrease(sbyte v, sbyte step, sbyte min) { try { - var v2 = (sbyte) (v - step); + var v2 = (sbyte)(v - step); return v2 >= min ? v2 : min; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -74,7 +74,7 @@ public override sbyte FromBoolNull(bool? v, bool indeterminate) public override sbyte FromDecimal(decimal v) { - return (sbyte) v; + return (sbyte)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTSByteNull.cs b/src/MatBlazor/Core/MatBlazorSwitchTSByteNull.cs index 474de964..83a43c06 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTSByteNull.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTSByteNull.cs @@ -11,10 +11,10 @@ public class MatBlazorSwitchTSByteNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? (sbyte?) ((v ?? 0) + (step ?? 0)) : null; + var v2 = (v.HasValue || step.HasValue) ? (sbyte?)((v ?? 0) + (step ?? 0)) : null; return (max.HasValue && v2.HasValue) ? (v2.Value <= max.Value ? v2.Value : max.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public class MatBlazorSwitchTSByteNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? (sbyte?) ((v ?? 0) - (step ?? 0)) : null; + var v2 = (v.HasValue || step.HasValue) ? (sbyte?)((v ?? 0) - (step ?? 0)) : null; return (min.HasValue && v2.HasValue) ? (v2.Value >= min.Value ? v2.Value : min.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -79,7 +79,7 @@ public override string FormatValueAsString(sbyte? v, string format) public override sbyte? FromDecimal(decimal v) { - return (sbyte) v; + return (sbyte)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTShort.cs b/src/MatBlazor/Core/MatBlazorSwitchTShort.cs index 76e4e5b8..2a70e107 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTShort.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTShort.cs @@ -11,10 +11,10 @@ public override short Increase(short v, short step, short max) { try { - var v2 = (short) (v + step); + var v2 = (short)(v + step); return v2 <= max ? v2 : max; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public override short Decrease(short v, short step, short min) { try { - var v2 = (short) (v - step); + var v2 = (short)(v - step); return v2 >= min ? v2 : min; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -74,7 +74,7 @@ public override short FromBoolNull(bool? v, bool indeterminate) public override short FromDecimal(decimal v) { - return (short) v; + return (short)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTShortNull.cs b/src/MatBlazor/Core/MatBlazorSwitchTShortNull.cs index d74d5ae2..f73b3ea8 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTShortNull.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTShortNull.cs @@ -11,10 +11,10 @@ public class MatBlazorSwitchTShortNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? (short?) ((v ?? 0) + (step ?? 0)) : null; + var v2 = (v.HasValue || step.HasValue) ? (short?)((v ?? 0) + (step ?? 0)) : null; return (max.HasValue && v2.HasValue) ? (v2.Value <= max.Value ? v2.Value : max.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public class MatBlazorSwitchTShortNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? (short?) ((v ?? 0) - (step ?? 0)) : null; + var v2 = (v.HasValue || step.HasValue) ? (short?)((v ?? 0) - (step ?? 0)) : null; return (min.HasValue && v2.HasValue) ? (v2.Value >= min.Value ? v2.Value : min.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -79,7 +79,7 @@ public override string FormatValueAsString(short? v, string format) public override short? FromDecimal(decimal v) { - return (short) v; + return (short)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTUInt.cs b/src/MatBlazor/Core/MatBlazorSwitchTUInt.cs index e0381941..984e6505 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTUInt.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTUInt.cs @@ -11,10 +11,10 @@ public override uint Increase(uint v, uint step, uint max) { try { - var v2 = (uint) (v + step); + var v2 = (uint)(v + step); return v2 <= max ? v2 : max; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public override uint Decrease(uint v, uint step, uint min) { try { - var v2 = (uint) (v - step); + var v2 = (uint)(v - step); return v2 >= min ? v2 : min; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -74,7 +74,7 @@ public override uint FromBoolNull(bool? v, bool indeterminate) public override uint FromDecimal(decimal v) { - return (uint) v; + return (uint)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTUIntNull.cs b/src/MatBlazor/Core/MatBlazorSwitchTUIntNull.cs index 8bd9ed1b..4387c695 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTUIntNull.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTUIntNull.cs @@ -11,10 +11,10 @@ public class MatBlazorSwitchTUIntNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (uint?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (uint?)null; return (max.HasValue && v2.HasValue) ? (v2.Value <= max.Value ? v2.Value : max.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public class MatBlazorSwitchTUIntNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (uint?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (uint?)null; return (min.HasValue && v2.HasValue) ? (v2.Value >= min.Value ? v2.Value : min.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -79,7 +79,7 @@ public override string FormatValueAsString(uint? v, string format) public override uint? FromDecimal(decimal v) { - return (uint) v; + return (uint)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTULong.cs b/src/MatBlazor/Core/MatBlazorSwitchTULong.cs index 12dc81d4..9bd1a96c 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTULong.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTULong.cs @@ -11,10 +11,10 @@ public override ulong Increase(ulong v, ulong step, ulong max) { try { - var v2 = (ulong) (v + step); + var v2 = (ulong)(v + step); return v2 <= max ? v2 : max; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public override ulong Decrease(ulong v, ulong step, ulong min) { try { - var v2 = (ulong) (v - step); + var v2 = (ulong)(v - step); return v2 >= min ? v2 : min; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -74,7 +74,7 @@ public override ulong FromBoolNull(bool? v, bool indeterminate) public override ulong FromDecimal(decimal v) { - return (ulong) v; + return (ulong)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTULongNull.cs b/src/MatBlazor/Core/MatBlazorSwitchTULongNull.cs index 55dd33d2..267e2b69 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTULongNull.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTULongNull.cs @@ -11,10 +11,10 @@ public class MatBlazorSwitchTULongNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (ulong?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) + (step ?? 0)) : (ulong?)null; return (max.HasValue && v2.HasValue) ? (v2.Value <= max.Value ? v2.Value : max.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public class MatBlazorSwitchTULongNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (ulong?) null; + var v2 = (v.HasValue || step.HasValue) ? ((v ?? 0) - (step ?? 0)) : (ulong?)null; return (min.HasValue && v2.HasValue) ? (v2.Value >= min.Value ? v2.Value : min.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -79,7 +79,7 @@ public override string FormatValueAsString(ulong? v, string format) public override ulong? FromDecimal(decimal v) { - return (ulong) v; + return (ulong)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTUShort.cs b/src/MatBlazor/Core/MatBlazorSwitchTUShort.cs index e3e7da21..f6554696 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTUShort.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTUShort.cs @@ -11,10 +11,10 @@ public override ushort Increase(ushort v, ushort step, ushort max) { try { - var v2 = (ushort) (v + step); + var v2 = (ushort)(v + step); return v2 <= max ? v2 : max; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public override ushort Decrease(ushort v, ushort step, ushort min) { try { - var v2 = (ushort) (v - step); + var v2 = (ushort)(v - step); return v2 >= min ? v2 : min; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -74,7 +74,7 @@ public override ushort FromBoolNull(bool? v, bool indeterminate) public override ushort FromDecimal(decimal v) { - return (ushort) v; + return (ushort)v; } } } \ No newline at end of file diff --git a/src/MatBlazor/Core/MatBlazorSwitchTUShortNull.cs b/src/MatBlazor/Core/MatBlazorSwitchTUShortNull.cs index 6178d165..4d23432f 100644 --- a/src/MatBlazor/Core/MatBlazorSwitchTUShortNull.cs +++ b/src/MatBlazor/Core/MatBlazorSwitchTUShortNull.cs @@ -11,10 +11,10 @@ public class MatBlazorSwitchTUShortNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? (ushort?) ((v ?? 0) + (step ?? 0)) : null; + var v2 = (v.HasValue || step.HasValue) ? (ushort?)((v ?? 0) + (step ?? 0)) : null; return (max.HasValue && v2.HasValue) ? (v2.Value <= max.Value ? v2.Value : max.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return max; } @@ -27,10 +27,10 @@ public class MatBlazorSwitchTUShortNull : MatBlazorSwitchT { try { - var v2 = (v.HasValue || step.HasValue) ? (ushort?) ((v ?? 0) - (step ?? 0)) : null; + var v2 = (v.HasValue || step.HasValue) ? (ushort?)((v ?? 0) - (step ?? 0)) : null; return (min.HasValue && v2.HasValue) ? (v2.Value >= min.Value ? v2.Value : min.Value) : v2; } - catch (OverflowException e) + catch (OverflowException) { return min; } @@ -79,7 +79,7 @@ public override string FormatValueAsString(ushort? v, string format) public override ushort? FromDecimal(decimal v) { - return (ushort) v; + return (ushort)v; } } } \ No newline at end of file From 3c7c6399e3ed85e2e5560b7222b4092743226ca3 Mon Sep 17 00:00:00 2001 From: Martijn Scheepers Date: Sun, 26 Apr 2020 12:11:26 +0200 Subject: [PATCH 8/8] Warnings: do not use async result --- src/MatBlazor.Demo/Shared/MainLayout.razor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MatBlazor.Demo/Shared/MainLayout.razor b/src/MatBlazor.Demo/Shared/MainLayout.razor index d0b9c30d..55392610 100644 --- a/src/MatBlazor.Demo/Shared/MainLayout.razor +++ b/src/MatBlazor.Demo/Shared/MainLayout.razor @@ -99,7 +99,7 @@ public void OnClick(MouseEventArgs e) { - this.Menu.OpenAsync(themeButton.Ref); + _ = this.Menu.OpenAsync(themeButton.Ref); } bool lazySnackbarIsOpen = false; @@ -122,7 +122,7 @@ { await base.OnInitializedAsync(); - Task.Delay(TimeSpan.FromSeconds(5)) + _ = Task.Delay(TimeSpan.FromSeconds(5)) .ContinueWith((_) => { this.lazySnackbarIsOpen = true; }); }