Commit 443240a8 authored by Francesco Carraro's avatar Francesco Carraro
Browse files

fixed several bug and some improvements in right-panels

parent 5f09ee2f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -551,7 +551,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
            if (ActionQuestionViewModel != null)
            {
                ActionQuestionViewModel.IsControlVisible = false;
                //ActionQuestionViewModel.Dispose();
            }
        }
        #endregion
@@ -617,7 +616,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels

        #region generic for DeleteDialog
        private RelayCommand commandCancelAction;
        public RelayCommand CommandCancelAction => commandCancelAction ?? (commandCancelAction = new RelayCommand(() => ActionQuestionViewModel.IsControlVisible = false));
        public RelayCommand CommandCancelAction => commandCancelAction ?? (commandCancelAction = new RelayCommand(() => tryRemoveActionUserControl()));

        public RelayCommand CommandGenericAction { get; private set; }
        #endregion
+20 −8
Original line number Diff line number Diff line
@@ -103,8 +103,15 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
            {
                /* if dest spectrumType is already present, then ask whether ovewrite it... */
                SelectedActionCommand = CommandOverwriteExistingSmoothedSpectrumBySegments;

                /* bind the right command to the user-control */
                raiseIsActionCommandBindingRequired();

                /* init actionusercontrol viewmodel  */
                initActionQuestionViewModel(question: "SmoothingAskOverwriteExistingDestSpectrumType".GetText(),
                                            optionalQuestion: "OptionalActionDeleteOnCloudQuestion".GetText(),
                                            isOptionalActionChecked: false,
                                            isOptionalActionVisible: false);
            }
            else
                /* ...otherwise apply smoothing */
@@ -144,14 +151,16 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels

        private async Task overwriteExistingSmoothedSpectrumBySegmentsAsync()
        {
            if (WorkingItems.SpectraContainer.isAnySpectrumOfType(SpectrumType.AlignedSmoothedBySegments))
                await WorkingItems.SpectraContainer.tryRemoveSpectrumOfTypeAsync(SpectrumType.AlignedSmoothedBySegments);
            /* hide action-question user control */
            tryRemoveActionUserControl();

            SpectrumType smoothedSpectrumType = getSrcSpectrumTypeForSmoothingToSpectrum();

            /* retrieve spectrumType for smoothed spectrum */
            SpectrumType destSpectrumType = SmoothingViewModel.getDestSpectrumType(SmoothingViewModel.SelectedSpectrumType);
            SpectrumType destSpectrumType = SmoothingViewModel.getDestSpectrumType(smoothedSpectrumType);

            /* hide dialog question */
            //IsActionQuestionVisible = false;
            if (WorkingItems.SpectraContainer.isAnySpectrumOfType(SpectrumType.AlignedSmoothedBySegments))
                await WorkingItems.SpectraContainer.tryRemoveSpectrumOfTypeAsync(SpectrumType.AlignedSmoothedBySegments);

            /* apply smoothing */
            await applySmoothingBySegmentsPart2Async(destSpectrumType);
@@ -236,17 +245,20 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels

        private async Task overwriteExistingSmoothedSpectrumAsync()
        {
            SpectrumType smoothedBySegmentsSpectrumType = getSrcSpectrumTypeForSmoothingToSpectrum();
            /* hide action-question user control */
            tryRemoveActionUserControl();

            SpectrumType smoothedSpectrumType = getSrcSpectrumTypeForSmoothingToSpectrum();

            /* retrieve spectrumType for smoothed spectrum */
            SpectrumType destSpectrumType = SmoothingViewModel.getDestSpectrumType(smoothedBySegmentsSpectrumType);
            SpectrumType destSpectrumType = SmoothingViewModel.getDestSpectrumType(smoothedSpectrumType);

            /* remove spectrum to be overwritten */
            if (WorkingItems.SpectraContainer.isAnySpectrumOfType(destSpectrumType))
                await WorkingItems.SpectraContainer.tryRemoveSpectrumOfTypeAsync(destSpectrumType);

            /* apply smoothing */
            await applySmoothingToSpectrumPart2Async(smoothedBySegmentsSpectrumType, destSpectrumType);
            await applySmoothingToSpectrumPart2Async(smoothedSpectrumType, destSpectrumType);
        }
        #endregion