diff --git a/Wetterstation/Form1.Designer.cs b/Wetterstation/Form1.Designer.cs index cd08b3a73edc1c6bec600cf7f99b2801a91aa2e1..bf7a953d5a78f2925ed43cda5fcd18c781c235b0 100644 --- a/Wetterstation/Form1.Designer.cs +++ b/Wetterstation/Form1.Designer.cs @@ -36,10 +36,10 @@ namespace Wetterstation /// </summary> private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.Title title1 = new System.Windows.Forms.DataVisualization.Charting.Title(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea3 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend3 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Title title3 = new System.Windows.Forms.DataVisualization.Charting.Title(); this.lbTextInnentemp = new System.Windows.Forms.Label(); this.lbTextAussentemp = new System.Windows.Forms.Label(); this.lbTextWindSpeed = new System.Windows.Forms.Label(); @@ -446,23 +446,23 @@ namespace Wetterstation // chart1 // this.chart1.Anchor = System.Windows.Forms.AnchorStyles.None; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - legend1.Name = "Legend1"; - this.chart1.Legends.Add(legend1); + chartArea3.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea3); + legend3.Name = "Legend1"; + this.chart1.Legends.Add(legend3); this.chart1.Location = new System.Drawing.Point(37, 672); this.chart1.Margin = new System.Windows.Forms.Padding(4); this.chart1.Name = "chart1"; this.chart1.Palette = System.Windows.Forms.DataVisualization.Charting.ChartColorPalette.Excel; - series1.ChartArea = "ChartArea1"; - series1.Legend = "Legend1"; - series1.Name = "Series1"; - this.chart1.Series.Add(series1); + series3.ChartArea = "ChartArea1"; + series3.Legend = "Legend1"; + series3.Name = "Series1"; + this.chart1.Series.Add(series3); this.chart1.Size = new System.Drawing.Size(991, 132); this.chart1.TabIndex = 41; this.chart1.Text = "chTendenz"; - title1.Name = "Title1"; - this.chart1.Titles.Add(title1); + title3.Name = "Title1"; + this.chart1.Titles.Add(title3); // // lbHintergrund // @@ -504,7 +504,7 @@ namespace Wetterstation this.btSystemKnopf.BackColor = System.Drawing.Color.Transparent; this.btSystemKnopf.BackgroundImage = global::Wetterstation.Properties.Resources.Zahnrad12; this.btSystemKnopf.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.btSystemKnopf.Location = new System.Drawing.Point(1288, 846); + this.btSystemKnopf.Location = new System.Drawing.Point(1291, 847); this.btSystemKnopf.Margin = new System.Windows.Forms.Padding(4); this.btSystemKnopf.Name = "btSystemKnopf"; this.btSystemKnopf.Size = new System.Drawing.Size(40, 37); diff --git a/Wetterstation/Form1.cs b/Wetterstation/Form1.cs index bf15394b8d1b82ba3cf5c75cf1216b8341617cd1..cfedd8994cf4dfd7aa559f626d236ee920319cca 100644 --- a/Wetterstation/Form1.cs +++ b/Wetterstation/Form1.cs @@ -149,23 +149,23 @@ namespace Wetterstation try { dynamic weatherData = JsonConvert.DeserializeObject(message.ToString()); - lbForecastImage1.Invoke(new Action(() => { lbForecastImage1.Image = global::Wetterstation.Properties.Resources.ResourceManager.GetObject("_" + weatherData[0].icon1 + "_2x"); })); + if(weatherData[0].icon1 != null) lbForecastImage1.Invoke(new Action(() => { lbForecastImage1.Image = global::Wetterstation.Properties.Resources.ResourceManager.GetObject("_" + weatherData[0].icon1 + "_2x"); })); lbForecastTemp1.Invoke(new Action(() => { lbForecastTemp1.Text = weatherData[0].temp + " °C"; })); lbForecastDay1.Invoke(new Action(() => { lbForecastDay1.Text = getDayFromDateString(weatherData[0].from.ToString()); })); - - lbForecastImage2.Invoke(new Action(() => { lbForecastImage2.Image = global::Wetterstation.Properties.Resources.ResourceManager.GetObject("_" + weatherData[1].icon1 + "_2x"); })); + + if (weatherData[1].icon1 != null) lbForecastImage2.Invoke(new Action(() => { lbForecastImage2.Image = global::Wetterstation.Properties.Resources.ResourceManager.GetObject("_" + weatherData[1].icon1 + "_2x"); })); lbForecastTemp2.Invoke(new Action(() => { lbForecastTemp2.Text = weatherData[1].temp + " °C"; })); lbForecastDay2.Invoke(new Action(() => { lbForecastDay2.Text = getDayFromDateString(weatherData[1].from.ToString()); })); - lbForecastImage3.Invoke(new Action(() => { lbForecastImage3.Image = global::Wetterstation.Properties.Resources.ResourceManager.GetObject("_" + weatherData[2].icon1 + "_2x"); })); + if (weatherData[2].icon1 != null) lbForecastImage3.Invoke(new Action(() => { lbForecastImage3.Image = global::Wetterstation.Properties.Resources.ResourceManager.GetObject("_" + weatherData[2].icon1 + "_2x"); })); lbForecastTemp3.Invoke(new Action(() => { lbForecastTemp3.Text = weatherData[2].temp + " °C"; }));lbForecastDay1.Invoke(new Action(() => { lbForecastDay1.Text = getDayFromDateString(weatherData[0].from.ToString()); })); lbForecastDay3.Invoke(new Action(() => { lbForecastDay3.Text = getDayFromDateString(weatherData[2].from.ToString()); })); - lbForecastImage4.Invoke(new Action(() => { lbForecastImage4.Image = global::Wetterstation.Properties.Resources.ResourceManager.GetObject("_" + weatherData[3].icon1 + "_2x"); })); + if (weatherData[3].icon1 != null) lbForecastImage4.Invoke(new Action(() => { lbForecastImage4.Image = global::Wetterstation.Properties.Resources.ResourceManager.GetObject("_" + weatherData[3].icon1 + "_2x"); })); lbForecastTemp4.Invoke(new Action(() => { lbForecastTemp4.Text = weatherData[3].temp + " °C"; })); lbForecastDay4.Invoke(new Action(() => { lbForecastDay4.Text = getDayFromDateString(weatherData[3].from.ToString()); })); - lbForecastImage5.Invoke(new Action(() => { lbForecastImage5.Image = global::Wetterstation.Properties.Resources.ResourceManager.GetObject("_" + weatherData[4].icon1 + "_2x"); })); + if (weatherData[4].icon1 != null) lbForecastImage5.Invoke(new Action(() => { lbForecastImage5.Image = global::Wetterstation.Properties.Resources.ResourceManager.GetObject("_" + weatherData[4].icon1 + "_2x"); })); lbForecastTemp5.Invoke(new Action(() => { lbForecastTemp5.Text = weatherData[4].temp + " °C"; })); lbForecastDay5.Invoke(new Action(() => { lbForecastDay5.Text = getDayFromDateString(weatherData[4].from.ToString()); })); } @@ -199,7 +199,7 @@ namespace Wetterstation public void updateSettings2Mqtt() { Console.WriteLine(JsonConvert.SerializeObject(WeatherstationSettings).ToString()); - this.msgPublish(WeatherstationSettings.mqtt_topic_backend + WeatherstationSettings.frontendId + "/settings", JsonConvert.SerializeObject(WeatherstationSettings).ToString()); + this.msgPublish(WeatherstationSettings.mqtt_topic_backend + "settings", JsonConvert.SerializeObject(WeatherstationSettings).ToString()); } private void BtSystemKnopf_Click(object sender, EventArgs e)