Loading INAF.Apps.Uwp.SLabDataManager/App.xaml.cs +1 −1 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ namespace INAF.Apps.Uwp.SLabDataManager /* usercontrols viewmodels */ .AddScoped<AlignmentViewModel>() .AddScoped<InfoMeasurementInfoViewModel>() .AddScoped<InfoSampleDataViewModel>() .AddSingleton<InfoSampleDataViewModel>() .AddSingleton<SegmentsFitViewModel>() .AddScoped<SmoothingViewModel>() .AddSingleton<UserControlsViewModelFactory>() Loading INAF.Apps.Uwp.SLabDataManager/Assets/logbook/logbook.xml +4 −4 Original line number Diff line number Diff line Loading @@ -2,12 +2,12 @@ <logbook> <updates> <fixes> <fix>Fixed connection configuration</fix> <fix>Fixed error in saving spectrum sample data and measurement info</fix> <fix>Issue in retrieving saved grain sizes</fix> <!--<fix>Fixed management of sample data/measurement info panel when changing RAW file</fix> <fix>Fixed file deletion when changing RAW file</fix>--> </fixes> <!--<addings> <adding>Creation of averaged files from single acquisitions</adding> <adding>Save single acquisitions into DB as source of averaged file and retrieve as info</adding> <adding>Added percentage of minerals for mix</adding> </addings>--> </updates> </logbook> No newline at end of file INAF.Apps.Uwp.SLabDataManager/Extensions/Extensions.cs +23 −23 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions return spectrum.Elements.Where(x => x.X >= xMin && x.X <= xMax); } private static double getXMax(ISpectrumModel spectrum, private static double getXMax(IChartSpectrumModel spectrum, double xMax, bool isXMaxHighestBoundary) { Loading Loading @@ -103,7 +103,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions return xMax; } private static double getXMin(ISpectrumModel spectrum, private static double getXMin(IChartSpectrumModel spectrum, double xMin, bool isXMinLowestBoundary) { Loading Loading @@ -158,7 +158,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions return xMin; } public static IEnumerable<ElementModel> GetLeftSegmentElements(this ISpectrumModel spectrum, public static IEnumerable<ElementModel> GetLeftSegmentElements(this IChartSpectrumModel spectrum, double xMin, bool isXMinLowestBoundary, double xMax, Loading @@ -178,7 +178,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions return spectrum.Elements.Where(x => x.X >= xMin && x.X <= xMax); } public static IEnumerable<ElementModel> GetRightSegmentElements(this ISpectrumModel spectrum, public static IEnumerable<ElementModel> GetRightSegmentElements(this IChartSpectrumModel spectrum, double xMin, bool isXMinLowestBoundary, double xMax, Loading @@ -198,7 +198,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions return spectrum.Elements.Where(x => x.X >= xMin && x.X <= xMax); } public static void UpdateElements(this ISpectrumModel spectrum, public static void UpdateElements(this IChartSpectrumModel spectrum, IEnumerable<ElementModel> elements) { foreach (var element in elements) Loading Loading @@ -270,7 +270,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions } #region local files public static string ToTxt(this ISpectrumModel spectrum) public static string ToTxt(this IChartSpectrumModel spectrum) { if (spectrum == null || spectrum.Elements == null || spectrum.Elements.Count == 0) return null; Loading Loading @@ -672,22 +672,22 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions return new SolidColorBrush(color); } public static IChartSpectrumModel ToChartSpectrumModel(this FileSpectrumModel fileSpectrum) { List<ElementModel> elements = new List<ElementModel>(); foreach (var element in fileSpectrum.Elements) { elements.Add(new ElementModel(element.X, element.Y)); } return new ChartSpectrumModel() { Id = fileSpectrum.Id, Filename = fileSpectrum.Filename, ParentId = fileSpectrum.ParentId, Type = fileSpectrum.Type, Elements = new ObservableCollection<ElementModel>(elements) }; } //public static IChartSpectrumModel ToChartSpectrumModel(this FileSpectrumModel fileSpectrum) //{ // List<ElementModel> elements = new List<ElementModel>(); // foreach (var element in fileSpectrum.Elements) // { // elements.Add(new ElementModel(element.X, element.Y)); // } // return new ChartSpectrumModel() // { // Id = fileSpectrum.Id, // Filename = fileSpectrum.Filename, // ParentId = fileSpectrum.ParentId, // Type = fileSpectrum.Type, // Elements = new ObservableCollection<ElementModel>(elements) // }; //} } } INAF.Apps.Uwp.SLabDataManager/Helpers/FileReaders/SpectrumFiles/XmlSpectrumFile.cs +3 −3 Original line number Diff line number Diff line Loading @@ -102,13 +102,13 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.FileReaders.SpectrumFiles public class DeserializedElement { [XmlAttribute(AttributeName = "Wavelength", DataType = "double")] public string Wavelength { get; set; } public double Wavelength { get; set; } [XmlAttribute(AttributeName = "Value", DataType = "double")] public string Value { get; set; } public double Value { get; set; } [XmlAttribute(AttributeName = "YStdDev", DataType = "double")] public string YStdDev { get; set; } public double YStdDev { get; set; } [XmlText] public string Text { get; set; } Loading INAF.Apps.Uwp.SLabDataManager/Helpers/FileReaders/SpectrumFiles/XmlSpectrumFileReader.cs +29 −20 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ using INAF.Apps.Uwp.SLabDataManager.Models.Chart; using INAF.Libraries.Uwp.Logging; using INAF.Libraries.Uwp.Settings; using INAF.Libraries.Uwp.Xml; using System; using System.IO; using System.Threading.Tasks; using System.Xml.Serialization; Loading @@ -23,7 +24,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.FileReaders this.xmlHelper = xmlHelper; } public new async Task<(IChartSpectrumModel spectrum, string exMsg)> readFileAsync(string fileKey) public async Task<(IChartSpectrumModel spectrum, string exMsg)> readFileAsync(string fileKey) { IChartSpectrumModel chartSpectrumModel = null; string exMsg = string.Empty; Loading @@ -42,13 +43,15 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.FileReaders DeserializedSpectrum spectrumObj = null; await Task.Run(async () => { try { /* read all xml file */ XmlDocument dom = await xmlHelper.getXmlDocumentAsync(file); if (dom == null) { logger.Write<XmlSpectrumFileReader>($"Error while parsing xml spectrum!", Serilog.Events.LogEventLevel.Error); exMsg = "Error while parsing config.xml!"; logger.Write<XmlSpectrumFileReader>($"Error while parsing {file.Path}", Serilog.Events.LogEventLevel.Error); exMsg = $"{"ProcessedReadingErrorMessage".GetText()} {file.Path}"; return; } Loading @@ -62,12 +65,18 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.FileReaders if (spectrumObj == null) { logger.Write<XmlSpectrumFileReader>($"Error while deserializing xml spectrum!", Serilog.Events.LogEventLevel.Error); exMsg = "Error while deserializing xml spectrum!"; logger.Write<XmlSpectrumFileReader>($"Error while deserializing {file.Path}", Serilog.Events.LogEventLevel.Error); exMsg = $"{"ProcessedReadingErrorMessage".GetText()} {file.Path}"; return; } } catch (Exception ex) { exMsg = $"{"ProcessedReadingErrorMessage".GetText()} {file.Path}"; } }); if (string.IsNullOrEmpty(exMsg)) chartSpectrumModel = spectraFactory.build(spectrumObj); return (chartSpectrumModel, exMsg); Loading Loading
INAF.Apps.Uwp.SLabDataManager/App.xaml.cs +1 −1 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ namespace INAF.Apps.Uwp.SLabDataManager /* usercontrols viewmodels */ .AddScoped<AlignmentViewModel>() .AddScoped<InfoMeasurementInfoViewModel>() .AddScoped<InfoSampleDataViewModel>() .AddSingleton<InfoSampleDataViewModel>() .AddSingleton<SegmentsFitViewModel>() .AddScoped<SmoothingViewModel>() .AddSingleton<UserControlsViewModelFactory>() Loading
INAF.Apps.Uwp.SLabDataManager/Assets/logbook/logbook.xml +4 −4 Original line number Diff line number Diff line Loading @@ -2,12 +2,12 @@ <logbook> <updates> <fixes> <fix>Fixed connection configuration</fix> <fix>Fixed error in saving spectrum sample data and measurement info</fix> <fix>Issue in retrieving saved grain sizes</fix> <!--<fix>Fixed management of sample data/measurement info panel when changing RAW file</fix> <fix>Fixed file deletion when changing RAW file</fix>--> </fixes> <!--<addings> <adding>Creation of averaged files from single acquisitions</adding> <adding>Save single acquisitions into DB as source of averaged file and retrieve as info</adding> <adding>Added percentage of minerals for mix</adding> </addings>--> </updates> </logbook> No newline at end of file
INAF.Apps.Uwp.SLabDataManager/Extensions/Extensions.cs +23 −23 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions return spectrum.Elements.Where(x => x.X >= xMin && x.X <= xMax); } private static double getXMax(ISpectrumModel spectrum, private static double getXMax(IChartSpectrumModel spectrum, double xMax, bool isXMaxHighestBoundary) { Loading Loading @@ -103,7 +103,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions return xMax; } private static double getXMin(ISpectrumModel spectrum, private static double getXMin(IChartSpectrumModel spectrum, double xMin, bool isXMinLowestBoundary) { Loading Loading @@ -158,7 +158,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions return xMin; } public static IEnumerable<ElementModel> GetLeftSegmentElements(this ISpectrumModel spectrum, public static IEnumerable<ElementModel> GetLeftSegmentElements(this IChartSpectrumModel spectrum, double xMin, bool isXMinLowestBoundary, double xMax, Loading @@ -178,7 +178,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions return spectrum.Elements.Where(x => x.X >= xMin && x.X <= xMax); } public static IEnumerable<ElementModel> GetRightSegmentElements(this ISpectrumModel spectrum, public static IEnumerable<ElementModel> GetRightSegmentElements(this IChartSpectrumModel spectrum, double xMin, bool isXMinLowestBoundary, double xMax, Loading @@ -198,7 +198,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions return spectrum.Elements.Where(x => x.X >= xMin && x.X <= xMax); } public static void UpdateElements(this ISpectrumModel spectrum, public static void UpdateElements(this IChartSpectrumModel spectrum, IEnumerable<ElementModel> elements) { foreach (var element in elements) Loading Loading @@ -270,7 +270,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions } #region local files public static string ToTxt(this ISpectrumModel spectrum) public static string ToTxt(this IChartSpectrumModel spectrum) { if (spectrum == null || spectrum.Elements == null || spectrum.Elements.Count == 0) return null; Loading Loading @@ -672,22 +672,22 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions return new SolidColorBrush(color); } public static IChartSpectrumModel ToChartSpectrumModel(this FileSpectrumModel fileSpectrum) { List<ElementModel> elements = new List<ElementModel>(); foreach (var element in fileSpectrum.Elements) { elements.Add(new ElementModel(element.X, element.Y)); } return new ChartSpectrumModel() { Id = fileSpectrum.Id, Filename = fileSpectrum.Filename, ParentId = fileSpectrum.ParentId, Type = fileSpectrum.Type, Elements = new ObservableCollection<ElementModel>(elements) }; } //public static IChartSpectrumModel ToChartSpectrumModel(this FileSpectrumModel fileSpectrum) //{ // List<ElementModel> elements = new List<ElementModel>(); // foreach (var element in fileSpectrum.Elements) // { // elements.Add(new ElementModel(element.X, element.Y)); // } // return new ChartSpectrumModel() // { // Id = fileSpectrum.Id, // Filename = fileSpectrum.Filename, // ParentId = fileSpectrum.ParentId, // Type = fileSpectrum.Type, // Elements = new ObservableCollection<ElementModel>(elements) // }; //} } }
INAF.Apps.Uwp.SLabDataManager/Helpers/FileReaders/SpectrumFiles/XmlSpectrumFile.cs +3 −3 Original line number Diff line number Diff line Loading @@ -102,13 +102,13 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.FileReaders.SpectrumFiles public class DeserializedElement { [XmlAttribute(AttributeName = "Wavelength", DataType = "double")] public string Wavelength { get; set; } public double Wavelength { get; set; } [XmlAttribute(AttributeName = "Value", DataType = "double")] public string Value { get; set; } public double Value { get; set; } [XmlAttribute(AttributeName = "YStdDev", DataType = "double")] public string YStdDev { get; set; } public double YStdDev { get; set; } [XmlText] public string Text { get; set; } Loading
INAF.Apps.Uwp.SLabDataManager/Helpers/FileReaders/SpectrumFiles/XmlSpectrumFileReader.cs +29 −20 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ using INAF.Apps.Uwp.SLabDataManager.Models.Chart; using INAF.Libraries.Uwp.Logging; using INAF.Libraries.Uwp.Settings; using INAF.Libraries.Uwp.Xml; using System; using System.IO; using System.Threading.Tasks; using System.Xml.Serialization; Loading @@ -23,7 +24,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.FileReaders this.xmlHelper = xmlHelper; } public new async Task<(IChartSpectrumModel spectrum, string exMsg)> readFileAsync(string fileKey) public async Task<(IChartSpectrumModel spectrum, string exMsg)> readFileAsync(string fileKey) { IChartSpectrumModel chartSpectrumModel = null; string exMsg = string.Empty; Loading @@ -42,13 +43,15 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.FileReaders DeserializedSpectrum spectrumObj = null; await Task.Run(async () => { try { /* read all xml file */ XmlDocument dom = await xmlHelper.getXmlDocumentAsync(file); if (dom == null) { logger.Write<XmlSpectrumFileReader>($"Error while parsing xml spectrum!", Serilog.Events.LogEventLevel.Error); exMsg = "Error while parsing config.xml!"; logger.Write<XmlSpectrumFileReader>($"Error while parsing {file.Path}", Serilog.Events.LogEventLevel.Error); exMsg = $"{"ProcessedReadingErrorMessage".GetText()} {file.Path}"; return; } Loading @@ -62,12 +65,18 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.FileReaders if (spectrumObj == null) { logger.Write<XmlSpectrumFileReader>($"Error while deserializing xml spectrum!", Serilog.Events.LogEventLevel.Error); exMsg = "Error while deserializing xml spectrum!"; logger.Write<XmlSpectrumFileReader>($"Error while deserializing {file.Path}", Serilog.Events.LogEventLevel.Error); exMsg = $"{"ProcessedReadingErrorMessage".GetText()} {file.Path}"; return; } } catch (Exception ex) { exMsg = $"{"ProcessedReadingErrorMessage".GetText()} {file.Path}"; } }); if (string.IsNullOrEmpty(exMsg)) chartSpectrumModel = spectraFactory.build(spectrumObj); return (chartSpectrumModel, exMsg); Loading