Loading INAF.Apps.Uwp.SLabDataManager/Helpers/RemoteOperations/RemoteOperationsManager.cs +36 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.RemoteOperations return await postAsync(model, RemoteOperationType.SaveFileOfType); } #region private private HttpStringContent getHttpStringContent(Object objectToBeSerialized) { Loading Loading @@ -166,6 +167,41 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.RemoteOperations return isOk; } private async Task<T> postAsync<T>(object model, 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); using (var httpContent = getHttpStringContent(model)) { var url = remoteOperationsRepository.getUrl(remoteOperationType); using (var response = await httpClient.PostAsync(new Uri(url), httpContent)) { 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 void Dispose(bool disposing) { if (!disposedValue) Loading INAF.Apps.Uwp.SLabDataManager/ViewModels/ChartViewModel.cs +2 −2 Original line number Diff line number Diff line Loading @@ -221,13 +221,13 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels sampleDataValuesContainer.GrainSizeTypeValues?.Count > 0) { if (!isPageInit) IsLoading = true; IsLoading = false; SampleDataViewModel = new SampleDataViewModel(sampleDataValuesContainer); } else { if (!isPageInit) IsLoading = true; IsLoading = false; showDialogMessage("SampleDataNotAvailableMessage".GetText()); } } Loading Loading
INAF.Apps.Uwp.SLabDataManager/Helpers/RemoteOperations/RemoteOperationsManager.cs +36 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.RemoteOperations return await postAsync(model, RemoteOperationType.SaveFileOfType); } #region private private HttpStringContent getHttpStringContent(Object objectToBeSerialized) { Loading Loading @@ -166,6 +167,41 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.RemoteOperations return isOk; } private async Task<T> postAsync<T>(object model, 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); using (var httpContent = getHttpStringContent(model)) { var url = remoteOperationsRepository.getUrl(remoteOperationType); using (var response = await httpClient.PostAsync(new Uri(url), httpContent)) { 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 void Dispose(bool disposing) { if (!disposedValue) Loading
INAF.Apps.Uwp.SLabDataManager/ViewModels/ChartViewModel.cs +2 −2 Original line number Diff line number Diff line Loading @@ -221,13 +221,13 @@ namespace INAF.Apps.Uwp.SLabDataManager.ViewModels sampleDataValuesContainer.GrainSizeTypeValues?.Count > 0) { if (!isPageInit) IsLoading = true; IsLoading = false; SampleDataViewModel = new SampleDataViewModel(sampleDataValuesContainer); } else { if (!isPageInit) IsLoading = true; IsLoading = false; showDialogMessage("SampleDataNotAvailableMessage".GetText()); } } Loading