From fef6d4ccfc5857103b8ad43014cae821cadee96f Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 22 Feb 2022 16:24:32 +0100 Subject: [PATCH] Continuo cleanup da Blazorise's components --- MP.Prog/Startup.cs | 8 ------- MP.Stats/Components/ChartControlli.razor.cs | 25 +++++++++++++++------ MP.Stats/Components/ChartOEE.razor | 4 ++-- MP.Stats/Components/ChartOEE.razor.cs | 25 ++++++++++++++------- MP.Stats/Components/ChartScarti.razor.cs | 21 ++++++++++++----- MP.Stats/Components/ChartUserLog.razor | 4 ++-- MP.Stats/Components/ChartUserLog.razor.cs | 25 +++++++++++++++------ MP.Stats/Components/SelectionFilter.razor | 3 +-- MP.Stats/MP.Stats.csproj | 4 ---- MP.Stats/Pages/Test.razor.cs | 12 +++++----- MP.Stats/Pages/_Host.cshtml | 17 -------------- MP.Stats/Startup.cs | 8 ------- MP.Stats/_Imports.razor | 4 +--- 13 files changed, 81 insertions(+), 79 deletions(-) diff --git a/MP.Prog/Startup.cs b/MP.Prog/Startup.cs index 9a2f02f1..02178eb0 100644 --- a/MP.Prog/Startup.cs +++ b/MP.Prog/Startup.cs @@ -188,14 +188,6 @@ namespace MP.Prog .AddEntityFrameworkStores(); #endif -#if false - services.AddBlazorise(options => - { - options.ChangeTextOnKeyPress = true; // optional - }) - .AddBootstrapProviders() - .AddFontAwesomeIcons(); -#endif //// Elmah //services.AddElmah(); //string elmaConn = "Data Source=SQL2016DEV;Initial Catalog=Elmah;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=SHERPA.BBM;"; diff --git a/MP.Stats/Components/ChartControlli.razor.cs b/MP.Stats/Components/ChartControlli.razor.cs index b7a574df..43770f10 100644 --- a/MP.Stats/Components/ChartControlli.razor.cs +++ b/MP.Stats/Components/ChartControlli.razor.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Blazorise.Charts; using Microsoft.AspNetCore.Components; using MP.Stats.Data; @@ -85,8 +84,10 @@ namespace MP.Stats.Components AspectRatio = 1 }; +#if false protected PieChart PieVC = new PieChart(); - protected LineChart TimeSerieVC = new LineChart(); + protected LineChart TimeSerieVC = new LineChart(); +#endif #endregion Protected Fields @@ -134,6 +135,7 @@ namespace MP.Stats.Components #region Private Methods +#if false private PieChartDataset GetBarChartDataset() { var answ = new PieChartDataset @@ -145,7 +147,8 @@ namespace MP.Stats.Components HoverBorderWidth = 3 }; return answ; - } + } +#endif private List GetBarChartLabels() { @@ -153,6 +156,7 @@ namespace MP.Stats.Components return answ; } +#if false /// /// Elenco 2 linee x controli KO /KO /// @@ -170,7 +174,8 @@ namespace MP.Stats.Components BorderDash = new List { } }; return answ; - } + } +#endif private List GetLineChartLabels() { @@ -208,7 +213,9 @@ namespace MP.Stats.Components protected List getLineColors(float alpha) { List answ = new List(); - answ.Add(ChartColor.FromRgba(54, 82, 254, alpha)); +#if false + answ.Add(ChartColor.FromRgba(54, 82, 254, alpha)); +#endif return answ; } @@ -220,6 +227,7 @@ namespace MP.Stats.Components protected List getPieColors(float alpha) { List answ = new List(); +#if false foreach (var item in ParetoData) { if (item.label == EsitoOK) @@ -230,12 +238,14 @@ namespace MP.Stats.Components { answ.Add(ChartColor.FromRgba(254, 82, 65, alpha)); } - } + } +#endif return answ; } protected async Task HandleRedraw() { +#if false if (PieVC != null) { await PieVC.Clear(); @@ -245,7 +255,8 @@ namespace MP.Stats.Components { await TimeSerieVC.Clear(); await TimeSerieVC.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset()); - } + } +#endif } #endregion Protected Methods diff --git a/MP.Stats/Components/ChartOEE.razor b/MP.Stats/Components/ChartOEE.razor index 91670d2c..dfd20a4b 100644 --- a/MP.Stats/Components/ChartOEE.razor +++ b/MP.Stats/Components/ChartOEE.razor @@ -21,10 +21,10 @@
- + @**@
- + @**@
diff --git a/MP.Stats/Components/ChartOEE.razor.cs b/MP.Stats/Components/ChartOEE.razor.cs index b241e6df..1e425a08 100644 --- a/MP.Stats/Components/ChartOEE.razor.cs +++ b/MP.Stats/Components/ChartOEE.razor.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Blazorise.Charts; using Microsoft.AspNetCore.Components; using MP.Stats.Data; @@ -82,9 +81,9 @@ namespace MP.Stats.Components AspectRatio = 3.5 }; - protected LineChart NumGuasti = new LineChart(); + protected List NumGuasti = new List(); - protected BarChart ParetoGuasti = new BarChart(); + protected List ParetoGuasti = new List(); #endregion Protected Fields @@ -132,6 +131,7 @@ namespace MP.Stats.Components #region Private Methods +#if false private BarChartDataset GetBarChartDataset() { var answ = new BarChartDataset @@ -143,7 +143,8 @@ namespace MP.Stats.Components HoverBorderWidth = 5 }; return answ; - } + } +#endif private List GetBarChartLabels() { @@ -151,6 +152,7 @@ namespace MP.Stats.Components return answ; } +#if false private LineChartDataset GetLineChartDataset() { var answ = new LineChartDataset @@ -164,7 +166,8 @@ namespace MP.Stats.Components BorderDash = new List { } }; return answ; - } + } +#endif private List GetLineChartLabels() { @@ -202,6 +205,7 @@ namespace MP.Stats.Components protected List backgroundColors(int numRecords, float alpha) { List answ = new List(); +#if false // verde... for (int i = 0; i < numRecords / 3; i++) { @@ -215,7 +219,8 @@ namespace MP.Stats.Components while (answ.Count < numRecords) { answ.Add(ChartColor.FromRgba(255, 99, 132, alpha)); - } + } +#endif return answ; } @@ -224,13 +229,17 @@ namespace MP.Stats.Components { if (ParetoGuasti != null) { +#if false await ParetoGuasti.Clear(); - await ParetoGuasti.AddLabelsDatasetsAndUpdate(GetBarChartLabels(), GetBarChartDataset()); + await ParetoGuasti.AddLabelsDatasetsAndUpdate(GetBarChartLabels(), GetBarChartDataset()); +#endif } if (NumGuasti != null) { +#if false await NumGuasti.Clear(); - await NumGuasti.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset()); + await NumGuasti.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset()); +#endif } } diff --git a/MP.Stats/Components/ChartScarti.razor.cs b/MP.Stats/Components/ChartScarti.razor.cs index 2c8cd2f0..76b2c7a7 100644 --- a/MP.Stats/Components/ChartScarti.razor.cs +++ b/MP.Stats/Components/ChartScarti.razor.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Blazorise.Charts; using Microsoft.AspNetCore.Components; using MP.Stats.Data; @@ -81,9 +80,11 @@ namespace MP.Stats.Components AspectRatio = 3.5 }; +#if false protected LineChart NumGuasti = new LineChart(); - protected BarChart ParetoGuasti = new BarChart(); + protected BarChart ParetoGuasti = new BarChart(); +#endif #endregion Protected Fields @@ -131,6 +132,7 @@ namespace MP.Stats.Components #region Private Methods +#if false private BarChartDataset GetBarChartDataset() { var answ = new BarChartDataset @@ -142,7 +144,8 @@ namespace MP.Stats.Components HoverBorderWidth = 5 }; return answ; - } + } +#endif private List GetBarChartLabels() { @@ -150,6 +153,7 @@ namespace MP.Stats.Components return answ; } +#if false private LineChartDataset GetLineChartDataset() { var answ = new LineChartDataset @@ -163,7 +167,8 @@ namespace MP.Stats.Components BorderDash = new List { } }; return answ; - } + } +#endif private List GetLineChartLabels() { @@ -201,6 +206,7 @@ namespace MP.Stats.Components protected List backgroundColors(int numRecords, float alpha) { List answ = new List(); +#if false // rosso... for (int i = 0; i < numRecords / 3; i++) { @@ -214,13 +220,15 @@ namespace MP.Stats.Components while (answ.Count < numRecords) { answ.Add(ChartColor.FromRgba(54, 82, 235, alpha)); - } + } +#endif return answ; } protected async Task HandleRedraw() { +#if false if (ParetoGuasti != null) { await ParetoGuasti.Clear(); @@ -230,7 +238,8 @@ namespace MP.Stats.Components { await NumGuasti.Clear(); await NumGuasti.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset()); - } + } +#endif } #endregion Protected Methods diff --git a/MP.Stats/Components/ChartUserLog.razor b/MP.Stats/Components/ChartUserLog.razor index 2f870d3d..53c4139c 100644 --- a/MP.Stats/Components/ChartUserLog.razor +++ b/MP.Stats/Components/ChartUserLog.razor @@ -21,10 +21,10 @@
- + @* *@
- +@* *@
diff --git a/MP.Stats/Components/ChartUserLog.razor.cs b/MP.Stats/Components/ChartUserLog.razor.cs index 96e600ce..5a2f1149 100644 --- a/MP.Stats/Components/ChartUserLog.razor.cs +++ b/MP.Stats/Components/ChartUserLog.razor.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Blazorise.Charts; using Microsoft.AspNetCore.Components; using MP.Stats.Data; @@ -85,8 +84,10 @@ namespace MP.Stats.Components AspectRatio = 1 }; +#if false protected PieChart PieVC = new PieChart(); - protected LineChart TimeSerieVC = new LineChart(); + protected LineChart TimeSerieVC = new LineChart(); +#endif #endregion Protected Fields @@ -134,6 +135,7 @@ namespace MP.Stats.Components #region Private Methods +#if false private PieChartDataset GetBarChartDataset() { var answ = new PieChartDataset @@ -145,7 +147,8 @@ namespace MP.Stats.Components HoverBorderWidth = 3 }; return answ; - } + } +#endif private List GetBarChartLabels() { @@ -153,6 +156,7 @@ namespace MP.Stats.Components return answ; } +#if false /// /// Elenco 2 linee x controli KO /KO /// @@ -170,7 +174,8 @@ namespace MP.Stats.Components BorderDash = new List { } }; return answ; - } + } +#endif private List GetLineChartLabels() { @@ -208,6 +213,7 @@ namespace MP.Stats.Components protected List backgroundColors(int numRecords, float alpha) { List answ = new List(); +#if false // verde... for (int i = 0; i < numRecords / 3; i++) { @@ -221,7 +227,8 @@ namespace MP.Stats.Components while (answ.Count < numRecords) { answ.Add(ChartColor.FromRgba(180, 180, 35, alpha)); - } + } +#endif return answ; } @@ -234,12 +241,15 @@ namespace MP.Stats.Components protected List getLineColors(float alpha) { List answ = new List(); - answ.Add(ChartColor.FromRgba(54, 82, 254, alpha)); +#if false + answ.Add(ChartColor.FromRgba(54, 82, 254, alpha)); +#endif return answ; } protected async Task HandleRedraw() { +#if false if (PieVC != null) { await PieVC.Clear(); @@ -249,7 +259,8 @@ namespace MP.Stats.Components { await TimeSerieVC.Clear(); await TimeSerieVC.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset()); - } + } +#endif } #endregion Protected Methods diff --git a/MP.Stats/Components/SelectionFilter.razor b/MP.Stats/Components/SelectionFilter.razor index 8bba127f..a8c45f07 100644 --- a/MP.Stats/Components/SelectionFilter.razor +++ b/MP.Stats/Components/SelectionFilter.razor @@ -1,5 +1,4 @@ -@using Blazorise.Components -@using MP.Stats.Data +@using MP.Stats.Data
diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index de793444..3cbbbba5 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -175,10 +175,6 @@ - - - - diff --git a/MP.Stats/Pages/Test.razor.cs b/MP.Stats/Pages/Test.razor.cs index 6237ab7f..8603a75e 100644 --- a/MP.Stats/Pages/Test.razor.cs +++ b/MP.Stats/Pages/Test.razor.cs @@ -11,11 +11,9 @@ using Microsoft.AspNetCore.Components.Routing; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.Web.Virtualization; using Microsoft.JSInterop; +using MP.Data; using MP.Stats; using MP.Stats.Shared; -using Blazorise; -using Blazorise.Charts; -using MP.Data; namespace MP.Stats.Pages { @@ -66,10 +64,12 @@ namespace MP.Stats.Pages } } +#if false PieChart pieChart; LineChart lineChart; HorizontalBarChart barChartHoriz; - BarChart barChart; + BarChart barChart; +#endif protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) @@ -182,8 +182,10 @@ namespace MP.Stats.Pages #endif string[] Labels = { "Red", "Blue", "Yellow", "Green", "Purple", "Orange" }; +#if false List backgroundColors = new List { ChartColor.FromRgba(255, 99, 132, 0.2f), ChartColor.FromRgba(54, 162, 235, 0.2f), ChartColor.FromRgba(255, 206, 86, 0.2f), ChartColor.FromRgba(75, 192, 192, 0.2f), ChartColor.FromRgba(153, 102, 255, 0.2f), ChartColor.FromRgba(255, 159, 64, 0.2f) }; - List borderColors = new List { ChartColor.FromRgba(255, 99, 132, 1f), ChartColor.FromRgba(54, 162, 235, 1f), ChartColor.FromRgba(255, 206, 86, 1f), ChartColor.FromRgba(75, 192, 192, 1f), ChartColor.FromRgba(153, 102, 255, 1f), ChartColor.FromRgba(255, 159, 64, 1f) }; + List borderColors = new List { ChartColor.FromRgba(255, 99, 132, 1f), ChartColor.FromRgba(54, 162, 235, 1f), ChartColor.FromRgba(255, 206, 86, 1f), ChartColor.FromRgba(75, 192, 192, 1f), ChartColor.FromRgba(153, 102, 255, 1f), ChartColor.FromRgba(255, 159, 64, 1f) }; +#endif private List RandomizeData() { diff --git a/MP.Stats/Pages/_Host.cshtml b/MP.Stats/Pages/_Host.cshtml index 08212dcb..e2cd9e43 100644 --- a/MP.Stats/Pages/_Host.cshtml +++ b/MP.Stats/Pages/_Host.cshtml @@ -17,13 +17,6 @@ - - - - @* - - *@ - @@ -40,16 +33,6 @@ 🗙
- - @* - *@ - @**@ - @**@ - - @* - - *@ - diff --git a/MP.Stats/Startup.cs b/MP.Stats/Startup.cs index be7906a3..f512bd48 100644 --- a/MP.Stats/Startup.cs +++ b/MP.Stats/Startup.cs @@ -1,4 +1,3 @@ -using Blazorise; using ElmahCore.Mvc; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -8,7 +7,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using MP.Stats.Data; using System.Globalization; -using Blazorise.Bootstrap; namespace MP.Stats { @@ -77,12 +75,6 @@ namespace MP.Stats // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { - services.AddBlazorise(options => - { - options.ChangeTextOnKeyPress = true; // optional - }) - .AddBootstrapProviders(); - // Elmah services.AddElmah(); //string elmaConn = "Data Source=SQL2016DEV;Initial Catalog=Elmah;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=SHERPA.BBM;"; diff --git a/MP.Stats/_Imports.razor b/MP.Stats/_Imports.razor index 1dc55d9a..5527ce16 100644 --- a/MP.Stats/_Imports.razor +++ b/MP.Stats/_Imports.razor @@ -7,6 +7,4 @@ @using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.JSInterop @using MP.Stats -@using MP.Stats.Shared -@using Blazorise -@using Blazorise.Charts \ No newline at end of file +@using MP.Stats.Shared \ No newline at end of file