Loading INAF.Apps.Uwp.SLabDataManager/App.xaml.cs +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ namespace INAF.Apps.Uwp.SLabDataManager private ActivationService CreateActivationService() { #if DEBUG2 #if DEBUG return new ActivationService(this, typeof(Views.MainPage), new Lazy<UIElement>(CreateShell)); #else /* hide left navigation pane to avoid navigation to main page if user is not allowed */ Loading INAF.Apps.Uwp.SLabDataManager/Assets/xml/remoteoperations.xml +1 −0 Original line number Diff line number Diff line Loading @@ -8,5 +8,6 @@ <operation type="SaveAlignedFile">AppSpectraFilesActions/SaveAlignedSpectrum</operation> <operation type="SaveFileOfType">AppSpectraFilesActions/SaveSpectrumOfType</operation> <operation type="IsSavedOnCloud">AppSpectraFilesActions/IsSpectrumSavedOnCloud</operation> <operation type="GetSampleDataValues">AppSpectraFilesActions/GetSampleDataValues</operation> </operationUrls> </remoteOperationsData> No newline at end of file INAF.Apps.Uwp.SLabDataManager/Charts/SpectraContainer.cs +5 −3 Original line number Diff line number Diff line Loading @@ -325,9 +325,11 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts foreach (var spectrum in spectra) yvalues.AddRange(spectrum.Elements.Select(x => x.Y)); (double yMin, double yMax) yresult = yvalues.GetBoundaries(); yMin = yresult.yMin; yMax = yresult.yMax; //(double yMin, double yMax) yresult = yvalues.GetBoundaries(); //yMin = yresult.yMin; //yMax = yresult.yMax; yMin = yvalues.Min() * 0.9; yMax = yvalues.Max() * 1.1; })); await Task.WhenAll(tasks); Loading INAF.Apps.Uwp.SLabDataManager/Helpers/RemoteOperations/RemoteOperationsManager.cs +37 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,11 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.RemoteOperations this.logger = logger; } public async Task<T> getValues<T>(RemoteOperationType remoteOperationType) { return await getAsync<T>(remoteOperationType); } public async Task<bool> isLoginValidAsync() { return await getAsync(RemoteOperationType.IsLoginValid); Loading Loading @@ -93,6 +98,38 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.RemoteOperations return isOk; } private async Task<T> getAsync<T>(RemoteOperationType remoteOperationType) { T result = default; try { using (var httpClient = new HttpClient()) { JwtTokenModel tokenModel = settingsHelper.get<JwtTokenModel>(Constants.Constants.AUTHENTICATION_TOKEN); httpClient.DefaultRequestHeaders.Authorization = new HttpCredentialsHeaderValue("Bearer", tokenModel.Token); var url = remoteOperationsRepository.getUrl(remoteOperationType); using (var response = await httpClient.GetAsync(new Uri(url))) { if (response.IsSuccessStatusCode) { var responseContent = await response.Content.ReadAsStringAsync(); //System.Diagnostics.Debug.WriteLine($"responseContent: {responseContent}"); result = JsonConvert.DeserializeObject<T>(responseContent); } } } } catch (Exception ex) { logger.Write<RemoteOperationsManager>($"{nameof(postAsync)} - ex: {ex.Message}", Serilog.Events.LogEventLevel.Error); } return result; } private async Task<bool> postAsync(object model, RemoteOperationType remoteOperationType) { bool isOk = true; Loading INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/SpectrumProcessingHelper.cs +16 −2 Original line number Diff line number Diff line Loading @@ -57,7 +57,17 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart #region alignment public async Task alignSpectrumProcedureAsync() { await alignRawSpectrumAsync(); string exMsg = await alignRawSpectrumAsync(); if (!string.IsNullOrEmpty(exMsg)) { UpdateUIHelper.UpdateUIAsync(() => { DialogMessageType = DialogMessageType.Warning; DialogMessage = exMsg; raiseIsDialogRequired(); }); return; } await workingItems.SpectraContainer.updateBoundariesAsync(); } Loading @@ -76,7 +86,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart return aligningSpectrum; } private async Task alignRawSpectrumAsync() private async Task<string> alignRawSpectrumAsync() { IsDialogRequired = false; DialogMessage = string.Empty; Loading Loading @@ -162,6 +172,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart DialogMessage = exMsg; raiseIsDialogRequired(); } return exMsg; } private void alignLeftSide(ref SpectrumModel aligningSpectrum, Loading Loading @@ -277,6 +289,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart Ioc.Default.GetRequiredService<ChartViewModel>().IsAddingPointsForContinuumRemovalAllowed = false; workingItems.SpectraContainer.IsSpectrumContinuumRemoved = true; workingItems.SpectraContainer.addSpectrum(continuumRemovedSpectrum); await workingItems.SpectraContainer.updateBoundariesAsync(); } else { Loading Loading
INAF.Apps.Uwp.SLabDataManager/App.xaml.cs +1 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,7 @@ namespace INAF.Apps.Uwp.SLabDataManager private ActivationService CreateActivationService() { #if DEBUG2 #if DEBUG return new ActivationService(this, typeof(Views.MainPage), new Lazy<UIElement>(CreateShell)); #else /* hide left navigation pane to avoid navigation to main page if user is not allowed */ Loading
INAF.Apps.Uwp.SLabDataManager/Assets/xml/remoteoperations.xml +1 −0 Original line number Diff line number Diff line Loading @@ -8,5 +8,6 @@ <operation type="SaveAlignedFile">AppSpectraFilesActions/SaveAlignedSpectrum</operation> <operation type="SaveFileOfType">AppSpectraFilesActions/SaveSpectrumOfType</operation> <operation type="IsSavedOnCloud">AppSpectraFilesActions/IsSpectrumSavedOnCloud</operation> <operation type="GetSampleDataValues">AppSpectraFilesActions/GetSampleDataValues</operation> </operationUrls> </remoteOperationsData> No newline at end of file
INAF.Apps.Uwp.SLabDataManager/Charts/SpectraContainer.cs +5 −3 Original line number Diff line number Diff line Loading @@ -325,9 +325,11 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts foreach (var spectrum in spectra) yvalues.AddRange(spectrum.Elements.Select(x => x.Y)); (double yMin, double yMax) yresult = yvalues.GetBoundaries(); yMin = yresult.yMin; yMax = yresult.yMax; //(double yMin, double yMax) yresult = yvalues.GetBoundaries(); //yMin = yresult.yMin; //yMax = yresult.yMax; yMin = yvalues.Min() * 0.9; yMax = yvalues.Max() * 1.1; })); await Task.WhenAll(tasks); Loading
INAF.Apps.Uwp.SLabDataManager/Helpers/RemoteOperations/RemoteOperationsManager.cs +37 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,11 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.RemoteOperations this.logger = logger; } public async Task<T> getValues<T>(RemoteOperationType remoteOperationType) { return await getAsync<T>(remoteOperationType); } public async Task<bool> isLoginValidAsync() { return await getAsync(RemoteOperationType.IsLoginValid); Loading Loading @@ -93,6 +98,38 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.RemoteOperations return isOk; } private async Task<T> getAsync<T>(RemoteOperationType remoteOperationType) { T result = default; try { using (var httpClient = new HttpClient()) { JwtTokenModel tokenModel = settingsHelper.get<JwtTokenModel>(Constants.Constants.AUTHENTICATION_TOKEN); httpClient.DefaultRequestHeaders.Authorization = new HttpCredentialsHeaderValue("Bearer", tokenModel.Token); var url = remoteOperationsRepository.getUrl(remoteOperationType); using (var response = await httpClient.GetAsync(new Uri(url))) { if (response.IsSuccessStatusCode) { var responseContent = await response.Content.ReadAsStringAsync(); //System.Diagnostics.Debug.WriteLine($"responseContent: {responseContent}"); result = JsonConvert.DeserializeObject<T>(responseContent); } } } } catch (Exception ex) { logger.Write<RemoteOperationsManager>($"{nameof(postAsync)} - ex: {ex.Message}", Serilog.Events.LogEventLevel.Error); } return result; } private async Task<bool> postAsync(object model, RemoteOperationType remoteOperationType) { bool isOk = true; Loading
INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/SpectrumProcessingHelper.cs +16 −2 Original line number Diff line number Diff line Loading @@ -57,7 +57,17 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart #region alignment public async Task alignSpectrumProcedureAsync() { await alignRawSpectrumAsync(); string exMsg = await alignRawSpectrumAsync(); if (!string.IsNullOrEmpty(exMsg)) { UpdateUIHelper.UpdateUIAsync(() => { DialogMessageType = DialogMessageType.Warning; DialogMessage = exMsg; raiseIsDialogRequired(); }); return; } await workingItems.SpectraContainer.updateBoundariesAsync(); } Loading @@ -76,7 +86,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart return aligningSpectrum; } private async Task alignRawSpectrumAsync() private async Task<string> alignRawSpectrumAsync() { IsDialogRequired = false; DialogMessage = string.Empty; Loading Loading @@ -162,6 +172,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart DialogMessage = exMsg; raiseIsDialogRequired(); } return exMsg; } private void alignLeftSide(ref SpectrumModel aligningSpectrum, Loading Loading @@ -277,6 +289,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart Ioc.Default.GetRequiredService<ChartViewModel>().IsAddingPointsForContinuumRemovalAllowed = false; workingItems.SpectraContainer.IsSpectrumContinuumRemoved = true; workingItems.SpectraContainer.addSpectrum(continuumRemovedSpectrum); await workingItems.SpectraContainer.updateBoundariesAsync(); } else { Loading