Commit 770ce20f authored by Francesco Carraro's avatar Francesco Carraro
Browse files

adding sample data info...

parent b4170b92
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 */
+1 −0
Original line number Diff line number Diff line
@@ -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
+5 −3
Original line number Diff line number Diff line
@@ -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);
+37 −0
Original line number Diff line number Diff line
@@ -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);
@@ -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;
+16 −2
Original line number Diff line number Diff line
@@ -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();
        }
@@ -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;
@@ -162,6 +172,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart
                DialogMessage = exMsg;
                raiseIsDialogRequired();
            }

            return exMsg;
        }

        private void alignLeftSide(ref SpectrumModel aligningSpectrum,
@@ -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