Loading INAF.Apps.Uwp.SLabDataManager/Models/RecentFilesContainer.cs +3 −2 Original line number Diff line number Diff line using CommunityToolkit.Mvvm.ComponentModel; using INAF.Libraries.Uwp.Settings.RecentFiles; using System.Collections.Generic; using System.Linq; namespace INAF.Apps.Uwp.SLabDataManager.Models { Loading @@ -25,9 +26,9 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models private set { SetProperty(ref recentFiles, value); } } public void addItems(List<RecentFileModel> recentFiles) public void addItems(IEnumerable<RecentFileModel> recentFiles) { RecentFiles = recentFiles; RecentFiles = recentFiles.ToList(); AreAvailable = true; } Loading INAF.Apps.Uwp.SLabDataManager/ViewModels/ChartViewModelSmoothing.cs +24 −5 Original line number Diff line number Diff line Loading @@ -268,14 +268,30 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels return segments; } private async Task saveSmoothedSpectrumProcedureAsync() private async Task saveSmoothedSpectrumAsync() { /* retrieve spectrumType for smoothed spectrum */ SpectrumType destSpectrumType = getDestSpectrumType(SmoothingViewModel.SelectedSpectrumType); SpectrumType destSpectrumType = SpectrumType.AlignedSmoothed; if (!WorkingItems.SpectraContainer.isAnySpectrumOfType(destSpectrumType)) return; await saveSmoothedSpectrumProcedureAsync(destSpectrumType); } private async Task saveSmoothedSpectrumBySegmentsAsync() { /* retrieve spectrumType for smoothed spectrum */ SpectrumType destSpectrumType = SpectrumType.AlignedSmoothedBySegments; if (!WorkingItems.SpectraContainer.isAnySpectrumOfType(destSpectrumType)) return; await saveSmoothedSpectrumProcedureAsync(destSpectrumType); } private async Task saveSmoothedSpectrumProcedureAsync(SpectrumType destSpectrumType) { IsLoading = true; /* create spectrum model for being saved on cloud */ Loading @@ -300,7 +316,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels } /* save isSavedOnCloud and id of spectrum */ var spectrum = WorkingItems.SpectraContainer.tryGetSpectrumOfType(destSpectrumType); var spectrum = WorkingItems.SpectraContainer.tryGetSpectrumOfType(spectrumFile.Type); spectrum.setIsSavedOnCloud(responseobj.IsOk); spectrum.setId(responseobj.Id); Loading Loading @@ -338,8 +354,11 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels private RelayCommand commandOverwriteExistingSmoothedSpectrum; public RelayCommand CommandOverwriteExistingSmoothedSpectrum => commandOverwriteExistingSmoothedSpectrum ?? (commandOverwriteExistingSmoothedSpectrum = new RelayCommand(() => overwriteExistingSmoothedSpectrumAsync())); private RelayCommand commandSaveSmoothedSpectrumProcedure; public RelayCommand CommandSaveSmoothedSpectrumProcedure => commandSaveSmoothedSpectrumProcedure ?? (commandSaveSmoothedSpectrumProcedure = new RelayCommand(() => saveSmoothedSpectrumProcedureAsync())); private RelayCommand commandSaveSmoothedSpectrumBySegments; public RelayCommand CommandSaveSmoothedSpectrumBySegments => commandSaveSmoothedSpectrumBySegments ?? (commandSaveSmoothedSpectrumBySegments = new RelayCommand(() => saveSmoothedSpectrumBySegmentsAsync())); private RelayCommand commandSaveSmoothedSpectrum; public RelayCommand CommandSaveSmoothedSpectrum => commandSaveSmoothedSpectrum ?? (commandSaveSmoothedSpectrum = new RelayCommand(() => saveSmoothedSpectrumAsync())); #endregion } } INAF.Apps.Uwp.SLabDataManager/ViewModels/MainViewModel.cs +76 −40 Original line number Diff line number Diff line Loading @@ -117,12 +117,12 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels await readRemoteOperationsAsync(); /* fill list of recent files */ await tryReadRecentFilesAsync(); await tryReadRecentFilesProcedureAsync().ConfigureAwait(true); /* automatically read ref white, if available in the recent list */ await tryAutoReadRefWhiteFileAsync(); await tryAutoReadRefWhiteFileAsync().ConfigureAwait(true); if (!await checkIsWebAppAliveAsync()) if (!await checkIsWebAppAliveAsync().ConfigureAwait(false)) { IsLoading = false; showDialogMessage("RemoteOperationsNotAvailableErrorMessage".GetText(), DialogMessageType.Warning); Loading @@ -134,47 +134,83 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels #region recent files private async Task addToRecentFilesAsync(string filepath, string token, SpectrumType spectrumType) { await Task.Run(async () => { recentFilesHelper.add(new RecentFileModel(filepath, token, spectrumType.ToString())); if (recentFilesHelper.write()) await tryReadRecentFilesAsync(); }); //await Task.Run(() => recentFilesHelper.save(new RecentFileModel(filepath, token, spectrumType.ToString()), spectrumType.ToString())) // .ContinueWith(async x => await tryReadRecentFilesProcedureAsync()); await Task.Run(() => recentFilesHelper.save(new RecentFileModel(filepath, token, spectrumType.ToString()), spectrumType.ToString())); await tryReadRecentFilesProcedureAsync(); } private async Task tryReadRecentFilesAsync() { await Task.Run(() => //private async Task tryReadRecentFilesAsync() //{ // await Task.Run(() => // { // recentFilesHelper.read(); // if (recentFilesHelper.RecentFiles != null) // { // var recentFilesRaw = recentFilesHelper.tryGetRecentFilesOfType(SpectrumType.Raw); // UpdateUIHelper.UpdateUIAsync(() => // { // RecentFilesRawContainer = new RecentFilesContainer(); // if (recentFilesRaw?.Count() > 0) // RecentFilesRawContainer.addItems(recentFilesRaw.ToList()); // }); // var recentFilesRef = recentFilesHelper.tryGetRecentFilesOfType(SpectrumType.Ref); // UpdateUIHelper.UpdateUIAsync(() => // { // RecentFilesRefContainer = new RecentFilesContainer(); // if (recentFilesRef?.Count() > 0) // RecentFilesRefContainer.addItems(recentFilesRef.ToList()); // }); // var recentFilesRefWhite = recentFilesHelper.tryGetRecentFilesOfType(SpectrumType.RefWhite); // UpdateUIHelper.UpdateUIAsync(() => // { // RecentFilesRefWhiteContainer = new RecentFilesContainer(); // if (recentFilesRefWhite?.Count() > 0) // RecentFilesRefWhiteContainer.addItems(recentFilesRefWhite.ToList()); // }); // } // }); //} private async Task tryReadRecentFilesProcedureAsync() { recentFilesHelper.read(); RecentFilesRawContainer = new RecentFilesContainer(); RecentFilesRefContainer = new RecentFilesContainer(); RecentFilesRefWhiteContainer = new RecentFilesContainer(); if (recentFilesHelper.RecentFiles != null) { var recentFilesRaw = recentFilesHelper.tryGetRecentFilesOfType(SpectrumType.Raw); UpdateUIHelper.UpdateUIAsync(() => List<Task> tasks = new List<Task>(); /* read RAW files */ tasks.Add(Task.Run(() => { RecentFilesRawContainer = new RecentFilesContainer(); if (recentFilesRaw?.Count() > 0) RecentFilesRawContainer.addItems(recentFilesRaw.ToList()); }); var recentFiles = recentFilesHelper.read(SpectrumType.Raw.ToString()); if (recentFiles != null) UpdateUIHelper.UpdateUIAsync(() => RecentFilesRawContainer.addItems(recentFiles)).ConfigureAwait(true); })); var recentFilesRef = recentFilesHelper.tryGetRecentFilesOfType(SpectrumType.Ref); UpdateUIHelper.UpdateUIAsync(() => /* read REF files */ tasks.Add(Task.Run(() => { RecentFilesRefContainer = new RecentFilesContainer(); if (recentFilesRef?.Count() > 0) RecentFilesRefContainer.addItems(recentFilesRef.ToList()); }); var recentFiles = recentFilesHelper.read(SpectrumType.Ref.ToString()); if (recentFiles != null) UpdateUIHelper.UpdateUIAsync(() => RecentFilesRefContainer.addItems(recentFiles)).ConfigureAwait(true); })); var recentFilesRefWhite = recentFilesHelper.tryGetRecentFilesOfType(SpectrumType.RefWhite); UpdateUIHelper.UpdateUIAsync(() => /* read REF WHITE files */ tasks.Add(Task.Run(() => { RecentFilesRefWhiteContainer = new RecentFilesContainer(); if (recentFilesRefWhite?.Count() > 0) RecentFilesRefWhiteContainer.addItems(recentFilesRefWhite.ToList()); }); } }); var recentFiles = recentFilesHelper.read(SpectrumType.RefWhite.ToString()); if (recentFiles != null) UpdateUIHelper.UpdateUIAsync(() => RecentFilesRefWhiteContainer.addItems(recentFiles)).ConfigureAwait(true); })); await Task.WhenAll(tasks).ConfigureAwait(false); } private async Task tryAutoReadRefWhiteFileAsync() Loading INAF.Apps.Uwp.SLabDataManager/Views/ChartPage.xaml +2 −1 Original line number Diff line number Diff line Loading @@ -930,7 +930,8 @@ CommandDeleteSmoothingToSegments="{x:Bind ViewModel.CommandDeleteSmoothingBySegments}" CommandDeleteSmoothingToSpectrum="{x:Bind ViewModel.CommandDeleteSmoothingToSpectrum}" CommandCloseUserControl="{x:Bind ViewModel.CommandCloseUserControl}" CommandSaveSmoothedSpectrumProcedure="{x:Bind ViewModel.CommandSaveSmoothedSpectrumProcedure}"> CommandSaveSmoothedSpectrum="{x:Bind ViewModel.CommandSaveSmoothedSpectrum}" CommandSaveSmoothedSpectrumBySegments="{x:Bind ViewModel.CommandSaveSmoothedSpectrumBySegments}"> <usercontrols:SmoothingUserControl.RenderTransform> <TranslateTransform X="400" Y="0" /> </usercontrols:SmoothingUserControl.RenderTransform> Loading INAF.Apps.Uwp.SLabDataManager/Views/UserControls/SmoothingUserControl.xaml +51 −26 Original line number Diff line number Diff line Loading @@ -247,6 +247,7 @@ <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> Loading @@ -263,7 +264,7 @@ Margin="0,8" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"/> Grid.ColumnSpan="4"/> <!-- BUTTON APPLY SMOOTHING BY SEGMENTS --> <Button x:Name="buttonApplySmoothingBySegments" FontFamily="Segoe MDL2 Assets" Loading @@ -285,8 +286,30 @@ </Core:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> <!-- BUTTON SAVE SMOOTHING TO SEGMENTS --> <Button x:Name="buttonSaveSmoothedSpectrumBySegments" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingBySegmentsAllowed, Mode=OneWay}" FontFamily="Segoe MDL2 Assets" Content="" HorizontalAlignment="Left" Width="48" Height="48" Margin="8" Style="{ThemeResource CircleButton}" Background="{ThemeResource SystemAccentColor}" Grid.Row="2" Grid.Column="1"> <ToolTipService.ToolTip> <TextBlock x:Uid="SmoothingSaveSmoothedSpectrumLabel" /> </ToolTipService.ToolTip> <Interactivity:Interaction.Behaviors> <Core:EventTriggerBehavior EventName="Tapped"> <Core:InvokeCommandAction Command="{Binding ElementName=self, Path=CommandSaveSmoothedSpectrumBySegments}" /> </Core:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> <!-- BUTTON DELETE SMOOTHING BY SEGMENTS --> <Button x:Name="buttonDeleteSmoothingBySegments" <Button x:Name="buttonDeleteSmoothingSpectrum" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingBySegmentsAllowed, Mode=OneWay}" FontFamily="Segoe MDL2 Assets" Content="" Loading @@ -297,7 +320,7 @@ Style="{ThemeResource CircleButton}" Background="{ThemeResource SystemAccentColor}" Grid.Row="2" Grid.Column="1"> Grid.Column="2"> <ToolTipService.ToolTip> <TextBlock x:Uid="SmoothingDeleteSmoothingBySegmentsLabel" /> </ToolTipService.ToolTip> Loading @@ -319,6 +342,7 @@ <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> Loading @@ -337,7 +361,7 @@ Margin="0,8" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"/> Grid.ColumnSpan="4"/> <!-- BUTTON APPLY SMOOTHING TO WHOLE SPECTRUM --> <Button x:Name="buttonApplySmoothingToSpectrum" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingBySegmentsAllowed, Mode=OneWay}" Loading @@ -360,11 +384,11 @@ </Core:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> <!-- BUTTON DELETE SMOOTHING TO SEGMENTS --> <Button x:Name="buttonDeleteSmoothingToSpectrum" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingToSpectrumAllowed, Mode=OneWay}" <!-- BUTTON SAVE SMOOTHING TO SPECTRUM --> <Button x:Name="buttonSaveSmoothedSpectrum" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingBySegmentsAllowed, Mode=OneWay}" FontFamily="Segoe MDL2 Assets" Content="" Content="" HorizontalAlignment="Left" Width="48" Height="48" Loading @@ -372,40 +396,41 @@ Style="{ThemeResource CircleButton}" Background="{ThemeResource SystemAccentColor}" Grid.Row="2" Grid.Column="2"> Grid.Column="1"> <ToolTipService.ToolTip> <TextBlock x:Uid="SmoothingDeleteSmoothingToSpectrumLabel" /> <TextBlock x:Uid="SmoothingSaveSmoothedSpectrumLabel" /> </ToolTipService.ToolTip> <Interactivity:Interaction.Behaviors> <Core:EventTriggerBehavior EventName="Tapped"> <Core:InvokeCommandAction Command="{Binding ElementName=self, Path=CommandDeleteSmoothingToSpectrum}" /> <Core:InvokeCommandAction Command="{Binding ElementName=self, Path=CommandSaveSmoothedSpectrum}" /> </Core:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> </Grid> </PivotItem> </Pivot> <!-- ROW 4 - BUTTON SAVE SMOOTHING TO SEGMENTS --> <Button x:Name="buttonSaveSmoothedSpectrum" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingBySegmentsAllowed, Mode=OneWay}" <!-- BUTTON DELETE SMOOTHING TO SPECTRUM --> <Button x:Name="buttonDeleteSmoothingToSpectrum" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingToSpectrumAllowed, Mode=OneWay}" FontFamily="Segoe MDL2 Assets" Content="" Content="" HorizontalAlignment="Left" Width="48" Height="48" Margin="8,16,8,0" Margin="8" Style="{ThemeResource CircleButton}" Background="{ThemeResource SystemAccentColor}" Grid.Row="4"> Grid.Row="2" Grid.Column="2"> <ToolTipService.ToolTip> <TextBlock x:Uid="SmoothingSaveSmoothedSpectrumLabel" /> <TextBlock x:Uid="SmoothingDeleteSmoothingToSpectrumLabel" /> </ToolTipService.ToolTip> <Interactivity:Interaction.Behaviors> <Core:EventTriggerBehavior EventName="Tapped"> <Core:InvokeCommandAction Command="{Binding ElementName=self, Path=CommandSaveSmoothedSpectrumProcedure}" /> <Core:InvokeCommandAction Command="{Binding ElementName=self, Path=CommandDeleteSmoothingToSpectrum}" /> </Core:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> </Grid> </PivotItem> </Pivot> </Grid> </ScrollViewer> </UserControl> Loading
INAF.Apps.Uwp.SLabDataManager/Models/RecentFilesContainer.cs +3 −2 Original line number Diff line number Diff line using CommunityToolkit.Mvvm.ComponentModel; using INAF.Libraries.Uwp.Settings.RecentFiles; using System.Collections.Generic; using System.Linq; namespace INAF.Apps.Uwp.SLabDataManager.Models { Loading @@ -25,9 +26,9 @@ namespace INAF.Apps.Uwp.SLabDataManager.Models private set { SetProperty(ref recentFiles, value); } } public void addItems(List<RecentFileModel> recentFiles) public void addItems(IEnumerable<RecentFileModel> recentFiles) { RecentFiles = recentFiles; RecentFiles = recentFiles.ToList(); AreAvailable = true; } Loading
INAF.Apps.Uwp.SLabDataManager/ViewModels/ChartViewModelSmoothing.cs +24 −5 Original line number Diff line number Diff line Loading @@ -268,14 +268,30 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels return segments; } private async Task saveSmoothedSpectrumProcedureAsync() private async Task saveSmoothedSpectrumAsync() { /* retrieve spectrumType for smoothed spectrum */ SpectrumType destSpectrumType = getDestSpectrumType(SmoothingViewModel.SelectedSpectrumType); SpectrumType destSpectrumType = SpectrumType.AlignedSmoothed; if (!WorkingItems.SpectraContainer.isAnySpectrumOfType(destSpectrumType)) return; await saveSmoothedSpectrumProcedureAsync(destSpectrumType); } private async Task saveSmoothedSpectrumBySegmentsAsync() { /* retrieve spectrumType for smoothed spectrum */ SpectrumType destSpectrumType = SpectrumType.AlignedSmoothedBySegments; if (!WorkingItems.SpectraContainer.isAnySpectrumOfType(destSpectrumType)) return; await saveSmoothedSpectrumProcedureAsync(destSpectrumType); } private async Task saveSmoothedSpectrumProcedureAsync(SpectrumType destSpectrumType) { IsLoading = true; /* create spectrum model for being saved on cloud */ Loading @@ -300,7 +316,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels } /* save isSavedOnCloud and id of spectrum */ var spectrum = WorkingItems.SpectraContainer.tryGetSpectrumOfType(destSpectrumType); var spectrum = WorkingItems.SpectraContainer.tryGetSpectrumOfType(spectrumFile.Type); spectrum.setIsSavedOnCloud(responseobj.IsOk); spectrum.setId(responseobj.Id); Loading Loading @@ -338,8 +354,11 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels private RelayCommand commandOverwriteExistingSmoothedSpectrum; public RelayCommand CommandOverwriteExistingSmoothedSpectrum => commandOverwriteExistingSmoothedSpectrum ?? (commandOverwriteExistingSmoothedSpectrum = new RelayCommand(() => overwriteExistingSmoothedSpectrumAsync())); private RelayCommand commandSaveSmoothedSpectrumProcedure; public RelayCommand CommandSaveSmoothedSpectrumProcedure => commandSaveSmoothedSpectrumProcedure ?? (commandSaveSmoothedSpectrumProcedure = new RelayCommand(() => saveSmoothedSpectrumProcedureAsync())); private RelayCommand commandSaveSmoothedSpectrumBySegments; public RelayCommand CommandSaveSmoothedSpectrumBySegments => commandSaveSmoothedSpectrumBySegments ?? (commandSaveSmoothedSpectrumBySegments = new RelayCommand(() => saveSmoothedSpectrumBySegmentsAsync())); private RelayCommand commandSaveSmoothedSpectrum; public RelayCommand CommandSaveSmoothedSpectrum => commandSaveSmoothedSpectrum ?? (commandSaveSmoothedSpectrum = new RelayCommand(() => saveSmoothedSpectrumAsync())); #endregion } }
INAF.Apps.Uwp.SLabDataManager/ViewModels/MainViewModel.cs +76 −40 Original line number Diff line number Diff line Loading @@ -117,12 +117,12 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels await readRemoteOperationsAsync(); /* fill list of recent files */ await tryReadRecentFilesAsync(); await tryReadRecentFilesProcedureAsync().ConfigureAwait(true); /* automatically read ref white, if available in the recent list */ await tryAutoReadRefWhiteFileAsync(); await tryAutoReadRefWhiteFileAsync().ConfigureAwait(true); if (!await checkIsWebAppAliveAsync()) if (!await checkIsWebAppAliveAsync().ConfigureAwait(false)) { IsLoading = false; showDialogMessage("RemoteOperationsNotAvailableErrorMessage".GetText(), DialogMessageType.Warning); Loading @@ -134,47 +134,83 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels #region recent files private async Task addToRecentFilesAsync(string filepath, string token, SpectrumType spectrumType) { await Task.Run(async () => { recentFilesHelper.add(new RecentFileModel(filepath, token, spectrumType.ToString())); if (recentFilesHelper.write()) await tryReadRecentFilesAsync(); }); //await Task.Run(() => recentFilesHelper.save(new RecentFileModel(filepath, token, spectrumType.ToString()), spectrumType.ToString())) // .ContinueWith(async x => await tryReadRecentFilesProcedureAsync()); await Task.Run(() => recentFilesHelper.save(new RecentFileModel(filepath, token, spectrumType.ToString()), spectrumType.ToString())); await tryReadRecentFilesProcedureAsync(); } private async Task tryReadRecentFilesAsync() { await Task.Run(() => //private async Task tryReadRecentFilesAsync() //{ // await Task.Run(() => // { // recentFilesHelper.read(); // if (recentFilesHelper.RecentFiles != null) // { // var recentFilesRaw = recentFilesHelper.tryGetRecentFilesOfType(SpectrumType.Raw); // UpdateUIHelper.UpdateUIAsync(() => // { // RecentFilesRawContainer = new RecentFilesContainer(); // if (recentFilesRaw?.Count() > 0) // RecentFilesRawContainer.addItems(recentFilesRaw.ToList()); // }); // var recentFilesRef = recentFilesHelper.tryGetRecentFilesOfType(SpectrumType.Ref); // UpdateUIHelper.UpdateUIAsync(() => // { // RecentFilesRefContainer = new RecentFilesContainer(); // if (recentFilesRef?.Count() > 0) // RecentFilesRefContainer.addItems(recentFilesRef.ToList()); // }); // var recentFilesRefWhite = recentFilesHelper.tryGetRecentFilesOfType(SpectrumType.RefWhite); // UpdateUIHelper.UpdateUIAsync(() => // { // RecentFilesRefWhiteContainer = new RecentFilesContainer(); // if (recentFilesRefWhite?.Count() > 0) // RecentFilesRefWhiteContainer.addItems(recentFilesRefWhite.ToList()); // }); // } // }); //} private async Task tryReadRecentFilesProcedureAsync() { recentFilesHelper.read(); RecentFilesRawContainer = new RecentFilesContainer(); RecentFilesRefContainer = new RecentFilesContainer(); RecentFilesRefWhiteContainer = new RecentFilesContainer(); if (recentFilesHelper.RecentFiles != null) { var recentFilesRaw = recentFilesHelper.tryGetRecentFilesOfType(SpectrumType.Raw); UpdateUIHelper.UpdateUIAsync(() => List<Task> tasks = new List<Task>(); /* read RAW files */ tasks.Add(Task.Run(() => { RecentFilesRawContainer = new RecentFilesContainer(); if (recentFilesRaw?.Count() > 0) RecentFilesRawContainer.addItems(recentFilesRaw.ToList()); }); var recentFiles = recentFilesHelper.read(SpectrumType.Raw.ToString()); if (recentFiles != null) UpdateUIHelper.UpdateUIAsync(() => RecentFilesRawContainer.addItems(recentFiles)).ConfigureAwait(true); })); var recentFilesRef = recentFilesHelper.tryGetRecentFilesOfType(SpectrumType.Ref); UpdateUIHelper.UpdateUIAsync(() => /* read REF files */ tasks.Add(Task.Run(() => { RecentFilesRefContainer = new RecentFilesContainer(); if (recentFilesRef?.Count() > 0) RecentFilesRefContainer.addItems(recentFilesRef.ToList()); }); var recentFiles = recentFilesHelper.read(SpectrumType.Ref.ToString()); if (recentFiles != null) UpdateUIHelper.UpdateUIAsync(() => RecentFilesRefContainer.addItems(recentFiles)).ConfigureAwait(true); })); var recentFilesRefWhite = recentFilesHelper.tryGetRecentFilesOfType(SpectrumType.RefWhite); UpdateUIHelper.UpdateUIAsync(() => /* read REF WHITE files */ tasks.Add(Task.Run(() => { RecentFilesRefWhiteContainer = new RecentFilesContainer(); if (recentFilesRefWhite?.Count() > 0) RecentFilesRefWhiteContainer.addItems(recentFilesRefWhite.ToList()); }); } }); var recentFiles = recentFilesHelper.read(SpectrumType.RefWhite.ToString()); if (recentFiles != null) UpdateUIHelper.UpdateUIAsync(() => RecentFilesRefWhiteContainer.addItems(recentFiles)).ConfigureAwait(true); })); await Task.WhenAll(tasks).ConfigureAwait(false); } private async Task tryAutoReadRefWhiteFileAsync() Loading
INAF.Apps.Uwp.SLabDataManager/Views/ChartPage.xaml +2 −1 Original line number Diff line number Diff line Loading @@ -930,7 +930,8 @@ CommandDeleteSmoothingToSegments="{x:Bind ViewModel.CommandDeleteSmoothingBySegments}" CommandDeleteSmoothingToSpectrum="{x:Bind ViewModel.CommandDeleteSmoothingToSpectrum}" CommandCloseUserControl="{x:Bind ViewModel.CommandCloseUserControl}" CommandSaveSmoothedSpectrumProcedure="{x:Bind ViewModel.CommandSaveSmoothedSpectrumProcedure}"> CommandSaveSmoothedSpectrum="{x:Bind ViewModel.CommandSaveSmoothedSpectrum}" CommandSaveSmoothedSpectrumBySegments="{x:Bind ViewModel.CommandSaveSmoothedSpectrumBySegments}"> <usercontrols:SmoothingUserControl.RenderTransform> <TranslateTransform X="400" Y="0" /> </usercontrols:SmoothingUserControl.RenderTransform> Loading
INAF.Apps.Uwp.SLabDataManager/Views/UserControls/SmoothingUserControl.xaml +51 −26 Original line number Diff line number Diff line Loading @@ -247,6 +247,7 @@ <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> Loading @@ -263,7 +264,7 @@ Margin="0,8" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"/> Grid.ColumnSpan="4"/> <!-- BUTTON APPLY SMOOTHING BY SEGMENTS --> <Button x:Name="buttonApplySmoothingBySegments" FontFamily="Segoe MDL2 Assets" Loading @@ -285,8 +286,30 @@ </Core:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> <!-- BUTTON SAVE SMOOTHING TO SEGMENTS --> <Button x:Name="buttonSaveSmoothedSpectrumBySegments" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingBySegmentsAllowed, Mode=OneWay}" FontFamily="Segoe MDL2 Assets" Content="" HorizontalAlignment="Left" Width="48" Height="48" Margin="8" Style="{ThemeResource CircleButton}" Background="{ThemeResource SystemAccentColor}" Grid.Row="2" Grid.Column="1"> <ToolTipService.ToolTip> <TextBlock x:Uid="SmoothingSaveSmoothedSpectrumLabel" /> </ToolTipService.ToolTip> <Interactivity:Interaction.Behaviors> <Core:EventTriggerBehavior EventName="Tapped"> <Core:InvokeCommandAction Command="{Binding ElementName=self, Path=CommandSaveSmoothedSpectrumBySegments}" /> </Core:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> <!-- BUTTON DELETE SMOOTHING BY SEGMENTS --> <Button x:Name="buttonDeleteSmoothingBySegments" <Button x:Name="buttonDeleteSmoothingSpectrum" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingBySegmentsAllowed, Mode=OneWay}" FontFamily="Segoe MDL2 Assets" Content="" Loading @@ -297,7 +320,7 @@ Style="{ThemeResource CircleButton}" Background="{ThemeResource SystemAccentColor}" Grid.Row="2" Grid.Column="1"> Grid.Column="2"> <ToolTipService.ToolTip> <TextBlock x:Uid="SmoothingDeleteSmoothingBySegmentsLabel" /> </ToolTipService.ToolTip> Loading @@ -319,6 +342,7 @@ <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> Loading @@ -337,7 +361,7 @@ Margin="0,8" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"/> Grid.ColumnSpan="4"/> <!-- BUTTON APPLY SMOOTHING TO WHOLE SPECTRUM --> <Button x:Name="buttonApplySmoothingToSpectrum" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingBySegmentsAllowed, Mode=OneWay}" Loading @@ -360,11 +384,11 @@ </Core:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> <!-- BUTTON DELETE SMOOTHING TO SEGMENTS --> <Button x:Name="buttonDeleteSmoothingToSpectrum" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingToSpectrumAllowed, Mode=OneWay}" <!-- BUTTON SAVE SMOOTHING TO SPECTRUM --> <Button x:Name="buttonSaveSmoothedSpectrum" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingBySegmentsAllowed, Mode=OneWay}" FontFamily="Segoe MDL2 Assets" Content="" Content="" HorizontalAlignment="Left" Width="48" Height="48" Loading @@ -372,40 +396,41 @@ Style="{ThemeResource CircleButton}" Background="{ThemeResource SystemAccentColor}" Grid.Row="2" Grid.Column="2"> Grid.Column="1"> <ToolTipService.ToolTip> <TextBlock x:Uid="SmoothingDeleteSmoothingToSpectrumLabel" /> <TextBlock x:Uid="SmoothingSaveSmoothedSpectrumLabel" /> </ToolTipService.ToolTip> <Interactivity:Interaction.Behaviors> <Core:EventTriggerBehavior EventName="Tapped"> <Core:InvokeCommandAction Command="{Binding ElementName=self, Path=CommandDeleteSmoothingToSpectrum}" /> <Core:InvokeCommandAction Command="{Binding ElementName=self, Path=CommandSaveSmoothedSpectrum}" /> </Core:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> </Grid> </PivotItem> </Pivot> <!-- ROW 4 - BUTTON SAVE SMOOTHING TO SEGMENTS --> <Button x:Name="buttonSaveSmoothedSpectrum" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingBySegmentsAllowed, Mode=OneWay}" <!-- BUTTON DELETE SMOOTHING TO SPECTRUM --> <Button x:Name="buttonDeleteSmoothingToSpectrum" IsEnabled="{Binding ElementName=self, Path=IsDeleteSmoothingToSpectrumAllowed, Mode=OneWay}" FontFamily="Segoe MDL2 Assets" Content="" Content="" HorizontalAlignment="Left" Width="48" Height="48" Margin="8,16,8,0" Margin="8" Style="{ThemeResource CircleButton}" Background="{ThemeResource SystemAccentColor}" Grid.Row="4"> Grid.Row="2" Grid.Column="2"> <ToolTipService.ToolTip> <TextBlock x:Uid="SmoothingSaveSmoothedSpectrumLabel" /> <TextBlock x:Uid="SmoothingDeleteSmoothingToSpectrumLabel" /> </ToolTipService.ToolTip> <Interactivity:Interaction.Behaviors> <Core:EventTriggerBehavior EventName="Tapped"> <Core:InvokeCommandAction Command="{Binding ElementName=self, Path=CommandSaveSmoothedSpectrumProcedure}" /> <Core:InvokeCommandAction Command="{Binding ElementName=self, Path=CommandDeleteSmoothingToSpectrum}" /> </Core:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </Button> </Grid> </PivotItem> </Pivot> </Grid> </ScrollViewer> </UserControl>