コード例 #1
0
        private void AddPressureChartEntries(MartianDay sol)
        {
            if (sol.AtmosphericPressure != null)
            {
                averagePressureEntries.Add(new ChartEntry((float)sol.AtmosphericPressure.Average)
                {
                    Label      = $"{sol.Sol}",
                    ValueLabel = $"{sol.AtmosphericPressure.Average:N0} Pa",
                    Color      = SKColor.Parse(ThemeHelper.GetThemeColor("textColor").ToHex()),
                    TextColor  = SKColor.Parse(ThemeHelper.GetThemeColor("textColor").ToHex())
                });

                minPressureEntries.Add(new ChartEntry((float)sol.AtmosphericPressure.Min)
                {
                    Label      = $"{sol.Sol}",
                    ValueLabel = string.Empty,
                    Color      = SKColor.Parse(Color.MediumPurple.ToHex())
                });

                maxPressureEntries.Add(new ChartEntry((float)sol.AtmosphericPressure.Max)
                {
                    Label      = $"{sol.Sol}",
                    ValueLabel = string.Empty,
                    Color      = SKColor.Parse(Color.DarkBlue.ToHex())
                });
            }
        }
コード例 #2
0
        private void AddTempChartEntries(string tempScale, MartianDay sol)
        {
            if (sol.AtmosphericTemp != null)
            {
                averageTempEntries.Add(new ChartEntry((float)sol.AtmosphericTemp.Average)
                {
                    Label      = $"{sol.Sol}",
                    ValueLabel = $"{sol.AtmosphericTemp.Average:N1}{tempScale}",
                    Color      = SKColor.Parse(ThemeHelper.GetThemeColor("textColor").ToHex()),
                    TextColor  = SKColor.Parse(ThemeHelper.GetThemeColor("textColor").ToHex())
                });

                minTempEntries.Add(new ChartEntry((float)sol.AtmosphericTemp.Min)
                {
                    Label      = $"{sol.Sol}",
                    ValueLabel = string.Empty,
                    Color      = SKColor.Parse(Color.LightBlue.ToHex())
                });

                maxTempEntries.Add(new ChartEntry((float)sol.AtmosphericTemp.Max)
                {
                    Label      = $"{sol.Sol}",
                    ValueLabel = string.Empty,
                    Color      = SKColor.Parse(Color.Red.ToHex())
                });
            }
        }
コード例 #3
0
        private void AddWindSpeedChartEntries(MartianDay sol)
        {
            if (sol.HorizontalWindSpeed != null)
            {
                averageWindSpeedEntries.Add(new ChartEntry((float)sol.HorizontalWindSpeed.Average)
                {
                    Label      = $"{sol.Sol}",
                    ValueLabel = $"{sol.HorizontalWindSpeed.Average:N1} m/s",
                    Color      = SKColor.Parse(ThemeHelper.GetThemeColor("textColor").ToHex()),
                    TextColor  = SKColor.Parse(ThemeHelper.GetThemeColor("textColor").ToHex())
                });

                minWindSpeedEntries.Add(new ChartEntry((float)sol.HorizontalWindSpeed.Min)
                {
                    Label      = $"{sol.Sol}",
                    ValueLabel = string.Empty,
                    Color      = SKColor.Parse(Color.DarkGreen.ToHex())
                });

                maxWindSpeedEntries.Add(new ChartEntry((float)sol.HorizontalWindSpeed.Max)
                {
                    Label      = $"{sol.Sol}",
                    ValueLabel = string.Empty,
                    Color      = SKColor.Parse(Color.DarkGoldenrod.ToHex())
                });
            }
        }
コード例 #4
0
        private void GetWeeklyOverview()
        {
            if (!updatingCharts)
            {
                updatingCharts = true;
                try
                {
                    if (weatherService.Weather.Count < 1)
                    {
                        SetMessages("No Martian Weather data available.");
                    }
                    else
                    {
                        MartianDay firstDay = weatherService.Weather.OrderBy(d => d.Sol).First <MartianDay>();
                        MartianDay lastDay  = weatherService.Weather.OrderBy(d => d.Sol).Last <MartianDay>();
                        MarsDates   = $"Sol {firstDay.Sol} - Sol {lastDay.Sol}";
                        EarthDates  = $"{firstDay.FirstUTC:M} - {lastDay.FirstUTC:M}";
                        LastUpdated = weatherService.LastUpdated;
                        Season      = lastDay.Season;

                        SetTempChartAxes();
                        SetWindSpeedChartAxes();
                        SetPressureChartAxes();
                        string tempScale = settings.TemperatureScale == TemperatureScale.Celsius ? "°C" : "°F";

                        foreach (MartianDay sol in weatherService.Weather.OrderBy(d => d.Sol))
                        {
                            AddTempChartEntries(tempScale, sol);
                            AddWindSpeedChartEntries(sol);
                            AddPressureChartEntries(sol);
                        }
                    }
                }
                catch (Exception ex)
                {
                    SetMessages($"Error: {ex.Message}");
                }
                finally
                {
                    updatingCharts = false;
                }
            }
        }