Commit af005004 authored by Francesco Carraro's avatar Francesco Carraro
Browse files

when saving sample and measurement info and rawFileId is 0, it is retrieved from DB

Add new spectrum operations and improve hex handling

- Added `GetSpectrumIdByNameAndSpectrumType` operation in `remoteoperations.xml` and `Enums.cs`.
- Enhanced `ToSolidColorBrush` in `Extensions.cs` to support 6 or 8 character hex strings.
- Imported necessary models in `RemoteOperationsManagerSpectraFileActions.cs`, `BaseViewModel.cs`, and `ChartViewModelInfo.cs`.
- Added `getSpectrumIdByNameAndSpectrumType` method in `RemoteOperationsManagerSpectraFileActions.cs`.
- Updated app version to `1.0.47.0` in `Package.appxmanifest`.
- Added logic in `ChartViewModelInfo.cs` for spectrum ID retrieval by name and type.
- Made `OnNavigatingFrom` synchronous and added null check for `ExMsg` in `MainViewModel.cs`.
- Refactored `MainViewModel.cs` for XML processing and spectrum saving.
- Added `StorageItemsHelper` dependency and new properties/methods in `MultipleSelectionViewModel.cs`.
- Introduced `GenericRequestByParametersModel` class for request modeling.
parent d07fde5a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
		<operation type="GetSpectraTypesParents">AppSpectraFilesActions/GetSpectraTypesParents</operation>
		<operation type="GetSpectrumData">AppSpectraFilesActions/GetSpectrumData</operation>
		<operation type="GetSpectrumFile">AppSpectraFilesActions/GetSpectrumFile</operation>
		<operation type="GetSpectrumIdByNameAndSpectrumType">AppSpectraFilesActions/GetSpectrumIdByNameAndSpectrumType</operation>
		<operation type="GetSmoothingSettings">AppSpectraFilesActions/GetSmoothingSettings</operation>
		<operation type="GetSpectrumVersions">AppSpectraFilesActions/GetSpectrumVersions</operation>
		<operation type="IsAnySpectrumTypeSavedOnCloud">AppSpectraFilesActions/IsAnySpectrumTypeSavedOnCloud</operation>
+14 −4
Original line number Diff line number Diff line
@@ -117,10 +117,20 @@ namespace INAF.Apps.Uwp.SLabDataManager.Extensions
        {
            hexstring = hexstring.Replace("#", string.Empty);
            // from #RRGGBB string
            var a = (byte)Convert.ToUInt32(hexstring.Substring(0, 2), 16);
            var r = (byte)Convert.ToUInt32(hexstring.Substring(2, 2), 16);
            var g = (byte)Convert.ToUInt32(hexstring.Substring(4, 2), 16);
            var b = (byte)Convert.ToUInt32(hexstring.Substring(6, 2), 16);
            byte a = 0;
            int index = 0;
            if (hexstring.Length == 8)
            {
                a = (byte)Convert.ToUInt32(hexstring.Substring(index, 2), 16);
                index += 2;
            }
            var r = (byte)Convert.ToUInt32(hexstring.Substring(index, 2), 16);
            index += 2;

            var g = (byte)Convert.ToUInt32(hexstring.Substring(index, 2), 16);
            index += 2;

            var b = (byte)Convert.ToUInt32(hexstring.Substring(index, 2), 16);
            //get the color
            Color color = Color.FromArgb(a, r, g, b);
            // create the solidColorbrush
+6 −0
Original line number Diff line number Diff line
using INAF.Libraries.NetStandard.HyperLabCommonModels.Models.Files;
using INAF.Libraries.NetStandard.HyperLabCommonModels.Models.Spectrum;
using INAF.Libraries.NetStandard.HyperLabCommonModels.Models.WebApp.Requests;
using INAF.Libraries.NetStandard.HyperLabCommonModels.Models.WebApp.Requests.SaveSpectrum;
using INAF.Libraries.NetStandard.HyperLabCommonModels.Models.WebApp.Responses;
@@ -21,6 +22,11 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.RemoteOperations
            return await getAsync<FileSpectrumModel>(RemoteOperationType.GetSpectrumFile, buildArgument(nameof(ParentId), ParentId.ToString()));
        }

        public async Task<SpectrumModel> getSpectrumIdByNameAndSpectrumType(GenericRequestByParametersModel model)
        {
            return await getAsync<SpectrumModel>(RemoteOperationType.GetSpectrumIdByNameAndSpectrumType, buildQueryString(model));
        }

        public async Task<GenericValueStringResponseModel> isAnySpectrumTypeSavedOnCloudAsync(IsAnySpectrumTypeSavedOnCloudRequestModel model)
        {
            return await postAsync<GenericValueStringResponseModel>(model, RemoteOperationType.IsAnySpectrumTypeSavedOnCloud);
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
  <Identity
    Name="INAF.Apps.Uwp.SLabDataManager"
    Publisher="CN=INAF-IAPS, O=INAF-IAPS, C=IT"
    Version="1.0.46.0" />
    Version="1.0.47.0" />

  <mp:PhoneIdentity PhoneProductId="07F38165-05DE-4ED7-8514-60D1E8CDCBFE" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
            GetSpectraTypesParents,
            GetSpectrumData,
            GetSpectrumFile,
            GetSpectrumIdByNameAndSpectrumType,
            GetSpectrumVersions,
            IsAnySpectrumTypeSavedOnCloud,
            IsSpectrumTypeSavedWithCountOnCloud,
Loading