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

added refresh button in smoothing panel; fixed saving locally and on cloud

parent cf8d7230
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3,10 +3,13 @@
	<updates>
		<fixes>
			<fix>When a processing step (alignment, etc) is saved on cloud, cloud icon appears on related panel</fix>
			<fix>Fixed issue in saving smoothed spectrum on cloud</fix>
			<fix>Fixed issue in saving smoothed spectrum locally</fix>
		</fixes>
		<addings>
			<adding>Added warning message when saving on cloud overwrites data already saved on cloud</adding>
			<adding>Improved cloud icon in 'Smoothing' panel: each smoothing type has its own cloud icon</adding>
			<adding>Added 'refresh' button in smoothing panel for updating the selected spectrum type</adding>
		</addings>
	</updates>
</logbook>
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
@@ -1096,4 +1096,10 @@
  <data name="OverwriteSavedSpectrumQuestion" xml:space="preserve">
    <value>By saving this processing step, the one saved on cloud will be overwritten. Do you want to continue?</value>
  </data>
  <data name="RawSpectrumSmoothingButtonHidePanel.Text" xml:space="preserve">
    <value>Close smoothing settings panel</value>
  </data>
  <data name="RawSpectrumSmoothingButtonRefreshPanel.Text" xml:space="preserve">
    <value>Refresh selected spectrum type</value>
  </data>
</root>
 No newline at end of file
+7 −0
Original line number Diff line number Diff line
@@ -362,6 +362,11 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
                WorkingItems.SpectrumChartOptions.AreErrorBarsRequired = isStdDevAvailableForPoints;
        }

        private void prepareProcessedSpectrumForSaving<T>(SpectrumType spectrumType) where T : IChartSpectrumOfTypeProcessedModel
        {
            ((T)WorkingItems.SpectraContainer.tryGetSpectrumOfType(spectrumType)).prepareForSaving();
        }

        private void setChartLegendHeight()
        {
            int candidateHeight = chartLegendMinimumHeight + (45 * (WorkingItems.SpectraContainer.getSpectraNum() - 2));
@@ -593,6 +598,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
        {
            if (SmoothingViewModel == null)
                SmoothingViewModel = await userControlsViewModelFactory.createSmoothingViewModelAsync();
            else
                await SmoothingViewModel.initAsync();
        }
        #endregion

+10 −11
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@ using INAF.Apps.Uwp.SLabDataManager.Helpers;
using INAF.Apps.Uwp.SLabDataManager.Models.Chart;
using INAF.Apps.Uwp.SLabDataManager.Models.Chart.Processing;
using INAF.Apps.Uwp.SLabDataManager.ViewModels.UserControlViewModels;
using INAF.Libraries.NetStandard.SLabCommonModels.Models.Spectrum;
using INAF.Libraries.NetStandard.SLabCommonModels.Models.Spectrum.ProcessedSpectraInfo;
using INAF.Libraries.NetStandard.SLabCommonModels.Models.WebApp.Responses;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
@@ -81,11 +83,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
                /* add processing step to the list */
                addProcessingStep(SpectrumType.Aligned);

                /* save info about files used for alignment */
                ((ChartSpectrumOfTypeAlignedModel)result.Spectrum).ParentFiles.ParentFile = WorkingItems.SpectraContainer.tryGetSpectrumOfType(SpectrumType.Raw).ToSpectrumFileBaseInfo();
                ((ChartSpectrumOfTypeAlignedModel)result.Spectrum).ParentFiles.RefFile = WorkingItems.SpectraContainer.tryGetSpectrumOfType(SpectrumType.Ref).ToSpectrumFileBaseInfo();
                ((ChartSpectrumOfTypeAlignedModel)result.Spectrum).ParentFiles.RefWhiteFile = WorkingItems.SpectraContainer.tryGetSpectrumOfType(SpectrumType.RefWhite).ToSpectrumFileBaseInfo();

                /* enable toggleSwitch for adding points for continuum fit by tapping on spectrum */
                initSegmentsFitViewModel();

@@ -104,11 +101,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
                showDialogMessage(result.DialogMessage, result.DialogMessageType);
        }

        private void prepareProcessedSpectrumForSaving<T>(SpectrumType spectrumType) where T : IChartSpectrumOfTypeProcessedModel
        {
            ((T)WorkingItems.SpectraContainer.tryGetSpectrumOfType(spectrumType)).prepareForSaving();
        }

        private async Task saveSpectrumOfTypeAlignedCloudAndLocalAsync(StorageItemType fileExt)
        {
            prepareProcessedSpectrumForSaving<ChartSpectrumOfTypeAlignedModel>(SpectrumType.Aligned);
@@ -165,7 +157,14 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
        {
            raiseHideAlignmentFlyoutRequired();

            prepareProcessedSpectrumForSaving<ChartSpectrumOfTypeAlignedModel>(SpectrumType.Aligned);
            /* save info about files used for alignment */
            ParentFilesModel parentFiles = new ParentFilesModel()
            {
                ParentFile = WorkingItems.SpectraContainer.tryGetSpectrumOfType(SpectrumType.Raw).ToSpectrumFileBaseInfo(),
                RefFile = WorkingItems.SpectraContainer.tryGetSpectrumOfType(SpectrumType.Ref).ToSpectrumFileBaseInfo(),
                RefWhiteFile = WorkingItems.SpectraContainer.tryGetSpectrumOfType(SpectrumType.RefWhite).ToSpectrumFileBaseInfo()
            };
            ((ISpectrumOfTypeProcessedModel)WorkingItems.SpectraContainer.tryGetSpectrumOfType(SpectrumType.Aligned)).ParentFiles = parentFiles;

            await saveSpectrumOfTypeLocalAsync(SpectrumType.Aligned, fileExt, closeIsLoading);
        }
+2 −2
Original line number Diff line number Diff line
@@ -329,8 +329,9 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
            if (creationCollisionOption == CreationCollisionOption.GenerateUniqueName && !SegmentsFitViewModel.IsSaveAsCopyAllowed)
                return;

            /* save spectrum locally */
            prepareProcessedSpectrumForSaving<ChartSpectrumOfTypeContinuumRemovedModel>(SpectrumType.ContinuumRemoved);

            /* save spectrum locally */
            await saveSpectrumOfTypeContinuumRemovedLocalAsync(fileExt, closeIsLoading: false, creationCollisionOption);

            SegmentsFitViewModel.tryRaiseIsSaveAsCopyAllowed();
@@ -410,7 +411,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
            ((ISpectrumOfTypeProcessedModel)WorkingItems.SpectraContainer.tryGetSpectrumOfType(SpectrumType.ContinuumRemoved)).ParentFiles = parentFiles;

            /* save spectrum locally */
            prepareProcessedSpectrumForSaving<ChartSpectrumOfTypeContinuumRemovedModel>(SpectrumType.ContinuumRemoved);
            await saveSpectrumOfTypeLocalAsync(SpectrumType.ContinuumRemoved, fileExt, closeIsLoading, creationCollisionOption);

            SegmentsFitViewModel.tryRaiseIsSaveAsCopyAllowed();
Loading