Loading INAF.Apps.Uwp.SLabDataManager/App.xaml.cs +1 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ namespace INAF.Apps.Uwp.SLabDataManager await ActivationService.ActivateAsync(args); } private void OnAppUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e) { // TODO WTS: Please log and handle the exception as appropriate to your scenario Loading INAF.Apps.Uwp.SLabDataManager/Charts/Containers/SpectraContainer.cs +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts.Containers int index = Spectra.ToList().FindIndex(x => x.Type == spectrum.Type); if (index >= 0) Spectra[index] = spectrum; raiseIsAnySpectrumUpdated(); } else /* ...otherwise, add it... */ Loading INAF.Apps.Uwp.SLabDataManager/Charts/Containers/SpectraContainerBase.cs +9 −10 Original line number Diff line number Diff line using INAF.Apps.Uwp.SLabDataManager.Models; using INAF.Apps.Uwp.SLabDataManager.Helpers; using INAF.Apps.Uwp.SLabDataManager.Models; using INAF.Libraries.NetStandard.ScienceModels.Extensions; using INAF.Libraries.NetStandard.ScienceModels.Spectra; using INAF.Libraries.Uwp.Logging; using Microsoft.Toolkit.Mvvm.ComponentModel; Loading @@ -8,8 +10,6 @@ using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; using SpectrumModel = INAF.Apps.Uwp.SLabDataManager.Models.Spectrum.SpectrumModel; using INAF.Libraries.NetStandard.ScienceModels.Extensions; using INAF.Apps.Uwp.SLabDataManager.Helpers; namespace INAF.Apps.Uwp.SLabDataManager.Charts.Containers { Loading Loading @@ -73,13 +73,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts.Containers } } protected bool isSpectrumContinuumRemoved; public bool IsSpectrumContinuumRemoved { get { return isSpectrumContinuumRemoved; } set { SetProperty(ref isSpectrumContinuumRemoved, value); } } public string YAxisTitle { get; protected set; } protected ObservableCollection<SpectrumSummaryModel> summaries; Loading Loading @@ -206,6 +199,12 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts.Containers isAnySpectrumRemoved = false;// trick to enable for the next added spectrum } public void raiseIsAnySpectrumUpdated() { IsAnySpectrumUpdated = true; isAnySpectrumUpdated = false;// trick to enable for the next added spectrum } public async Task setBoundariesAsync() { (double xMin, double xMax, double yMin, double yMax) result = await getSpectrumAxesBoundariesAsync(); Loading INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/ChartAnnotationsHelper.cs +3 −6 Original line number Diff line number Diff line using INAF.Apps.Uwp.SLabDataManager.Extensions; using INAF.Apps.Uwp.SLabDataManager.Models; using INAF.Apps.Uwp.SLabDataManager.Models.Fit; using INAF.Apps.Uwp.SLabDataManager.Models.Spectrum; using INAF.Apps.Uwp.SLabDataManager.ViewModels; using INAF.Libraries.NetStandard.Math.Fit.Linear.Models; using INAF.Libraries.NetStandard.Math.Models; Loading @@ -13,9 +12,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Telerik.UI.Xaml.Controls.Chart; using Windows.Foundation; using Windows.UI.Xaml; using static INAF.Apps.Uwp.SLabDataManager.Constants.Enums; using static INAF.Libraries.NetStandard.SLabCommonModels.Enums.Enums; using SpectrumModel = INAF.Apps.Uwp.SLabDataManager.Models.Spectrum.SpectrumModel; Loading Loading @@ -115,8 +112,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart .Where(x => x is CartesianCustomAnnotation) .Cast<CartesianCustomAnnotation>() .OrderBy(x => x.HorizontalValue); foreach (var point in orderedPoints) System.Diagnostics.Debug.WriteLine($"orderedPoint - x,y: {point.HorizontalValue},{point.VerticalValue}"); //foreach (var point in orderedPoints) // System.Diagnostics.Debug.WriteLine($"orderedPoint - x,y: {point.HorizontalValue},{point.VerticalValue}"); /* clear existing segments before creating new ones */ var segmentsFitModelContainer = serviceProvider.GetRequiredService<SegmentsFitModelHelper>(); Loading @@ -138,7 +135,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart int newSegmentsNum = newSegments.Count(); for (int i = 0; i < newSegmentsNum; i++) { System.Diagnostics.Debug.WriteLine($"fit segment {newSegments.ElementAt(i).P1.X}-{newSegments.ElementAt(i).P2.X}"); //System.Diagnostics.Debug.WriteLine($"fit segment {newSegments.ElementAt(i).P1.X}-{newSegments.ElementAt(i).P2.X}"); await viewModel.fitSelectedSegmentAsync(newSegments.ElementAt(i)); } } Loading INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/SeriesHelper.cs +4 −7 Original line number Diff line number Diff line using INAF.Apps.Uwp.SLabDataManager.Models.Spectrum; using System.Threading.Tasks; using Telerik.UI.Xaml.Controls.Chart; namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart Loading @@ -6,20 +7,16 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart public sealed class SeriesHelper { public static void UpdateUI(RadCartesianChart chart) { //chart.InvalidateUI(); chart.UpdateLayout(); ManageSeriesVisibility(chart); } private static void ManageSeriesVisibility(RadCartesianChart chart) { var spectraSeries = chart.Series; foreach (var spectrumSeries in spectraSeries) { SpectrumModel spectrumModel = spectrumSeries.DataContext as SpectrumModel; System.Diagnostics.Debug.WriteLine($"{spectrumModel.Type}: {spectrumModel.IsVisible}"); spectrumSeries.Visibility = spectrumModel.IsVisible ? Windows.UI.Xaml.Visibility.Visible : Windows.UI.Xaml.Visibility.Collapsed; //await Task.Delay(50); } //chart.UpdateLayout(); } } } Loading
INAF.Apps.Uwp.SLabDataManager/App.xaml.cs +1 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ namespace INAF.Apps.Uwp.SLabDataManager await ActivationService.ActivateAsync(args); } private void OnAppUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e) { // TODO WTS: Please log and handle the exception as appropriate to your scenario Loading
INAF.Apps.Uwp.SLabDataManager/Charts/Containers/SpectraContainer.cs +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts.Containers int index = Spectra.ToList().FindIndex(x => x.Type == spectrum.Type); if (index >= 0) Spectra[index] = spectrum; raiseIsAnySpectrumUpdated(); } else /* ...otherwise, add it... */ Loading
INAF.Apps.Uwp.SLabDataManager/Charts/Containers/SpectraContainerBase.cs +9 −10 Original line number Diff line number Diff line using INAF.Apps.Uwp.SLabDataManager.Models; using INAF.Apps.Uwp.SLabDataManager.Helpers; using INAF.Apps.Uwp.SLabDataManager.Models; using INAF.Libraries.NetStandard.ScienceModels.Extensions; using INAF.Libraries.NetStandard.ScienceModels.Spectra; using INAF.Libraries.Uwp.Logging; using Microsoft.Toolkit.Mvvm.ComponentModel; Loading @@ -8,8 +10,6 @@ using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; using SpectrumModel = INAF.Apps.Uwp.SLabDataManager.Models.Spectrum.SpectrumModel; using INAF.Libraries.NetStandard.ScienceModels.Extensions; using INAF.Apps.Uwp.SLabDataManager.Helpers; namespace INAF.Apps.Uwp.SLabDataManager.Charts.Containers { Loading Loading @@ -73,13 +73,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts.Containers } } protected bool isSpectrumContinuumRemoved; public bool IsSpectrumContinuumRemoved { get { return isSpectrumContinuumRemoved; } set { SetProperty(ref isSpectrumContinuumRemoved, value); } } public string YAxisTitle { get; protected set; } protected ObservableCollection<SpectrumSummaryModel> summaries; Loading Loading @@ -206,6 +199,12 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts.Containers isAnySpectrumRemoved = false;// trick to enable for the next added spectrum } public void raiseIsAnySpectrumUpdated() { IsAnySpectrumUpdated = true; isAnySpectrumUpdated = false;// trick to enable for the next added spectrum } public async Task setBoundariesAsync() { (double xMin, double xMax, double yMin, double yMax) result = await getSpectrumAxesBoundariesAsync(); Loading
INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/ChartAnnotationsHelper.cs +3 −6 Original line number Diff line number Diff line using INAF.Apps.Uwp.SLabDataManager.Extensions; using INAF.Apps.Uwp.SLabDataManager.Models; using INAF.Apps.Uwp.SLabDataManager.Models.Fit; using INAF.Apps.Uwp.SLabDataManager.Models.Spectrum; using INAF.Apps.Uwp.SLabDataManager.ViewModels; using INAF.Libraries.NetStandard.Math.Fit.Linear.Models; using INAF.Libraries.NetStandard.Math.Models; Loading @@ -13,9 +12,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Telerik.UI.Xaml.Controls.Chart; using Windows.Foundation; using Windows.UI.Xaml; using static INAF.Apps.Uwp.SLabDataManager.Constants.Enums; using static INAF.Libraries.NetStandard.SLabCommonModels.Enums.Enums; using SpectrumModel = INAF.Apps.Uwp.SLabDataManager.Models.Spectrum.SpectrumModel; Loading Loading @@ -115,8 +112,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart .Where(x => x is CartesianCustomAnnotation) .Cast<CartesianCustomAnnotation>() .OrderBy(x => x.HorizontalValue); foreach (var point in orderedPoints) System.Diagnostics.Debug.WriteLine($"orderedPoint - x,y: {point.HorizontalValue},{point.VerticalValue}"); //foreach (var point in orderedPoints) // System.Diagnostics.Debug.WriteLine($"orderedPoint - x,y: {point.HorizontalValue},{point.VerticalValue}"); /* clear existing segments before creating new ones */ var segmentsFitModelContainer = serviceProvider.GetRequiredService<SegmentsFitModelHelper>(); Loading @@ -138,7 +135,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart int newSegmentsNum = newSegments.Count(); for (int i = 0; i < newSegmentsNum; i++) { System.Diagnostics.Debug.WriteLine($"fit segment {newSegments.ElementAt(i).P1.X}-{newSegments.ElementAt(i).P2.X}"); //System.Diagnostics.Debug.WriteLine($"fit segment {newSegments.ElementAt(i).P1.X}-{newSegments.ElementAt(i).P2.X}"); await viewModel.fitSelectedSegmentAsync(newSegments.ElementAt(i)); } } Loading
INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/SeriesHelper.cs +4 −7 Original line number Diff line number Diff line using INAF.Apps.Uwp.SLabDataManager.Models.Spectrum; using System.Threading.Tasks; using Telerik.UI.Xaml.Controls.Chart; namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart Loading @@ -6,20 +7,16 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart public sealed class SeriesHelper { public static void UpdateUI(RadCartesianChart chart) { //chart.InvalidateUI(); chart.UpdateLayout(); ManageSeriesVisibility(chart); } private static void ManageSeriesVisibility(RadCartesianChart chart) { var spectraSeries = chart.Series; foreach (var spectrumSeries in spectraSeries) { SpectrumModel spectrumModel = spectrumSeries.DataContext as SpectrumModel; System.Diagnostics.Debug.WriteLine($"{spectrumModel.Type}: {spectrumModel.IsVisible}"); spectrumSeries.Visibility = spectrumModel.IsVisible ? Windows.UI.Xaml.Visibility.Visible : Windows.UI.Xaml.Visibility.Collapsed; //await Task.Delay(50); } //chart.UpdateLayout(); } } }