commit 08868a1c2e8feb439d96643edadd788ed6404814 Author: BlubbFish Date: Mon Jan 1 15:03:15 2018 +0000 House-Dashboard hinzugefügt diff --git a/House-Dashboard.sln b/House-Dashboard.sln new file mode 100644 index 0000000..b3646fc --- /dev/null +++ b/House-Dashboard.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27004.2010 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "House-Dashboard", "House-Dashboard\House-Dashboard.csproj", "{D1D4B67E-7BEB-4EDB-9D40-E29F0BE078C4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils\IoT\Utils-IoT.csproj", "{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectorDataMqtt", "..\Utils\IoT\Connector\Data\Mqtt\ConnectorDataMqtt.csproj", "{EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D1D4B67E-7BEB-4EDB-9D40-E29F0BE078C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1D4B67E-7BEB-4EDB-9D40-E29F0BE078C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D1D4B67E-7BEB-4EDB-9D40-E29F0BE078C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1D4B67E-7BEB-4EDB-9D40-E29F0BE078C4}.Release|Any CPU.Build.0 = Release|Any CPU + {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.Build.0 = Release|Any CPU + {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Release|Any CPU.Build.0 = Release|Any CPU + {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.ActiveCfg = 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.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {85D9EA74-4174-4FF9-A623-EB89DE84C01D} + EndGlobalSection +EndGlobal diff --git a/House-Dashboard/App.config b/House-Dashboard/App.config new file mode 100644 index 0000000..d562936 --- /dev/null +++ b/House-Dashboard/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/House-Dashboard/App.xaml b/House-Dashboard/App.xaml new file mode 100644 index 0000000..45088f4 --- /dev/null +++ b/House-Dashboard/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/House-Dashboard/App.xaml.cs b/House-Dashboard/App.xaml.cs new file mode 100644 index 0000000..a1099b1 --- /dev/null +++ b/House-Dashboard/App.xaml.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace House_Dashboard { + /// + /// Interaktionslogik für "App.xaml" + /// + public partial class App : Application { + } +} diff --git a/House-Dashboard/Functions/Tabs.cs b/House-Dashboard/Functions/Tabs.cs new file mode 100644 index 0000000..8ad4025 --- /dev/null +++ b/House-Dashboard/Functions/Tabs.cs @@ -0,0 +1,72 @@ +using System; +using System.Net.Cache; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using BlubbFish.Utils; + +namespace BlubbFish.House.Dashboard.Functions { + class Tabs { + private InIReader ini; + private TabItem tab; + + public Tabs(InIReader settings) { + this.ini = settings; + } + + internal TabItem GetTab() { + this.tab = new TabItem(); + this.GenerateHeader(); + this.GenerateContent(); + return this.tab; + } + + private void GenerateContent() { + Grid g = new Grid(); + g.Background = new BrushConverter().ConvertFromString("#FFE5E5E5") as SolidColorBrush; + if(this.ini.GetValue("general", "background-image") != null) { + BitmapImage bitmap = new BitmapImage(); + bitmap.BeginInit(); + bitmap.CacheOption = BitmapCacheOption.None; + bitmap.UriCachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache); + bitmap.CacheOption = BitmapCacheOption.OnLoad; + bitmap.CreateOptions = BitmapCreateOptions.IgnoreImageCache; + bitmap.UriSource = new Uri(this.ini.GetValue("general", "background-image"), UriKind.RelativeOrAbsolute); + bitmap.EndInit(); + Image bgimage = new Image { + Source = bitmap + }; + g.Children.Add(bgimage); + } + this.tab.Content = g; + } + + private void GenerateHeader() { + StackPanel header = new StackPanel { + Orientation = Orientation.Horizontal + }; + if (this.ini.GetValue("general", "icon") != null) { + BitmapImage bitmap = new BitmapImage(); + bitmap.BeginInit(); + bitmap.CacheOption = BitmapCacheOption.None; + bitmap.UriCachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache); + bitmap.CacheOption = BitmapCacheOption.OnLoad; + bitmap.CreateOptions = BitmapCreateOptions.IgnoreImageCache; + bitmap.UriSource = new Uri(this.ini.GetValue("general", "icon"), UriKind.RelativeOrAbsolute); + bitmap.EndInit(); + Image image = new Image { + Source = bitmap + }; + header.Children.Add(image); + } + if (this.ini.GetValue("general", "name") != null) { + TextBlock t = new TextBlock { + Text = this.ini.GetValue("general", "name"), + FontSize = 20 + }; + header.Children.Add(t); + } + this.tab.Header = header; + } + } +} diff --git a/House-Dashboard/Functions/Workload.cs b/House-Dashboard/Functions/Workload.cs new file mode 100644 index 0000000..22b1aa5 --- /dev/null +++ b/House-Dashboard/Functions/Workload.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BlubbFish.Utils.IoT.Connector; + +namespace BlubbFish.House.Dashboard.Functions { + class Workload { + private SortedDictionary list = new SortedDictionary(); + + public delegate void WorkloadEvent(Object sender, EventArgs e); + public event WorkloadEvent Update; + + public Int32 Maximum { get; private set; } + public Int32 Now { get; private set; } + + internal void SetMessage(MqttEventArgs e) { + DateTime d = DateTime.Now; + if (this.list.ContainsKey(d)) { + return; + } + this.list.Add(d, e); + DateTime old = DateTime.Now.AddSeconds(-30); + List remove = new List(); + foreach (KeyValuePair item in this.list) { + if(item.Key < old) { + remove.Add(item.Key); + } + } + foreach (DateTime item in remove) { + this.list.Remove(item); + } + if(this.list.Count > this.Maximum) { + this.Maximum = this.list.Count; + } + this.Now = this.list.Count; + this.Update?.Invoke(this, null); + } + } +} diff --git a/House-Dashboard/House-Dashboard.csproj b/House-Dashboard/House-Dashboard.csproj new file mode 100644 index 0000000..5322e20 --- /dev/null +++ b/House-Dashboard/House-Dashboard.csproj @@ -0,0 +1,114 @@ + + + + + Debug + AnyCPU + {D1D4B67E-7BEB-4EDB-9D40-E29F0BE078C4} + WinExe + BlubbFish.House.Dashboard + Dashboard + v4.7.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + {ee6c8f68-ed46-4c1c-abdd-cfcdf75104f2} + ConnectorDataMqtt + + + {b870e4d5-6806-4a0b-b233-8907eedc5afc} + Utils-IoT + + + {fac8ce64-bf13-4ece-8097-aeb5dd060098} + Utils + + + + \ No newline at end of file diff --git a/House-Dashboard/MainWindow.xaml b/House-Dashboard/MainWindow.xaml new file mode 100644 index 0000000..85bdce4 --- /dev/null +++ b/House-Dashboard/MainWindow.xaml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +