Loading INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/ContinuumRemovalHelper.cs +17 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,9 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart this.spectrumProcessingHelper = spectrumProcessingHelper; this.continuumMissingPointsHelper = continuumMissingPointsHelper; this.segmentsFitModelHelper = segmentsFitModelHelper; IsAddingPointsForContinuumRemovalAllowed = false; IsContinuumRemovalEnabled = false; } #region properties Loading @@ -37,6 +40,13 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart public SpectrumModel CloneForContinuumRemoval { get; private set; } private bool isAddingPointsForContinuumRemovalAllowed; public bool IsAddingPointsForContinuumRemovalAllowed { get { return isAddingPointsForContinuumRemovalAllowed; } set { SetProperty(ref isAddingPointsForContinuumRemovalAllowed, value); } } private bool isContinuumRemovalCompleted; public bool IsContinuumRemovalCompleted { Loading @@ -44,6 +54,13 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart set { SetProperty(ref isContinuumRemovalCompleted, value); } } private bool isContinuumRemovalEnabled; public bool IsContinuumRemovalEnabled { get { return isContinuumRemovalEnabled; } set { SetProperty(ref isContinuumRemovalEnabled, value); } } private PointModel missingPoint; public PointModel MissingPoint { Loading INAF.Apps.Uwp.SLabDataManager/Strings/en-us/Resources.resw +3 −3 Original line number Diff line number Diff line Loading @@ -619,7 +619,7 @@ <value>Navigate to right</value> </data> <data name="ZoomNavigationLabel.Text" xml:space="preserve"> <value>Use buttons to navigate chart by moving the zoom region</value> <value>Chart navigation</value> </data> <data name="ZoomShiftLabelX.Text" xml:space="preserve"> <value>Change the left/right shift of the zoomed region</value> Loading @@ -643,10 +643,10 @@ <value>Change the up/down shift of the zoomed region</value> </data> <data name="ZoomTeachingTipMessage1.Text" xml:space="preserve"> <value>Tap on small chart below to quickly move the zoomed region on your area of interest</value> <value>Tap on chart miniature below to quickly move the zoomed region on your area of interest</value> </data> <data name="ZoomTeachingTipMessage2.Text" xml:space="preserve"> <value>Use buttons located under the small chart to move the zoomed region along x or y axis</value> <value>Use buttons located under the chart miniature for precision movements along x or y axis</value> </data> <data name="ZoomTeachingTipMessage3.Text" xml:space="preserve"> <value>Use numeric controls at the bottom to set the amount of shift of the zoomed region along x and y axes</value> Loading INAF.Apps.Uwp.SLabDataManager/ViewModels/ChartViewModel.cs +8 −24 Original line number Diff line number Diff line Loading @@ -101,6 +101,10 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels { switch (e.PropertyName) { case nameof(ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed): if (ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed) raiseHideCalculationsFlyoutRequired(); break; case nameof(ContinuumRemovalHelper.IsContinuumRemovalCompleted): if (ContinuumRemovalHelper.IsContinuumRemovalCompleted) showContinuumRemovedResultAsync(); Loading Loading @@ -174,17 +178,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels set { SetProperty(ref deleteMessage, value); } } private bool isAddingPointsForContinuumRemovalAllowed; public bool IsAddingPointsForContinuumRemovalAllowed { get { return isAddingPointsForContinuumRemovalAllowed; } set { SetProperty(ref isAddingPointsForContinuumRemovalAllowed, value); raiseHideCalculationsFlyoutRequired(); } } private bool isAnyUserControlCloseRequired; public bool IsAnyUserControlCloseRequired { Loading @@ -206,13 +199,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels set { SetProperty(ref isChartLayoutUpdateRequired, value); } } private bool isContinuumRemovalEnabled; public bool IsContinuumRemovalEnabled { get { return isContinuumRemovalEnabled; } set { SetProperty(ref isContinuumRemovalEnabled, value); } } private bool isDeleteQuestionVisible; public bool IsDeleteQuestionVisible { Loading Loading @@ -410,6 +396,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels private async void initAsync() { IsReady = false; IsLoading = true; base.init(); Loading Loading @@ -440,9 +427,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels if (!tryReadIsSegmentsFitPanelAutoOpenEnabled()) IsSegmentsFitsUserControlAutoOpenEnabled = true; IsContinuumRemovalEnabled = false; IsReady = false; IsOperationDialogRequired = false; DialogMessage = string.Empty; IsSaveFileSuccess = false; Loading Loading @@ -546,7 +530,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels AreButtonsForAlignedSpectrumEnabled = false; /* set toggleSwitch for adding points for fitting continuum to 'off' */ IsAddingPointsForContinuumRemovalAllowed = false; ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed = false; } private async Task executeSpectrumAlignmentAsync() Loading Loading @@ -993,9 +977,9 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels public void trySetIsContinuumRemovalEnabled() { if (WorkingItems.SpectraContainer.isAnySpectrumOfType(SpectrumType.Raw) && isContinuumSpectrumCompleted()) IsContinuumRemovalEnabled = true; ContinuumRemovalHelper.IsContinuumRemovalEnabled = true; else IsContinuumRemovalEnabled = false; ContinuumRemovalHelper.IsContinuumRemovalEnabled = false; } //private async Task tryOpenContinuumFitPageAsync() Loading INAF.Apps.Uwp.SLabDataManager/Views/ChartPage.xaml +3 −3 Original line number Diff line number Diff line Loading @@ -144,7 +144,7 @@ </Grid.ColumnDefinitions> <!-- BUTTON REMOVE CONTINUUM --> <ToggleSwitch x:Uid="ToggleSwitchRemoveContinuum" IsOn="{x:Bind ViewModel.IsAddingPointsForContinuumRemovalAllowed, Mode=TwoWay}" IsOn="{x:Bind ViewModel.ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed, Mode=TwoWay}" Margin="8" Grid.Row="1" Grid.Column="0" Loading @@ -157,7 +157,7 @@ Height="36" Margin="8" Background="{ThemeResource SystemAccentColor}" IsEnabled="{x:Bind ViewModel.IsContinuumRemovalEnabled, Mode=OneWay}" IsEnabled="{x:Bind ViewModel.ContinuumRemovalHelper.IsContinuumRemovalEnabled, Mode=OneWay}" Grid.Row="2" Grid.Column="0"> <ToolTipService.ToolTip> Loading Loading @@ -557,7 +557,7 @@ Grid.Row="1" Grid.Column="1" /> <!-- TOGGLE-SWITCH ENABLE CONTINUUM FIT --> <ToggleSwitch IsOn="{x:Bind ViewModel.IsAddingPointsForContinuumRemovalAllowed, Mode=TwoWay}" <ToggleSwitch IsOn="{x:Bind ViewModel.ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed, Mode=TwoWay}" OffContent="" OnContent="" IsEnabled="{x:Bind ViewModel.AreButtonsForAlignedSpectrumEnabled, Mode=OneWay}" Loading INAF.Apps.Uwp.SLabDataManager/Views/ChartPage.xaml.cs +12 −9 Original line number Diff line number Diff line Loading @@ -84,6 +84,10 @@ namespace INAF.Apps.Uwp.SLabDataManager.Views { switch (e.PropertyName) { case nameof(ViewModel.ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed): if (!ViewModel.ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed) removePointsForContinuum(); break; case (nameof(ViewModel.ContinuumRemovalHelper.MissingPoint)): if (ViewModel.ContinuumRemovalHelper.MissingPoint != null) await insertPointOnSpectrumAsync(); Loading Loading @@ -123,10 +127,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.Views { switch (e.PropertyName) { case nameof(ViewModel.IsAddingPointsForContinuumRemovalAllowed): if (!ViewModel.IsAddingPointsForContinuumRemovalAllowed) removePointsForContinuum(); break; case (nameof(ViewModel.IsAnyUserControlCloseRequired)): if (ViewModel.IsAnyUserControlCloseRequired) closeUserControl(ViewModel.UserControlsHelper.RequiredUserControlName); Loading Loading @@ -282,7 +282,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Views #region tapped points annotations private void spectrumChart_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) { if (!ViewModel.IsAddingPointsForContinuumRemovalAllowed) if (!ViewModel.ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed) return; var chart = (RadCartesianChart)sender; Loading Loading @@ -445,11 +445,14 @@ namespace INAF.Apps.Uwp.SLabDataManager.Views { ViewModel.UserControlsHelper.removeUserControl(userControl); }; storyboard.Begin(); /* when just a single usercontrol is still visible, then expand chart */ if (ViewModel.UserControlsHelper.UserControlsNum == 1) { Storyboard expandWidthAnimation = AnimationsHelper.GetExpandWidthStoryboard(spectrumChart, ContentArea.ActualWidth); storyboard.Begin(); expandWidthAnimation.Begin(); } /* remove resizing of spectrum when main grid size changes */ ContentArea.SizeChanged -= ContentArea_SizeChanged; Loading Loading
INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/ContinuumRemovalHelper.cs +17 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,9 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart this.spectrumProcessingHelper = spectrumProcessingHelper; this.continuumMissingPointsHelper = continuumMissingPointsHelper; this.segmentsFitModelHelper = segmentsFitModelHelper; IsAddingPointsForContinuumRemovalAllowed = false; IsContinuumRemovalEnabled = false; } #region properties Loading @@ -37,6 +40,13 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart public SpectrumModel CloneForContinuumRemoval { get; private set; } private bool isAddingPointsForContinuumRemovalAllowed; public bool IsAddingPointsForContinuumRemovalAllowed { get { return isAddingPointsForContinuumRemovalAllowed; } set { SetProperty(ref isAddingPointsForContinuumRemovalAllowed, value); } } private bool isContinuumRemovalCompleted; public bool IsContinuumRemovalCompleted { Loading @@ -44,6 +54,13 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart set { SetProperty(ref isContinuumRemovalCompleted, value); } } private bool isContinuumRemovalEnabled; public bool IsContinuumRemovalEnabled { get { return isContinuumRemovalEnabled; } set { SetProperty(ref isContinuumRemovalEnabled, value); } } private PointModel missingPoint; public PointModel MissingPoint { Loading
INAF.Apps.Uwp.SLabDataManager/Strings/en-us/Resources.resw +3 −3 Original line number Diff line number Diff line Loading @@ -619,7 +619,7 @@ <value>Navigate to right</value> </data> <data name="ZoomNavigationLabel.Text" xml:space="preserve"> <value>Use buttons to navigate chart by moving the zoom region</value> <value>Chart navigation</value> </data> <data name="ZoomShiftLabelX.Text" xml:space="preserve"> <value>Change the left/right shift of the zoomed region</value> Loading @@ -643,10 +643,10 @@ <value>Change the up/down shift of the zoomed region</value> </data> <data name="ZoomTeachingTipMessage1.Text" xml:space="preserve"> <value>Tap on small chart below to quickly move the zoomed region on your area of interest</value> <value>Tap on chart miniature below to quickly move the zoomed region on your area of interest</value> </data> <data name="ZoomTeachingTipMessage2.Text" xml:space="preserve"> <value>Use buttons located under the small chart to move the zoomed region along x or y axis</value> <value>Use buttons located under the chart miniature for precision movements along x or y axis</value> </data> <data name="ZoomTeachingTipMessage3.Text" xml:space="preserve"> <value>Use numeric controls at the bottom to set the amount of shift of the zoomed region along x and y axes</value> Loading
INAF.Apps.Uwp.SLabDataManager/ViewModels/ChartViewModel.cs +8 −24 Original line number Diff line number Diff line Loading @@ -101,6 +101,10 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels { switch (e.PropertyName) { case nameof(ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed): if (ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed) raiseHideCalculationsFlyoutRequired(); break; case nameof(ContinuumRemovalHelper.IsContinuumRemovalCompleted): if (ContinuumRemovalHelper.IsContinuumRemovalCompleted) showContinuumRemovedResultAsync(); Loading Loading @@ -174,17 +178,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels set { SetProperty(ref deleteMessage, value); } } private bool isAddingPointsForContinuumRemovalAllowed; public bool IsAddingPointsForContinuumRemovalAllowed { get { return isAddingPointsForContinuumRemovalAllowed; } set { SetProperty(ref isAddingPointsForContinuumRemovalAllowed, value); raiseHideCalculationsFlyoutRequired(); } } private bool isAnyUserControlCloseRequired; public bool IsAnyUserControlCloseRequired { Loading @@ -206,13 +199,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels set { SetProperty(ref isChartLayoutUpdateRequired, value); } } private bool isContinuumRemovalEnabled; public bool IsContinuumRemovalEnabled { get { return isContinuumRemovalEnabled; } set { SetProperty(ref isContinuumRemovalEnabled, value); } } private bool isDeleteQuestionVisible; public bool IsDeleteQuestionVisible { Loading Loading @@ -410,6 +396,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels private async void initAsync() { IsReady = false; IsLoading = true; base.init(); Loading Loading @@ -440,9 +427,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels if (!tryReadIsSegmentsFitPanelAutoOpenEnabled()) IsSegmentsFitsUserControlAutoOpenEnabled = true; IsContinuumRemovalEnabled = false; IsReady = false; IsOperationDialogRequired = false; DialogMessage = string.Empty; IsSaveFileSuccess = false; Loading Loading @@ -546,7 +530,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels AreButtonsForAlignedSpectrumEnabled = false; /* set toggleSwitch for adding points for fitting continuum to 'off' */ IsAddingPointsForContinuumRemovalAllowed = false; ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed = false; } private async Task executeSpectrumAlignmentAsync() Loading Loading @@ -993,9 +977,9 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels public void trySetIsContinuumRemovalEnabled() { if (WorkingItems.SpectraContainer.isAnySpectrumOfType(SpectrumType.Raw) && isContinuumSpectrumCompleted()) IsContinuumRemovalEnabled = true; ContinuumRemovalHelper.IsContinuumRemovalEnabled = true; else IsContinuumRemovalEnabled = false; ContinuumRemovalHelper.IsContinuumRemovalEnabled = false; } //private async Task tryOpenContinuumFitPageAsync() Loading
INAF.Apps.Uwp.SLabDataManager/Views/ChartPage.xaml +3 −3 Original line number Diff line number Diff line Loading @@ -144,7 +144,7 @@ </Grid.ColumnDefinitions> <!-- BUTTON REMOVE CONTINUUM --> <ToggleSwitch x:Uid="ToggleSwitchRemoveContinuum" IsOn="{x:Bind ViewModel.IsAddingPointsForContinuumRemovalAllowed, Mode=TwoWay}" IsOn="{x:Bind ViewModel.ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed, Mode=TwoWay}" Margin="8" Grid.Row="1" Grid.Column="0" Loading @@ -157,7 +157,7 @@ Height="36" Margin="8" Background="{ThemeResource SystemAccentColor}" IsEnabled="{x:Bind ViewModel.IsContinuumRemovalEnabled, Mode=OneWay}" IsEnabled="{x:Bind ViewModel.ContinuumRemovalHelper.IsContinuumRemovalEnabled, Mode=OneWay}" Grid.Row="2" Grid.Column="0"> <ToolTipService.ToolTip> Loading Loading @@ -557,7 +557,7 @@ Grid.Row="1" Grid.Column="1" /> <!-- TOGGLE-SWITCH ENABLE CONTINUUM FIT --> <ToggleSwitch IsOn="{x:Bind ViewModel.IsAddingPointsForContinuumRemovalAllowed, Mode=TwoWay}" <ToggleSwitch IsOn="{x:Bind ViewModel.ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed, Mode=TwoWay}" OffContent="" OnContent="" IsEnabled="{x:Bind ViewModel.AreButtonsForAlignedSpectrumEnabled, Mode=OneWay}" Loading
INAF.Apps.Uwp.SLabDataManager/Views/ChartPage.xaml.cs +12 −9 Original line number Diff line number Diff line Loading @@ -84,6 +84,10 @@ namespace INAF.Apps.Uwp.SLabDataManager.Views { switch (e.PropertyName) { case nameof(ViewModel.ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed): if (!ViewModel.ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed) removePointsForContinuum(); break; case (nameof(ViewModel.ContinuumRemovalHelper.MissingPoint)): if (ViewModel.ContinuumRemovalHelper.MissingPoint != null) await insertPointOnSpectrumAsync(); Loading Loading @@ -123,10 +127,6 @@ namespace INAF.Apps.Uwp.SLabDataManager.Views { switch (e.PropertyName) { case nameof(ViewModel.IsAddingPointsForContinuumRemovalAllowed): if (!ViewModel.IsAddingPointsForContinuumRemovalAllowed) removePointsForContinuum(); break; case (nameof(ViewModel.IsAnyUserControlCloseRequired)): if (ViewModel.IsAnyUserControlCloseRequired) closeUserControl(ViewModel.UserControlsHelper.RequiredUserControlName); Loading Loading @@ -282,7 +282,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Views #region tapped points annotations private void spectrumChart_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) { if (!ViewModel.IsAddingPointsForContinuumRemovalAllowed) if (!ViewModel.ContinuumRemovalHelper.IsAddingPointsForContinuumRemovalAllowed) return; var chart = (RadCartesianChart)sender; Loading Loading @@ -445,11 +445,14 @@ namespace INAF.Apps.Uwp.SLabDataManager.Views { ViewModel.UserControlsHelper.removeUserControl(userControl); }; storyboard.Begin(); /* when just a single usercontrol is still visible, then expand chart */ if (ViewModel.UserControlsHelper.UserControlsNum == 1) { Storyboard expandWidthAnimation = AnimationsHelper.GetExpandWidthStoryboard(spectrumChart, ContentArea.ActualWidth); storyboard.Begin(); expandWidthAnimation.Begin(); } /* remove resizing of spectrum when main grid size changes */ ContentArea.SizeChanged -= ContentArea_SizeChanged; Loading