Some new Features
This commit is contained in:
parent
a59a458e58
commit
338296206c
@ -11,6 +11,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectorDataMqtt", "..\Uti
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "litjson_4.7.1", "..\Librarys\litjson\litjson\litjson_4.7.1.csproj", "{91A14CD2-2940-4500-8193-56D37EDDDBAA}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "M2Mqtt_4.7.1", "..\Librarys\mqtt\M2Mqtt\M2Mqtt_4.7.1.csproj", "{A11AEF5A-B246-4FE8-8330-06DB73CC8074}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -33,6 +37,14 @@ Global
|
|||||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU
|
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Net.Cache;
|
using System.Net.Cache;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
@ -9,16 +10,18 @@ using BlubbFish.Utils.IoT.Connector;
|
|||||||
|
|
||||||
namespace BlubbFish.House.Dashboard.Functions {
|
namespace BlubbFish.House.Dashboard.Functions {
|
||||||
class Tabs {
|
class Tabs {
|
||||||
private InIReader ini;
|
private readonly InIReader ini;
|
||||||
private ADataBackend data;
|
private readonly ABackend data;
|
||||||
|
private UIElement window;
|
||||||
private TabItem tab;
|
private TabItem tab;
|
||||||
|
|
||||||
public Tabs(InIReader settings, ADataBackend data) {
|
public Tabs(InIReader settings, ABackend data) {
|
||||||
this.ini = settings;
|
this.ini = settings;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal TabItem GetTab() {
|
internal TabItem GetTab(UIElement window) {
|
||||||
|
this.window = window;
|
||||||
this.tab = new TabItem();
|
this.tab = new TabItem();
|
||||||
this.GenerateHeader();
|
this.GenerateHeader();
|
||||||
this.GenerateContent();
|
this.GenerateContent();
|
||||||
@ -45,7 +48,7 @@ namespace BlubbFish.House.Dashboard.Functions {
|
|||||||
}
|
}
|
||||||
foreach (String item in this.ini.GetSections(false)) {
|
foreach (String item in this.ini.GetSections(false)) {
|
||||||
if(item != "general") {
|
if(item != "general") {
|
||||||
AGraphics a = AGraphics.GetInstance(this.ini.GetSection(item), this.data);
|
AGraphics a = AGraphics.GetInstance(this.ini.GetSection(item), this.data, this.window);
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
g.Children.Add(a.Draw());
|
g.Children.Add(a.Draw());
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,11 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BlubbFish.Utils.IoT.Connector;
|
using BlubbFish.Utils.IoT.Connector;
|
||||||
|
using BlubbFish.Utils.IoT.Events;
|
||||||
|
|
||||||
namespace BlubbFish.House.Dashboard.Functions {
|
namespace BlubbFish.House.Dashboard.Functions {
|
||||||
class Workload {
|
class Workload {
|
||||||
private SortedDictionary<DateTime, MqttEventArgs> list = new SortedDictionary<DateTime, MqttEventArgs>();
|
private SortedDictionary<DateTime, BackendEvent> list = new SortedDictionary<DateTime, BackendEvent>();
|
||||||
|
|
||||||
public delegate void WorkloadEvent(Object sender, EventArgs e);
|
public delegate void WorkloadEvent(Object sender, EventArgs e);
|
||||||
public event WorkloadEvent Update;
|
public event WorkloadEvent Update;
|
||||||
@ -15,7 +16,7 @@ namespace BlubbFish.House.Dashboard.Functions {
|
|||||||
public Int32 Maximum { get; private set; }
|
public Int32 Maximum { get; private set; }
|
||||||
public Int32 Now { get; private set; }
|
public Int32 Now { get; private set; }
|
||||||
|
|
||||||
internal void SetMessage(MqttEventArgs e) {
|
internal void SetMessage(BackendEvent e) {
|
||||||
DateTime d = DateTime.Now;
|
DateTime d = DateTime.Now;
|
||||||
if (this.list.ContainsKey(d)) {
|
if (this.list.ContainsKey(d)) {
|
||||||
return;
|
return;
|
||||||
@ -23,7 +24,7 @@ namespace BlubbFish.House.Dashboard.Functions {
|
|||||||
this.list.Add(d, e);
|
this.list.Add(d, e);
|
||||||
DateTime old = DateTime.Now.AddSeconds(-30);
|
DateTime old = DateTime.Now.AddSeconds(-30);
|
||||||
List<DateTime> remove = new List<DateTime>();
|
List<DateTime> remove = new List<DateTime>();
|
||||||
foreach (KeyValuePair<DateTime, MqttEventArgs> item in this.list) {
|
foreach (KeyValuePair<DateTime, BackendEvent> item in this.list) {
|
||||||
if(item.Key < old) {
|
if(item.Key < old) {
|
||||||
remove.Add(item.Key);
|
remove.Add(item.Key);
|
||||||
}
|
}
|
||||||
|
@ -3,20 +3,23 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using BlubbFish.Utils.IoT.Connector;
|
using BlubbFish.Utils.IoT.Connector;
|
||||||
|
|
||||||
namespace BlubbFish.House.Dashboard.Graphics {
|
namespace BlubbFish.House.Dashboard.Graphics {
|
||||||
abstract class AGraphics {
|
abstract class AGraphics {
|
||||||
protected ADataBackend data;
|
protected ABackend data;
|
||||||
protected Dictionary<String, String> settings;
|
protected Dictionary<String, String> settings;
|
||||||
|
protected UIElement window;
|
||||||
|
|
||||||
protected AGraphics(Dictionary<String, String> settings, ADataBackend data) {
|
protected AGraphics(Dictionary<String, String> settings, ABackend data, UIElement window) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
|
this.window = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static AGraphics GetInstance(Dictionary<String, String> settings, ADataBackend data) {
|
internal static AGraphics GetInstance(Dictionary<String, String> settings, ABackend data, UIElement window) {
|
||||||
if(!settings.ContainsKey("graphic")) {
|
if(!settings.ContainsKey("graphic")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -27,7 +30,7 @@ namespace BlubbFish.House.Dashboard.Graphics {
|
|||||||
} catch (TypeLoadException) {
|
} catch (TypeLoadException) {
|
||||||
throw new ArgumentException("tracings.ini: " + settings["graphic"].ToUpperLower() + " is not a Tracing");
|
throw new ArgumentException("tracings.ini: " + settings["graphic"].ToUpperLower() + " is not a Tracing");
|
||||||
}
|
}
|
||||||
return (AGraphics)t.GetConstructor(new Type[] { typeof(Dictionary<String, String>), typeof(ADataBackend) }).Invoke(new Object[] { settings, data });
|
return (AGraphics)t.GetConstructor(new Type[] { typeof(Dictionary<String, String>), typeof(ABackend), typeof(UIElement) }).Invoke(new Object[] { settings, data, window });
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Grid Draw();
|
public abstract Grid Draw();
|
||||||
|
@ -5,25 +5,28 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using BlubbFish.Utils.IoT.Connector;
|
using BlubbFish.Utils.IoT.Connector;
|
||||||
|
using BlubbFish.Utils.IoT.Events;
|
||||||
using LitJson;
|
using LitJson;
|
||||||
|
|
||||||
namespace BlubbFish.House.Dashboard.Graphics {
|
namespace BlubbFish.House.Dashboard.Graphics {
|
||||||
class Heater : AGraphics {
|
class Heater : AGraphics {
|
||||||
private TextBlock targetTemp;
|
private readonly TextBlock targetTemp;
|
||||||
private Dictionary<Int32, Double> targetTemps = new Dictionary<Int32, Double>();
|
private readonly Dictionary<Int32, Double> targetTemps = new Dictionary<Int32, Double>();
|
||||||
private TextBlock mode;
|
private readonly TextBlock mode;
|
||||||
private TextBlock now;
|
private readonly TextBlock now;
|
||||||
private String topic;
|
private readonly String topic;
|
||||||
private Dictionary<Int32, String> modes = new Dictionary<Int32, String>();
|
private readonly Dictionary<Int32, String> modes = new Dictionary<Int32, String>();
|
||||||
private Int32 activemode = -1;
|
private Int32 activemode = -1;
|
||||||
private Dictionary<String, String> replace = new Dictionary<String, String> {
|
private Popup popup;
|
||||||
|
private readonly Dictionary<String, String> replace = new Dictionary<String, String> {
|
||||||
{ "Heat", "Heizen" },
|
{ "Heat", "Heizen" },
|
||||||
{ "Energy Save Heat", "Nacht" }
|
{ "Energy Save Heat", "Nacht" }
|
||||||
};
|
};
|
||||||
|
|
||||||
public Heater(Dictionary<String, String> settings, ADataBackend data) : base(settings, data) {
|
public Heater(Dictionary<String, String> settings, ABackend data, UIElement window) : base(settings, data, window) {
|
||||||
this.targetTemp = new TextBlock {
|
this.targetTemp = new TextBlock {
|
||||||
Text = "0 °C"
|
Text = "0 °C"
|
||||||
};
|
};
|
||||||
@ -36,18 +39,20 @@ namespace BlubbFish.House.Dashboard.Graphics {
|
|||||||
if(this.settings.ContainsKey("topic")) {
|
if(this.settings.ContainsKey("topic")) {
|
||||||
this.topic = this.settings["topic"];
|
this.topic = this.settings["topic"];
|
||||||
this.data.MessageIncomming += this.Data_MessageIncomming;
|
this.data.MessageIncomming += this.Data_MessageIncomming;
|
||||||
this.data.Send(this.topic + "/0/49/1/get", "");
|
if (this.data is ADataBackend) {
|
||||||
this.data.Send(this.topic + "/0/64/get", "");
|
((ADataBackend)this.data).Send(this.topic + "/0/49/1/get", "");
|
||||||
this.data.Send(this.topic + "/0/67/1/get", "");
|
((ADataBackend)this.data).Send(this.topic + "/0/64/get", "");
|
||||||
this.data.Send(this.topic + "/0/67/11/get", "");
|
((ADataBackend)this.data).Send(this.topic + "/0/67/1/get", "");
|
||||||
|
((ADataBackend)this.data).Send(this.topic + "/0/67/11/get", "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Data_MessageIncomming(Object sender, MqttEventArgs e) {
|
private void Data_MessageIncomming(Object sender, BackendEvent e) {
|
||||||
if (e.Topic.StartsWith(this.topic)) {
|
if (e.From.ToString().StartsWith(this.topic)) {
|
||||||
try {
|
try {
|
||||||
JsonData j = JsonMapper.ToObject(e.Message);
|
JsonData j = JsonMapper.ToObject(e.Message);
|
||||||
if (e.Topic == this.topic + "/0/49/1") {
|
if (e.From.ToString() == this.topic + "/0/49/1") {
|
||||||
if (j.Keys.Contains("Level")) {
|
if (j.Keys.Contains("Level")) {
|
||||||
if (Double.TryParse(j["Level"].ToString(), out Double level)) {
|
if (Double.TryParse(j["Level"].ToString(), out Double level)) {
|
||||||
this.now.Dispatcher.BeginInvoke((Action)(() => {
|
this.now.Dispatcher.BeginInvoke((Action)(() => {
|
||||||
@ -56,7 +61,7 @@ namespace BlubbFish.House.Dashboard.Graphics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.Topic == this.topic + "/0/64") {
|
if (e.From.ToString() == this.topic + "/0/64") {
|
||||||
if (j.Keys.Contains("ValidModes") && j["ValidModes"].IsObject && this.modes.Count == 0) {
|
if (j.Keys.Contains("ValidModes") && j["ValidModes"].IsObject && this.modes.Count == 0) {
|
||||||
foreach (String item in j["ValidModes"].Keys) {
|
foreach (String item in j["ValidModes"].Keys) {
|
||||||
if (Int32.TryParse(item, out Int32 jvmode)) {
|
if (Int32.TryParse(item, out Int32 jvmode)) {
|
||||||
@ -78,13 +83,13 @@ namespace BlubbFish.House.Dashboard.Graphics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.Topic == this.topic + "/0/67/1" || e.Topic == this.topic + "/0/67/11") {
|
if (e.From.ToString() == this.topic + "/0/67/1" || e.From.ToString() == this.topic + "/0/67/11") {
|
||||||
if (j.Keys.Contains("Level")) {
|
if (j.Keys.Contains("Level")) {
|
||||||
if (Double.TryParse(j["Level"].ToString(), out Double temp)) {
|
if (Double.TryParse(j["Level"].ToString(), out Double temp)) {
|
||||||
Int32 id = 0;
|
Int32 id = 0;
|
||||||
if (e.Topic.EndsWith("/1")) {
|
if (e.From.ToString().EndsWith("/1")) {
|
||||||
id = 1;
|
id = 1;
|
||||||
} else if (e.Topic.EndsWith("/11")) {
|
} else if (e.From.ToString().EndsWith("/11")) {
|
||||||
id = 11;
|
id = 11;
|
||||||
}
|
}
|
||||||
if (this.targetTemps.ContainsKey(id)) {
|
if (this.targetTemps.ContainsKey(id)) {
|
||||||
@ -112,6 +117,7 @@ namespace BlubbFish.House.Dashboard.Graphics {
|
|||||||
Grid outergrid = this.CreateOuterGrid();
|
Grid outergrid = this.CreateOuterGrid();
|
||||||
outergrid.Children.Add(this.CreateInnerGrid());
|
outergrid.Children.Add(this.CreateInnerGrid());
|
||||||
outergrid.Children.Add(this.CreateTextBlock());
|
outergrid.Children.Add(this.CreateTextBlock());
|
||||||
|
outergrid.Children.Add(this.CreatePopup());
|
||||||
return outergrid;
|
return outergrid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,6 +191,7 @@ namespace BlubbFish.House.Dashboard.Graphics {
|
|||||||
Background = new ImageBrush(Helper.BitmapToImageSource(Properties.Resources.graphics_heater)),
|
Background = new ImageBrush(Helper.BitmapToImageSource(Properties.Resources.graphics_heater)),
|
||||||
RenderTransform = new RotateTransform(rotate)
|
RenderTransform = new RotateTransform(rotate)
|
||||||
};
|
};
|
||||||
|
grid.MouseDown += this.Grid_MouseDown;
|
||||||
Thickness thickness = new Thickness();
|
Thickness thickness = new Thickness();
|
||||||
Boolean thicknessSet = false;
|
Boolean thicknessSet = false;
|
||||||
if (this.settings.ContainsKey("x") && Int32.TryParse(this.settings["x"], out Int32 x)) {
|
if (this.settings.ContainsKey("x") && Int32.TryParse(this.settings["x"], out Int32 x)) {
|
||||||
@ -202,5 +209,150 @@ namespace BlubbFish.House.Dashboard.Graphics {
|
|||||||
grid.ColumnDefinitions.Add(new ColumnDefinition());
|
grid.ColumnDefinitions.Add(new ColumnDefinition());
|
||||||
return grid;
|
return grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Popup CreatePopup() {
|
||||||
|
//<Popup PlacementTarget="{Binding ElementName=myWindow}" Placement="Center" PopupAnimation="Slide" IsOpen="True">
|
||||||
|
this.popup = new Popup {
|
||||||
|
Placement = PlacementMode.Center,
|
||||||
|
PopupAnimation = PopupAnimation.Slide,
|
||||||
|
PlacementTarget = this.window
|
||||||
|
};
|
||||||
|
// <Grid Background = "White" Opacity="0.8" Margin="0">
|
||||||
|
Grid outergrid = new Grid {
|
||||||
|
Background = new SolidColorBrush(Color.FromRgb(255, 255, 255)),
|
||||||
|
Opacity = 0.8,
|
||||||
|
Margin = new Thickness(0, 0, 0, 0)
|
||||||
|
};
|
||||||
|
// <Grid.RowDefinitions>
|
||||||
|
// <RowDefinition/>
|
||||||
|
// <RowDefinition/>
|
||||||
|
// <RowDefinition/>
|
||||||
|
// <RowDefinition/>
|
||||||
|
// </Grid.RowDefinitions>
|
||||||
|
outergrid.RowDefinitions.Add(new RowDefinition());
|
||||||
|
outergrid.RowDefinitions.Add(new RowDefinition());
|
||||||
|
outergrid.RowDefinitions.Add(new RowDefinition());
|
||||||
|
outergrid.RowDefinitions.Add(new RowDefinition());
|
||||||
|
// <Border BorderBrush = "Black" BorderThickness="2" Grid.RowSpan="4"/>
|
||||||
|
Border b = new Border {
|
||||||
|
BorderBrush = new SolidColorBrush(Color.FromRgb(0, 0, 0)),
|
||||||
|
BorderThickness = new Thickness(2)
|
||||||
|
};
|
||||||
|
b.SetValue(Grid.RowSpanProperty, 4);
|
||||||
|
outergrid.Children.Add(b);
|
||||||
|
// <TextBlock Text = "Heater Settings:" Margin="5" HorizontalAlignment="Center"/>
|
||||||
|
outergrid.Children.Add(new TextBlock {
|
||||||
|
Text = "Heater Settings:",
|
||||||
|
Margin = new Thickness(5),
|
||||||
|
HorizontalAlignment = HorizontalAlignment.Center
|
||||||
|
});
|
||||||
|
// <Grid Grid.Row="1" Margin= "5" >
|
||||||
|
Grid innergrid1 = new Grid {
|
||||||
|
Margin = new Thickness(5)
|
||||||
|
};
|
||||||
|
innergrid1.SetValue(Grid.RowProperty, 1);
|
||||||
|
// <Grid.ColumnDefinitions >
|
||||||
|
// <ColumnDefinition />
|
||||||
|
// <ColumnDefinition />
|
||||||
|
// <ColumnDefinition />
|
||||||
|
// </Grid.ColumnDefinitions >
|
||||||
|
innergrid1.ColumnDefinitions.Add(new ColumnDefinition());
|
||||||
|
innergrid1.ColumnDefinitions.Add(new ColumnDefinition());
|
||||||
|
innergrid1.ColumnDefinitions.Add(new ColumnDefinition());
|
||||||
|
// <TextBlock Text= "Target-Temp:" Margin= "0,0,10,0" />
|
||||||
|
innergrid1.Children.Add(new TextBlock {
|
||||||
|
Text = "Target-Temp:",
|
||||||
|
Margin = new Thickness(0, 0, 10, 0)
|
||||||
|
});
|
||||||
|
// <TextBox Grid.Column= "1" Width= "30" Text= "20" HorizontalAlignment= "Right" HorizontalContentAlignment= "Right" />
|
||||||
|
TextBox t1 = new TextBox {
|
||||||
|
Width = 30,
|
||||||
|
Text = "20",
|
||||||
|
HorizontalAlignment = HorizontalAlignment.Right,
|
||||||
|
HorizontalContentAlignment = HorizontalAlignment.Right
|
||||||
|
};
|
||||||
|
t1.SetValue(Grid.ColumnProperty, 1);
|
||||||
|
innergrid1.Children.Add(t1);
|
||||||
|
// <TextBlock Text= "°C" Grid.Column= "2" />
|
||||||
|
TextBlock tb1 = new TextBlock {
|
||||||
|
Text = "°C"
|
||||||
|
};
|
||||||
|
tb1.SetValue(Grid.ColumnProperty, 2);
|
||||||
|
innergrid1.Children.Add(tb1);
|
||||||
|
// </Grid >
|
||||||
|
outergrid.Children.Add(innergrid1);
|
||||||
|
// <Grid Grid.Row= "2" Margin= "5" HorizontalAlignment= "Center" >
|
||||||
|
Grid innergrid2 = new Grid {
|
||||||
|
Margin = new Thickness(5),
|
||||||
|
HorizontalAlignment = HorizontalAlignment.Center
|
||||||
|
};
|
||||||
|
innergrid2.SetValue(Grid.RowProperty, 2);
|
||||||
|
// <Grid.ColumnDefinitions >
|
||||||
|
// <ColumnDefinition />
|
||||||
|
// <ColumnDefinition />
|
||||||
|
// </Grid.ColumnDefinitions >
|
||||||
|
innergrid2.ColumnDefinitions.Add(new ColumnDefinition());
|
||||||
|
innergrid2.ColumnDefinitions.Add(new ColumnDefinition());
|
||||||
|
// <TextBlock Text= "Target-Mode:" Grid.Column= "0" Margin= "0,0,10,0" />
|
||||||
|
innergrid2.Children.Add(new TextBlock {
|
||||||
|
Text = "Target-Mode:",
|
||||||
|
Margin = new Thickness(0, 0, 10, 0)
|
||||||
|
});
|
||||||
|
// <ComboBox Grid.Column= "1" Width= "50" >
|
||||||
|
ComboBox cb1 = new ComboBox {
|
||||||
|
Width = 50
|
||||||
|
};
|
||||||
|
cb1.SetValue(Grid.ColumnProperty, 1);
|
||||||
|
// <ComboBoxItem Content= "Heating" />
|
||||||
|
cb1.Items.Add(new ComboBoxItem {
|
||||||
|
Content = "Heating"
|
||||||
|
});
|
||||||
|
// </ComboBox >
|
||||||
|
innergrid2.Children.Add(cb1);
|
||||||
|
// </Grid >
|
||||||
|
outergrid.Children.Add(innergrid2);
|
||||||
|
// <Grid Grid.Row= "3" Margin= "5" HorizontalAlignment= "Center" >
|
||||||
|
Grid innergrid3 = new Grid {
|
||||||
|
Margin = new Thickness(5),
|
||||||
|
HorizontalAlignment = HorizontalAlignment.Center
|
||||||
|
};
|
||||||
|
innergrid3.SetValue(Grid.RowProperty, 3);
|
||||||
|
// <Grid.ColumnDefinitions >
|
||||||
|
// <ColumnDefinition />
|
||||||
|
// <ColumnDefinition />
|
||||||
|
// </Grid.ColumnDefinitions >
|
||||||
|
innergrid3.ColumnDefinitions.Add(new ColumnDefinition());
|
||||||
|
innergrid3.ColumnDefinitions.Add(new ColumnDefinition());
|
||||||
|
// <Button Content= "Speichern" Margin= "0,0,10,0" />
|
||||||
|
Button b1 = new Button {
|
||||||
|
Content = "Speichern",
|
||||||
|
Margin = new Thickness(0, 0, 10, 0)
|
||||||
|
};
|
||||||
|
b1.Click += this.B1_Click;
|
||||||
|
innergrid3.Children.Add(b1);
|
||||||
|
// <Button Content= "Abbrechen" Grid.Column= "1" IsCancel= "True" />
|
||||||
|
Button b2 = new Button {
|
||||||
|
Content = "Abbrechen",
|
||||||
|
IsCancel = true
|
||||||
|
};
|
||||||
|
b2.SetValue(Grid.ColumnProperty, 1);
|
||||||
|
b2.Click += this.B1_Click;
|
||||||
|
innergrid3.Children.Add(b2);
|
||||||
|
// </Grid >
|
||||||
|
outergrid.Children.Add(innergrid3);
|
||||||
|
// </Grid >
|
||||||
|
this.popup.Child = outergrid;
|
||||||
|
//</Popup >
|
||||||
|
return this.popup;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Grid_MouseDown(Object sender, System.Windows.Input.MouseButtonEventArgs e) {
|
||||||
|
this.popup.IsOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void B1_Click(Object sender, RoutedEventArgs e) {
|
||||||
|
this.popup.IsOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,6 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="LitJson, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\LitJson.0.9.0\lib\LitJson.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
@ -96,7 +93,6 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<None Include="packages.config" />
|
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
@ -106,6 +102,10 @@
|
|||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\Librarys\litjson\litjson\litjson_4.7.1.csproj">
|
||||||
|
<Project>{91a14cd2-2940-4500-8193-56d37edddbaa}</Project>
|
||||||
|
<Name>litjson_4.7.1</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\Utils\IoT\Connector\Data\Mqtt\ConnectorDataMqtt.csproj">
|
<ProjectReference Include="..\..\Utils\IoT\Connector\Data\Mqtt\ConnectorDataMqtt.csproj">
|
||||||
<Project>{ee6c8f68-ed46-4c1c-abdd-cfcdf75104f2}</Project>
|
<Project>{ee6c8f68-ed46-4c1c-abdd-cfcdf75104f2}</Project>
|
||||||
<Name>ConnectorDataMqtt</Name>
|
<Name>ConnectorDataMqtt</Name>
|
||||||
|
@ -11,12 +11,12 @@
|
|||||||
<TabItem Header="Home" FontSize="20">
|
<TabItem Header="Home" FontSize="20">
|
||||||
<Grid Background="#FFE5E5E5">
|
<Grid Background="#FFE5E5E5">
|
||||||
<Image Source="E:\Eigene Dateien\Dokumente\Visual Studio 2017\Projects\House-Dashboard\House-Dashboard\bin\Debug\Images\Grundriss.png"/>
|
<Image Source="E:\Eigene Dateien\Dokumente\Visual Studio 2017\Projects\House-Dashboard\House-Dashboard\bin\Debug\Images\Grundriss.png"/>
|
||||||
<Grid HorizontalAlignment="Left" Margin="105,87,0,0" VerticalAlignment="Top">
|
<!-- <Grid HorizontalAlignment="Left" Margin="105,87,0,0" VerticalAlignment="Top">
|
||||||
<Grid.RenderTransform>
|
<Grid.RenderTransform>
|
||||||
<TransformGroup>
|
<TransformGroup>
|
||||||
<ScaleTransform/>
|
<ScaleTransform/>
|
||||||
<SkewTransform/>
|
<SkewTransform/>
|
||||||
<RotateTransform Angle="90"/>
|
<RotateTransform Angle="0"/>
|
||||||
<TranslateTransform/>
|
<TranslateTransform/>
|
||||||
</TransformGroup>
|
</TransformGroup>
|
||||||
</Grid.RenderTransform>
|
</Grid.RenderTransform>
|
||||||
@ -36,8 +36,50 @@
|
|||||||
<TextBlock HorizontalAlignment="Center" Text="Mode" VerticalAlignment="Top" Grid.Row="1" FontSize="12"/>
|
<TextBlock HorizontalAlignment="Center" Text="Mode" VerticalAlignment="Top" Grid.Row="1" FontSize="12"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<TextBlock HorizontalAlignment="Left" Text="99 °C" VerticalAlignment="Top" Grid.Column="1" FontWeight="Bold" FontSize="28" Margin="5,0,10,0"/>
|
<TextBlock HorizontalAlignment="Left" Text="99 °C" VerticalAlignment="Top" Grid.Column="1" FontWeight="Bold" FontSize="28" Margin="5,0,10,0"/>
|
||||||
|
<Popup PlacementTarget="{Binding ElementName=myWindow}" Placement="Center" PopupAnimation="Slide" IsOpen="True">
|
||||||
|
<Grid Background="White" Opacity="0.8" Margin="0">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border BorderBrush="Black" BorderThickness="2" Grid.RowSpan="4"/>
|
||||||
|
<TextBlock Text="Heater Settings:" Margin="5" HorizontalAlignment="Center"/>
|
||||||
|
<Grid Grid.Row="1" Margin="5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="Target-Temp:" Grid.Column="0" Margin="0,0,10,0" />
|
||||||
|
<TextBox Grid.Column="1" Width="30" Text="20" HorizontalAlignment="Right" HorizontalContentAlignment="Right"/>
|
||||||
|
<TextBlock Text="°C" Grid.Column="2" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<Grid Grid.Row="2" Margin="5" HorizontalAlignment="Center">
|
||||||
|
<Grid.ContextMenu>
|
||||||
|
<ContextMenu/>
|
||||||
|
</Grid.ContextMenu>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="Target-Mode:" Grid.Column="0" Margin="0,0,10,0" />
|
||||||
|
<ComboBox Grid.Column="1" Width="50" >
|
||||||
|
<ComboBoxItem Content="Heating"/>
|
||||||
|
</ComboBox>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="3" Margin="5" HorizontalAlignment="Center">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Button Content="Speichern" Margin="0,0,10,0" />
|
||||||
|
<Button Content="Abbrechen" Grid.Column="1" IsCancel="True" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Popup>
|
||||||
|
</Grid> -->
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
@ -76,12 +118,6 @@
|
|||||||
<Button Content="Beenden" Click="ApplicationShutdown"/>
|
<Button Content="Beenden" Click="ApplicationShutdown"/>
|
||||||
</StatusBarItem>
|
</StatusBarItem>
|
||||||
</StatusBar>
|
</StatusBar>
|
||||||
<Popup PlacementTarget="{Binding ElementName=myWindow}" Placement="Center" PopupAnimation="Slide" IsOpen="True">
|
<!-- -->
|
||||||
<Grid Background="White">
|
|
||||||
<Border BorderBrush="Black" BorderThickness="1"/>
|
|
||||||
<TextBlock Text="asdasdasd"/>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</Popup>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -17,13 +17,14 @@ using System.Windows.Shapes;
|
|||||||
using BlubbFish.House.Dashboard.Functions;
|
using BlubbFish.House.Dashboard.Functions;
|
||||||
using BlubbFish.Utils;
|
using BlubbFish.Utils;
|
||||||
using BlubbFish.Utils.IoT.Connector;
|
using BlubbFish.Utils.IoT.Connector;
|
||||||
|
using BlubbFish.Utils.IoT.Events;
|
||||||
|
|
||||||
namespace House_Dashboard {
|
namespace House_Dashboard {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaktionslogik für MainWindow.xaml
|
/// Interaktionslogik für MainWindow.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MainWindow : Window {
|
public partial class MainWindow : Window {
|
||||||
private ADataBackend mqtt;
|
private ABackend mqtt;
|
||||||
private Workload workload;
|
private Workload workload;
|
||||||
|
|
||||||
public MainWindow() {
|
public MainWindow() {
|
||||||
@ -44,7 +45,7 @@ namespace House_Dashboard {
|
|||||||
if(File.Exists("tabs.ini")) {
|
if(File.Exists("tabs.ini")) {
|
||||||
foreach (String item in InIReader.GetInstance("tabs.ini").GetSections()) {
|
foreach (String item in InIReader.GetInstance("tabs.ini").GetSections()) {
|
||||||
if(InIReader.GetInstance("tabs.ini").GetValue(item, "settings") != null && File.Exists(InIReader.GetInstance("tabs.ini").GetValue(item, "settings"))) {
|
if(InIReader.GetInstance("tabs.ini").GetValue(item, "settings") != null && File.Exists(InIReader.GetInstance("tabs.ini").GetValue(item, "settings"))) {
|
||||||
this.tabs.Items.Add(new Tabs(InIReader.GetInstance(InIReader.GetInstance("tabs.ini").GetValue(item, "settings")), this.mqtt).GetTab());
|
this.tabs.Items.Add(new Tabs(InIReader.GetInstance(InIReader.GetInstance("tabs.ini").GetValue(item, "settings")), this.mqtt).GetTab(this.myWindow));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -55,7 +56,7 @@ namespace House_Dashboard {
|
|||||||
|
|
||||||
private void InitMqtt() {
|
private void InitMqtt() {
|
||||||
if(File.Exists("mqtt.ini")) {
|
if(File.Exists("mqtt.ini")) {
|
||||||
this.mqtt = ADataBackend.GetInstance(InIReader.GetInstance("mqtt.ini").GetSection("settings"));
|
this.mqtt = ABackend.GetInstance(InIReader.GetInstance("mqtt.ini").GetSection("settings"), ABackend.BackendType.Data);
|
||||||
if(this.mqtt == null) {
|
if(this.mqtt == null) {
|
||||||
MessageBox.Show("Der Mqtt Treiber konnte nicht geladen werden.", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Der Mqtt Treiber konnte nicht geladen werden.", "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
this.ApplicationShutdown(null, null);
|
this.ApplicationShutdown(null, null);
|
||||||
@ -73,7 +74,7 @@ namespace House_Dashboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void IncommingData(Object sender, MqttEventArgs e) {
|
private void IncommingData(Object sender, BackendEvent e) {
|
||||||
this.workload.SetMessage(e);
|
this.workload.SetMessage(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="LitJson" version="0.9.0" targetFramework="net471" />
|
|
||||||
</packages>
|
|
Loading…
Reference in New Issue
Block a user