Commit 244aca04 authored by Francesco Carraro's avatar Francesco Carraro
Browse files

fixes in ShellPage

parent 1c0927e9
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts
            Spectra = new ObservableCollection<SpectrumModel>();
            Summaries = new ObservableCollection<SpectrumSummaryModel>();

            IsAnySpectrumLoaded = false;

            IsSpectrumAligned = false;

            XAxisMajorStepValues = new List<double>(2);
@@ -54,6 +56,13 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts
            set { SetProperty(ref isAnySummaryUpdated, value); }
        }

        private bool isAnySpectrumLoaded;
        public bool IsAnySpectrumLoaded
        {
            get { return isAnySpectrumLoaded; }
            set { SetProperty(ref isAnySpectrumLoaded, value); }
        }

        public bool IsSpectrumAligned { get; set; }

        public SelectedRefBand SelectedRefBand { get; private set; }
+1 −0
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
            /* add listener for being warned of work in progress in WorkingItems */
            WorkingItems.PropertyChanged += WorkingItems_PropertyChanged;

            /* if user pinned flyout during the last app session, then pin the flyout */
            if (WorkingItems.AlignmentConfig.isPinnedPending)
            {
                WorkingItems.AlignmentConfig.IsPinRequested = true;
+3 −0
Original line number Diff line number Diff line
@@ -211,6 +211,9 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
                default:
                    break;
            }

            /* enable navigation to chart page */
            WorkingItems.SpectraContainer.IsAnySpectrumLoaded = true;
        }

        private new async Task selectFileAsync(SpectrumType spectrumType, List<FileExt> fileExts)
+17 −2
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Input;

using INAF.Apps.Uwp.SLabDataManager.Charts;
using INAF.Apps.Uwp.SLabDataManager.Helpers;
using INAF.Apps.Uwp.SLabDataManager.Services;
using INAF.Apps.Uwp.SLabDataManager.Views;
@@ -25,19 +25,34 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels
        private readonly KeyboardAccelerator _altLeftKeyboardAccelerator = BuildKeyboardAccelerator(VirtualKey.Left, VirtualKeyModifiers.Menu);
        private readonly KeyboardAccelerator _backKeyboardAccelerator = BuildKeyboardAccelerator(VirtualKey.GoBack);

        private bool _isBackEnabled;
        private bool _isBackEnabled, _isNavigationToChartEnabled;
        private IList<KeyboardAccelerator> _keyboardAccelerators;
        private WinUI.NavigationView _navigationView;
        private WinUI.NavigationViewItem _selected;
        private ICommand _loadedCommand;
        private ICommand _itemInvokedCommand;

        public ShellViewModel(SpectraContainer spectraContainer)
        {
            spectraContainer.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName.Equals(nameof(SpectraContainer.IsAnySpectrumLoaded)) && spectraContainer.IsAnySpectrumLoaded)
                    IsNavigationToChartEnabled = true;
            };
        }

        public bool IsBackEnabled
        {
            get { return _isBackEnabled; }
            set { SetProperty(ref _isBackEnabled, value); }
        }

        public bool IsNavigationToChartEnabled
        {
            get { return _isNavigationToChartEnabled; }
            set { SetProperty(ref _isNavigationToChartEnabled, value); }
        }

        public WinUI.NavigationViewItem Selected
        {
            get { return _selected; }
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@
    <winui:NavigationView
        x:Name="navigationView"
        IsBackButtonVisible="Visible"
        IsBackEnabled="{x:Bind ViewModel.IsBackEnabled, Mode=OneWay}"
        SelectedItem="{x:Bind ViewModel.Selected, Mode=OneWay}"
        IsSettingsVisible="True"
        PaneDisplayMode="LeftCompact"
        Background="{ThemeResource SystemControlBackgroundAltHighBrush}">
@@ -38,6 +40,7 @@
                </winui:NavigationViewItem.Icon>
            </winui:NavigationViewItem>
            <winui:NavigationViewItem x:Uid="Shell_Chart"
                                      IsEnabled="{x:Bind ViewModel.IsNavigationToChartEnabled, Mode=OneWay}"
                                      helpers:NavHelper.NavigateTo="views:ChartPage" >
                <winui:NavigationViewItem.Icon>
                    <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE9D2;"/>