Loading INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/FitMethodsHelper.cs +6 −0 Original line number Diff line number Diff line using INAF.Apps.Uwp.SLabDataManager.Models.Chart.Fit; using System.Collections.Generic; using System.Linq; namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart { Loading @@ -20,6 +21,11 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart FitMethods.Add(fitMethod); } public FitMethodModel getFitMethod(string fitMethodName) { return FitMethods.FirstOrDefault(x => x.MethodName.Equals(fitMethodName)); } public List<FitMethodModel> getFitMethods() { List<FitMethodModel> clonedMethods = new List<FitMethodModel>(FitMethods.Count); Loading INAF.Apps.Uwp.SLabDataManager/Models/Chart/Fit/SegmentFitModel.cs +14 −1 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models.Chart.Fit { public sealed class SegmentFitModel : ObservableObject { /* ctor used when spectrum need to be processed from aligned one */ public SegmentFitModel(PointModel p1, PointModel p2, List<FitMethodModel> fitMethods) Loading @@ -22,12 +23,15 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models.Chart.Fit IsShown = false; /* this deny the creation of numericbox for parmeterValue when combobox is created. * This because the default selected fit method, linear, doesn't need this elements */ IsSelectedFitMethodChangedEventAllowed = false; if (FitMethods?.Count > 0) selectedFitMethod = FitMethods[0]; } /* this ctor is used when we're loading processed xml files */ public SegmentFitModel(PointModel p1, PointModel p2, string fitMethodName, Loading @@ -37,8 +41,12 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models.Chart.Fit if (FitMethods?.Count > 0) { SelectedFitMethod = FitMethods.FirstOrDefault(x => x.MethodName.Equals(fitMethodName)); if (SelectedFitMethod != null) if (SelectedFitMethod != null && SelectedFitMethod.ParameterConstraintValue != null) SelectedFitMethod.ParameterConstraintValue.Value = paramValue; /* this overwrite of variable value, allows creation of numericbox, because we're loading values from * processed filex and the selected fit method is different from the linear one, and this element is required */ IsSelectedFitMethodChangedEventAllowed = true; } } Loading Loading @@ -85,6 +93,11 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models.Chart.Fit } #endregion public void raiseSelectedFitMethod() { OnPropertyChanged(nameof(SelectedFitMethod)); } private void setRangeText() { RangeText = "SegmentsFitRangeLabel".GetText() Loading INAF.Apps.Uwp.SLabDataManager/Models/Chart/Fit/SegmentFitModelsFactory.cs +8 −0 Original line number Diff line number Diff line Loading @@ -17,5 +17,13 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models.Chart.Fit { return new SegmentFitModel(p1, p2, fitMethodsContainer.getFitMethods()); } public SegmentFitModel createSegmentFitModel(PointModel p1, PointModel p2, string fitMethodName, double paramValue) { return new SegmentFitModel(p1, p2, fitMethodName, paramValue, fitMethodsContainer.getFitMethods()); } } } INAF.Apps.Uwp.SLabDataManager/Models/Containers/ProcessedSpectraContainer.cs +12 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ using INAF.Apps.Uwp.SLabDataManager.Models.Chart; using System.Collections.ObjectModel; using System.Linq; using static INAF.Libraries.NetStandard.SLabCommonModels.Enums.Enums; namespace INAF.Apps.Uwp.SLabDataManager.Models.Containers { Loading Loading @@ -58,9 +59,19 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models.Containers ChartSpectraModels.Clear(); } public void delete(SpectrumType spectrumType) { if (!ChartSpectraModels.Any(x => x.Type == spectrumType)) return; var item = ChartSpectraModels.FirstOrDefault(x => x.Type == spectrumType); if (item != null) ChartSpectraModels.Remove(item); } public T get<T>() where T : IChartSpectrumModel { return (T)ChartSpectraModels.First(x => x is T); return (T)ChartSpectraModels.FirstOrDefault(x => x is T); } } } INAF.Apps.Uwp.SLabDataManager/ViewModels/ChartViewModel.cs +2 −0 Original line number Diff line number Diff line Loading @@ -614,10 +614,12 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels { case AlignmentUserControl alignmentUserControl: manageSpectrumOfTypeAligned(processedSpectraContainer); processedSpectraContainer.delete(SpectrumType.Aligned); break; case SegmentsFitUserControl segmentsFitUserControl: manageSpectrumOfTypeContinuumRemoved(processedSpectraContainer); processedSpectraContainer.delete(SpectrumType.ContinuumRemoved); break; default: Loading Loading
INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/FitMethodsHelper.cs +6 −0 Original line number Diff line number Diff line using INAF.Apps.Uwp.SLabDataManager.Models.Chart.Fit; using System.Collections.Generic; using System.Linq; namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart { Loading @@ -20,6 +21,11 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart FitMethods.Add(fitMethod); } public FitMethodModel getFitMethod(string fitMethodName) { return FitMethods.FirstOrDefault(x => x.MethodName.Equals(fitMethodName)); } public List<FitMethodModel> getFitMethods() { List<FitMethodModel> clonedMethods = new List<FitMethodModel>(FitMethods.Count); Loading
INAF.Apps.Uwp.SLabDataManager/Models/Chart/Fit/SegmentFitModel.cs +14 −1 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models.Chart.Fit { public sealed class SegmentFitModel : ObservableObject { /* ctor used when spectrum need to be processed from aligned one */ public SegmentFitModel(PointModel p1, PointModel p2, List<FitMethodModel> fitMethods) Loading @@ -22,12 +23,15 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models.Chart.Fit IsShown = false; /* this deny the creation of numericbox for parmeterValue when combobox is created. * This because the default selected fit method, linear, doesn't need this elements */ IsSelectedFitMethodChangedEventAllowed = false; if (FitMethods?.Count > 0) selectedFitMethod = FitMethods[0]; } /* this ctor is used when we're loading processed xml files */ public SegmentFitModel(PointModel p1, PointModel p2, string fitMethodName, Loading @@ -37,8 +41,12 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models.Chart.Fit if (FitMethods?.Count > 0) { SelectedFitMethod = FitMethods.FirstOrDefault(x => x.MethodName.Equals(fitMethodName)); if (SelectedFitMethod != null) if (SelectedFitMethod != null && SelectedFitMethod.ParameterConstraintValue != null) SelectedFitMethod.ParameterConstraintValue.Value = paramValue; /* this overwrite of variable value, allows creation of numericbox, because we're loading values from * processed filex and the selected fit method is different from the linear one, and this element is required */ IsSelectedFitMethodChangedEventAllowed = true; } } Loading Loading @@ -85,6 +93,11 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models.Chart.Fit } #endregion public void raiseSelectedFitMethod() { OnPropertyChanged(nameof(SelectedFitMethod)); } private void setRangeText() { RangeText = "SegmentsFitRangeLabel".GetText() Loading
INAF.Apps.Uwp.SLabDataManager/Models/Chart/Fit/SegmentFitModelsFactory.cs +8 −0 Original line number Diff line number Diff line Loading @@ -17,5 +17,13 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models.Chart.Fit { return new SegmentFitModel(p1, p2, fitMethodsContainer.getFitMethods()); } public SegmentFitModel createSegmentFitModel(PointModel p1, PointModel p2, string fitMethodName, double paramValue) { return new SegmentFitModel(p1, p2, fitMethodName, paramValue, fitMethodsContainer.getFitMethods()); } } }
INAF.Apps.Uwp.SLabDataManager/Models/Containers/ProcessedSpectraContainer.cs +12 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ using INAF.Apps.Uwp.SLabDataManager.Models.Chart; using System.Collections.ObjectModel; using System.Linq; using static INAF.Libraries.NetStandard.SLabCommonModels.Enums.Enums; namespace INAF.Apps.Uwp.SLabDataManager.Models.Containers { Loading Loading @@ -58,9 +59,19 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models.Containers ChartSpectraModels.Clear(); } public void delete(SpectrumType spectrumType) { if (!ChartSpectraModels.Any(x => x.Type == spectrumType)) return; var item = ChartSpectraModels.FirstOrDefault(x => x.Type == spectrumType); if (item != null) ChartSpectraModels.Remove(item); } public T get<T>() where T : IChartSpectrumModel { return (T)ChartSpectraModels.First(x => x is T); return (T)ChartSpectraModels.FirstOrDefault(x => x is T); } } }
INAF.Apps.Uwp.SLabDataManager/ViewModels/ChartViewModel.cs +2 −0 Original line number Diff line number Diff line Loading @@ -614,10 +614,12 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels { case AlignmentUserControl alignmentUserControl: manageSpectrumOfTypeAligned(processedSpectraContainer); processedSpectraContainer.delete(SpectrumType.Aligned); break; case SegmentsFitUserControl segmentsFitUserControl: manageSpectrumOfTypeContinuumRemoved(processedSpectraContainer); processedSpectraContainer.delete(SpectrumType.ContinuumRemoved); break; default: Loading