Commit 82271bdc authored by Francesco Carraro's avatar Francesco Carraro
Browse files

fixes on localsettings; update mvvm toolkit

parent 6e2b778b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
using INAF.Apps.Uwp.Charts;
using CommunityToolkit.Mvvm.DependencyInjection;
using INAF.Apps.Uwp.Charts;
using INAF.Apps.Uwp.SLabDataManager.Charts;
using INAF.Apps.Uwp.SLabDataManager.Charts.Containers;
using INAF.Apps.Uwp.SLabDataManager.Helpers;
@@ -24,7 +25,6 @@ using Microsoft.AppCenter;
using Microsoft.AppCenter.Analytics;
using Microsoft.AppCenter.Crashes;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Toolkit.Mvvm.DependencyInjection;
using System;
using System.Collections.Generic;
using Windows.ApplicationModel.Activation;
@@ -138,6 +138,7 @@ namespace INAF.Apps.Uwp.SLabDataManager
                .AddSingleton<SpectrumChartOptionsModel>()
                .AddSingleton<StorageItemsSettingsHelper>()
                .AddSingleton<StorageItemsAccessHelper>()
                .AddSingleton<ToolBarFlyoutsHelper>()
                .AddSingleton<UpdateUIHelper>()
                .AddSingleton<WorkingFoldersContainer>()
                .AddSingleton<WorkingItemsModel>()
+2 −2
Original line number Diff line number Diff line
using INAF.Apps.Uwp.Charts;
using CommunityToolkit.Mvvm.ComponentModel;
using INAF.Apps.Uwp.Charts;
using INAF.Apps.Uwp.SLabDataManager.Helpers;
using INAF.Apps.Uwp.SLabDataManager.Models;
using INAF.Libraries.NetStandard.ScienceModels.Extensions;
using INAF.Libraries.NetStandard.ScienceModels.Spectra;
using INAF.Libraries.Uwp.Logging;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+9 −39
Original line number Diff line number Diff line
@@ -24,14 +24,11 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts

            WavelengthSeparators = new ObservableCollection<WavelengthModel>();

            if (!tryReadAreSeparatorsVisible())
                AreSeparatorsVisible = true;
            tryReadAreSeparatorsVisible();

            if (!tryReadNumOfPointsForAlignment())
                NumOfPointsForAlignment = 3;
            tryReadNumOfPointsForAlignment(3);

            if (!tryReadIsPinned())
                IsPinned = false;
            tryReadIsPinned();

            tryReadWavelengthModels();

@@ -119,46 +116,19 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts
            settingsHelper.save<WavelengthSerializableModel>($"index{index}", new WavelengthSerializableModel(index, value, semiRange, step, (int)wavelengthMeasureUnit));
        }

        public bool tryReadAreSeparatorsVisible()
        public void tryReadAreSeparatorsVisible()
        {
            bool isFound = false;

            string value = settingsHelper.get(Constants.Constants.ARE_SEPARATORS_VISIBLE);
            if (!string.IsNullOrEmpty(value))
            {
                areSeparatorsVisible = value.ToBool();
                isFound = true;
            AreSeparatorsVisible = settingsHelper.getValue<bool>(Constants.Constants.ARE_SEPARATORS_VISIBLE);
        }

            return isFound;
        }

        public bool tryReadIsPinned()
        public void tryReadIsPinned()
        {
            bool isFound = false;

            string value = settingsHelper.get(Constants.Constants.IS_ALIGNMENT_FLYOUT_PINNED);
            if (!string.IsNullOrEmpty(value))
            {
                IsPinnedPending = value.ToBool();
                isFound = true;
            IsPinnedPending = settingsHelper.getValue<bool>(Constants.Constants.IS_ALIGNMENT_FLYOUT_PINNED);
        }

            return isFound;
        }

        public bool tryReadNumOfPointsForAlignment()
        {
            bool isFound = false;

            string value = settingsHelper.get(Constants.Constants.NUM_OF_POINTS_FOR_ALIGNMENT);
            if (!string.IsNullOrEmpty(value))
        public void tryReadNumOfPointsForAlignment(int defaultValue)
        {
                numOfPointsForAlignment = value.ToIntInvariant();
                isFound = true;
            }

            return isFound;
            NumOfPointsForAlignment = settingsHelper.getValueWithDefault<int>(Constants.Constants.NUM_OF_POINTS_FOR_ALIGNMENT, defaultValue);
        }

        private bool tryReadWavelengthModel(int index)
+2 −2
Original line number Diff line number Diff line
using INAF.Apps.Uwp.Charts;
using CommunityToolkit.Mvvm.DependencyInjection;
using INAF.Apps.Uwp.Charts;
using INAF.Apps.Uwp.SLabDataManager.Charts.Containers;
using INAF.Apps.Uwp.SLabDataManager.Helpers;
using INAF.Apps.Uwp.SLabDataManager.Helpers.UI;
@@ -6,7 +7,6 @@ using INAF.Apps.Uwp.SLabDataManager.Models;
using INAF.Apps.Uwp.SLabDataManager.ViewModels;
using INAF.Libraries.NetStandard.Extensions;
using INAF.Libraries.NetStandard.ScienceModels.Extensions;
using Microsoft.Toolkit.Mvvm.DependencyInjection;
using System;
using System.Collections.Generic;
using System.IO;
+2 −2
Original line number Diff line number Diff line
using INAF.Apps.Uwp.SLabDataManager.Charts.Containers;
using CommunityToolkit.Mvvm.DependencyInjection;
using INAF.Apps.Uwp.SLabDataManager.Charts.Containers;
using INAF.Apps.Uwp.SLabDataManager.Models;
using INAF.Libraries.NetStandard.ScienceModels.Extensions;
using Microsoft.Toolkit.Mvvm.DependencyInjection;
using System;
using Windows.UI.Xaml.Data;
using static INAF.Libraries.NetStandard.SLabCommonModels.Enums.Enums;
Loading