Esempio n. 1
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            SQLiteConnection dbconn;

            try
            {
                dbconn = new SQLiteConnection(App.settingpath);
                var info = dbconn.Table <settingsdata>().ToList().First();
                lang = info.language;
                List <weatherkey> showdata = new DB_weather().WeatherInfo;

                {
                    weatherchart.SecondaryAxis.LabelStyle.LabelFormat = "##.#" + DB_weather.tempunit(info._temp);
                    if (info._temp == temp.Fahrenheit)
                    {
                        foreach (var item in showdata)
                        {
                            item.MaxTemp_level = DB_weather.celtofah(item.MaxTemp_level);
                            item.MinTemp_level = DB_weather.celtofah(item.MinTemp_level);
                        }
                    }
                    maxtempdata.ItemsSource  = showdata;
                    maxtempdata.YBindingPath = "MaxTemp_level";
                    maxtempdata.XBindingPath = "date";
                    mintempdata.ItemsSource  = showdata;
                    mintempdata.YBindingPath = "MinTemp_level";
                    mintempdata.XBindingPath = "date";
                    var p = (int)lang;
                    showRecordbtn.Text      = text[0][p];
                    weatherchart.Title.Text = text[1][p];
                    weatherchart.SecondaryAxis.Title.Text = text[2][p];
                    weatherchart.PrimaryAxis.Title.Text   = text[3][p];
                    chart0.Title.Text = text[4][p];
                    chart0.SecondaryAxis.Title.Text = text[5][p];
                    chart0.PrimaryAxis.Title.Text   = text[3][p];
                    chart1.Title.Text = text[6][p];
                    chart1.SecondaryAxis.Title.Text = text[7][p];
                    chart1.PrimaryAxis.Title.Text   = text[3][p];
                    chart2.Title.Text = text[8][p];
                    chart2.SecondaryAxis.Title.Text = text[9][p];
                    chart2.PrimaryAxis.Title.Text   = text[3][p];
                    chart3.Title.Text = text[10][p];
                    chart3.SecondaryAxis.Title.Text = text[11][p];
                    chart3.PrimaryAxis.Title.Text   = text[3][p];
                    chart4.Title.Text = text[12][p];
                    chart4.SecondaryAxis.Title.Text = text[13][p];
                    chart4.PrimaryAxis.Title.Text   = text[3][p];
                    chart5.Title.Text = text[14][p];
                    chart5.SecondaryAxis.Title.Text = text[15][p];
                    chart5.PrimaryAxis.Title.Text   = text[3][p];
                    chart6.Title.Text = text[16][p];
                    chart6.SecondaryAxis.Title.Text = text[17][p];
                    chart6.PrimaryAxis.Title.Text   = text[3][p];
                    Title = text[18][p];
                }
            }

            catch (Exception) { }
        }
Esempio n. 2
0
        private void ShowRecordbtn_Clicked(object sender, EventArgs e)
        {
            var day = Maxdate.Date - Mindate.Date;

            if (day.Days < 2)
            {
                var p = (int)lang;
                DisplayAlert(text[19][p], text[20][p], text[21][p]);
                return;
            }
            SQLiteConnection dbconn = new SQLiteConnection(App.settingpath);
            var info = dbconn.Table <settingsdata>().ToList().First();
            List <weatherkey> showdata = new DB_weather().WeatherInfo;

            if (info._temp == temp.Fahrenheit)
            {
                foreach (var item in showdata)
                {
                    item.MaxTemp_level = DB_weather.celtofah(item.MaxTemp_level);
                    item.MinTemp_level = DB_weather.celtofah(item.MinTemp_level);
                }
            }
            var dp = showdata.Where((x) => x.date >= Mindate.Date && x.date <= Maxdate.Date);

            maxtempdata.ItemsSource  = dp;
            mintempdata.ItemsSource  = dp;
            maxtempdata.YBindingPath = "MaxTemp_level";
            maxtempdata.XBindingPath = "date";
            mintempdata.YBindingPath = "MinTemp_level";
            mintempdata.XBindingPath = "date";

            humi.ItemsSource   = dp;
            humi.YBindingPath  = "Hum_level";
            humi.XBindingPath  = "date";
            PM2_5.ItemsSource  = dp;
            PM2_5.YBindingPath = "PM2_5_level";
            PM2_5.XBindingPath = "date";
            PM10.ItemsSource   = dp;
            PM10.YBindingPath  = "PM_10_level";
            PM10.XBindingPath  = "date";
            SO2.ItemsSource    = dp;
            SO2.YBindingPath   = "SO2_level";
            SO2.XBindingPath   = "date";
            CO.ItemsSource     = dp;
            CO.YBindingPath    = "CO_level";
            CO.XBindingPath    = "date";
            NO2.ItemsSource    = dp;
            NO2.YBindingPath   = "NO2_level";
            NO2.XBindingPath   = "date";
            O3.ItemsSource     = dp;
            O3.YBindingPath    = "O3_level";
            O3.XBindingPath    = "date";
        }
Esempio n. 3
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            SQLiteConnection dbconn = new SQLiteConnection(App.settingpath);
            var info = dbconn.Table <settingsdata>().ToList().First();

            lang = info.language;
            try
            {
                weatherchart.SecondaryAxis.LabelStyle.LabelFormat = "##.#" +
                                                                    DB_weather.tempunit(info._temp);
                List <weatherDB> showdata = new SQLiteConnection(App.futureweatherDBpath)
                                            .Table <weatherDB>().ToList();
                if (info._temp == temp.Fahrenheit)
                {
                    foreach (var item in showdata)
                    {
                        item.maxtemp = DB_weather.celtofah(item.maxtemp);
                        item.mintemp = DB_weather.celtofah(item.mintemp);
                    }
                }
                maxtempdata.ItemsSource  = showdata;
                maxtempdata.YBindingPath = "maxtemp";
                maxtempdata.XBindingPath = "date";
                mintempdata.ItemsSource  = showdata;

                mintempdata.YBindingPath = "mintemp";
                mintempdata.XBindingPath = "date";
            }
            catch (Exception) { }
            int p = (int)lang;

            Title = weathertext[p];
            weatherchart.Title.Text = temptitle[p];
            weatherchart.SecondaryAxis.Title.Text = tempyaxis[p];
            weatherchart.PrimaryAxis.Title.Text   = tempxaxis[p];
            humchart.Title.Text = humtitle[p];
            humchart.SecondaryAxis.Title.Text = humyaxis[p];
            humchart.PrimaryAxis.Title.Text   = tempxaxis[p];
        }