[NF] Aufgeräumt

This commit is contained in:
BlubbFish 2017-10-02 16:22:01 +00:00
parent 29f3ef8a40
commit 8b92d64d38
16 changed files with 67 additions and 70 deletions

View File

@ -1,12 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.7
VisualStudioVersion = 15.0.26730.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dashboard", "Mqtt-Dashboard\Dashboard.csproj", "{16AC0F61-0B60-4A1D-A827-B3BFDBA9AAC7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils\IoT\Utils-IoT.csproj", "{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -21,8 +23,15 @@ Global
{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
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1B2A7AC0-6D12-415F-89CF-9C5AFADDD227}
EndGlobalSection
EndGlobal

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup>
</configuration>

View File

@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>Dashboard</RootNamespace>
<AssemblyName>Dashboard</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<PublishUrl>publish\</PublishUrl>
@ -26,6 +26,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -50,12 +51,6 @@
<StartupObject />
</PropertyGroup>
<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="M2Mqtt.Net, Version=4.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\M2Mqtt.4.3.0.0\lib\net45\M2Mqtt.Net.dll</HintPath>
</Reference>
<Reference Include="OxyPlot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=638079a8f0bd61e9, processorArchitecture=MSIL">
<HintPath>..\packages\OxyPlot.Core.1.0.0\lib\net45\OxyPlot.dll</HintPath>
</Reference>
@ -67,7 +62,6 @@
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
@ -76,9 +70,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Connector\ADataBackend.cs" />
<Compile Include="Connector\Mosquitto.cs" />
<Compile Include="Connector\Mqtt.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
@ -87,11 +78,6 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sensor\ASensor.cs" />
<Compile Include="Sensor\Flex4GridPower.cs" />
<Compile Include="Sensor\Power.cs" />
<Compile Include="Sensor\Flex4GridSwitch.cs" />
<Compile Include="Sensor\Switch.cs" />
<Compile Include="Tracings\ATracings.cs" />
<Compile Include="Tracings\Graph.cs" />
<Compile Include="Tracings\Meter.cs" />
@ -128,6 +114,10 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Utils\IoT\Utils-IoT.csproj">
<Project>{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}</Project>
<Name>Utils-IoT</Name>
</ProjectReference>
<ProjectReference Include="..\..\Utils\Utils\Utils.csproj">
<Project>{fac8ce64-bf13-4ece-8097-aeb5dd060098}</Project>
<Name>Utils</Name>

View File

@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.Windows.Forms;
using BlubbFish.Utils;
using IoTBot.Connector;
using IoTBot.Sensor;
using Dashboard.Tracings;
using BlubbFish.Utils.IoT.Sensor;
using BlubbFish.Utils.IoT.Connector;
namespace Dashboard {
public partial class Dashboard : Form {

View File

@ -19,7 +19,7 @@ namespace Dashboard.Properties {
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {

View File

@ -12,7 +12,7 @@ namespace Dashboard.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View File

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using IoTBot.Sensor;
using BlubbFish.Utils.IoT.Sensor;
namespace Dashboard.Tracings {
public abstract class ATracings {
@ -22,8 +22,8 @@ namespace Dashboard.Tracings {
this.settings = settings;
}
protected abstract void SensorsUpdate(ASensor sender, EventArgs e);
protected abstract void SensorUpdate(ASensor sender, EventArgs e);
protected abstract void SensorsUpdate(Object sender, EventArgs e);
protected abstract void SensorUpdate(Object sender, EventArgs e);
public abstract Panel GetPanel();
internal static ATracings GetInstance(String v, Dictionary<String, ASensor> sensorList, Dictionary<String, String> dictionary) {
String object_sensor = "Dashboard.Tracings." + Char.ToUpper(v[0]) + v.Substring(1);

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using IoTBot.Sensor;
using BlubbFish.Utils.IoT.Sensor;
using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.Series;
@ -68,14 +68,14 @@ namespace Dashboard.Tracings {
panel.Size = new System.Drawing.Size(fieldWidth, 200);
return panel;
}
protected override void SensorUpdate(ASensor sender, EventArgs e) {
protected override void SensorUpdate(Object sender, EventArgs e) {
Single v = 0;
switch (sender.Datatypes) {
case ASensor.Types.Bool: v = sender.GetBool ? 1 : 0; break;
case ASensor.Types.Int: v = sender.GetInt; break;
case ASensor.Types.Float: v = sender.GetFloat; break;
switch (((ASensor)sender).Datatypes) {
case ASensor.Types.Bool: v = ((ASensor)sender).GetBool ? 1 : 0; break;
case ASensor.Types.Int: v = ((ASensor)sender).GetInt; break;
case ASensor.Types.Float: v = ((ASensor)sender).GetFloat; break;
}
this.hist.Enqueue(new Tuple<DateTime, Single>(sender.Timestamp, v));
this.hist.Enqueue(new Tuple<DateTime, Single>(((ASensor)sender).Timestamp, v));
if (this.MaximumDrawn < v) {
this.MaximumDrawn = v;
}
@ -86,7 +86,7 @@ namespace Dashboard.Tracings {
this.plot.BeginInvoke((MethodInvoker)delegate {
this.Model.Axes[1].Maximum = this.MaximumDrawn * 1.1;
this.Model.Axes[1].AbsoluteMaximum = this.MaximumDrawn * 1.1;
this.Model.Axes[0].AbsoluteMaximum = DateTimeAxis.ToDouble(sender.Timestamp);
this.Model.Axes[0].AbsoluteMaximum = DateTimeAxis.ToDouble(((ASensor)sender).Timestamp);
((LineSeries)this.Model.Series[0]).Points.Clear();
try {
foreach(Tuple<DateTime, Single> temp in this.hist) {
@ -98,26 +98,26 @@ namespace Dashboard.Tracings {
}
}
protected override void SensorsUpdate(ASensor sender, EventArgs e) {
protected override void SensorsUpdate(Object sender, EventArgs e) {
Single v = 0;
if (!this.hists.ContainsKey(sender.Name)) {
this.hists.Add(sender.Name, new Queue<Tuple<DateTime, Single>>());
this.hists_last.Add(sender.Name, 0);
if (!this.hists.ContainsKey(((ASensor)sender).Name)) {
this.hists.Add(((ASensor)sender).Name, new Queue<Tuple<DateTime, Single>>());
this.hists_last.Add(((ASensor)sender).Name, 0);
}
switch (sender.Datatypes) {
switch (((ASensor)sender).Datatypes) {
case ASensor.Types.Bool:
v = sender.GetBool ? 1 : 0;
v = ((ASensor)sender).GetBool ? 1 : 0;
break;
case ASensor.Types.Int:
v = sender.GetInt;
v = ((ASensor)sender).GetInt;
break;
case ASensor.Types.Float:
v = sender.GetFloat;
v = ((ASensor)sender).GetFloat;
break;
}
this.hists_last[sender.Name] = v;
this.hists_last[((ASensor)sender).Name] = v;
foreach (KeyValuePair<String, Queue<Tuple<DateTime, Single>>> item in this.hists) {
item.Value.Enqueue(new Tuple<DateTime, Single>(sender.Timestamp, this.hists_last[item.Key]));
item.Value.Enqueue(new Tuple<DateTime, Single>(((ASensor)sender).Timestamp, this.hists_last[item.Key]));
if (this.MaximumDrawn < this.hists_last[item.Key]) {
this.MaximumDrawn = this.hists_last[item.Key];
}
@ -131,7 +131,7 @@ namespace Dashboard.Tracings {
try {
this.Model.Axes[1].Maximum = this.MaximumDrawn * 1.1;
this.Model.Axes[1].AbsoluteMaximum = this.MaximumDrawn * 1.1;
this.Model.Axes[0].AbsoluteMaximum = DateTimeAxis.ToDouble(sender.Timestamp);
this.Model.Axes[0].AbsoluteMaximum = DateTimeAxis.ToDouble(((ASensor)sender).Timestamp);
((LineSeries)item).Points.Clear();
foreach (Tuple<DateTime, Single> temp in this.hists[item.TrackerKey]) {
((LineSeries)item).Points.Add(new DataPoint(DateTimeAxis.ToDouble(temp.Item1), temp.Item2));

View File

@ -1,9 +1,9 @@
using System.Collections.Generic;
using IoTBot.Sensor;
using System;
using System.Windows.Forms;
using System.Linq;
using System.Globalization;
using BlubbFish.Utils.IoT.Sensor;
namespace Dashboard.Tracings {
class Meter : ATracings {
@ -45,16 +45,16 @@ namespace Dashboard.Tracings {
return panel;
}
protected override void SensorsUpdate(ASensor sender, EventArgs e) {
protected override void SensorsUpdate(Object sender, EventArgs e) {
throw new NotImplementedException();
}
protected override void SensorUpdate(ASensor sender, EventArgs e) {
protected override void SensorUpdate(Object sender, EventArgs e) {
String value = "";
switch(sender.Datatypes) {
case ASensor.Types.Bool: this.DisplayAverage.Enqueue((sender.GetBool) ? 1 : 0); value = sender.GetBool.ToString(new CultureInfo("de-DE")); break;
case ASensor.Types.Int: this.DisplayAverage.Enqueue(sender.GetInt); value = sender.GetInt.ToString(); break;
case ASensor.Types.Float: this.DisplayAverage.Enqueue(sender.GetFloat); value = sender.GetFloat.ToString(new CultureInfo("de-DE")); break;
switch(((ASensor)sender).Datatypes) {
case ASensor.Types.Bool: this.DisplayAverage.Enqueue((((ASensor)sender).GetBool) ? 1 : 0); value = ((ASensor)sender).GetBool.ToString(new CultureInfo("de-DE")); break;
case ASensor.Types.Int: this.DisplayAverage.Enqueue(((ASensor)sender).GetInt); value = ((ASensor)sender).GetInt.ToString(); break;
case ASensor.Types.Float: this.DisplayAverage.Enqueue(((ASensor)sender).GetFloat); value = ((ASensor)sender).GetFloat.ToString(new CultureInfo("de-DE")); break;
}
if(this.DisplayAverage.Count > this.DisplayItems) {
this.DisplayAverage.Dequeue();

View File

@ -3,26 +3,26 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows.Forms;
using IoTBot.Sensor;
using BlubbFish.Utils.IoT.Sensor;
namespace Dashboard.Tracings {
class Powermeter : Meter {
public Powermeter(ASensor sensor, Dictionary<String, String> settings) : base(sensor, settings) {
}
protected override void SensorUpdate(ASensor sender, EventArgs e) {
protected override void SensorUpdate(Object sender, EventArgs e) {
String value = "";
switch (sender.Datatypes) {
switch (((ASensor)sender).Datatypes) {
case ASensor.Types.Bool:
this.DisplayAverage.Enqueue((sender.GetBool) ? 1 : 0);
value = sender.GetBool.ToString(new CultureInfo("de-DE"));
this.DisplayAverage.Enqueue((((ASensor)sender).GetBool) ? 1 : 0);
value = ((ASensor)sender).GetBool.ToString(new CultureInfo("de-DE"));
break;
case ASensor.Types.Int:
this.DisplayAverage.Enqueue(sender.GetInt);
value = sender.GetInt.ToString();
this.DisplayAverage.Enqueue(((ASensor)sender).GetInt);
value = ((ASensor)sender).GetInt.ToString();
break;
case ASensor.Types.Float:
this.DisplayAverage.Enqueue(sender.GetFloat);
value = sender.GetFloat.ToString(new CultureInfo("de-DE"));
this.DisplayAverage.Enqueue(((ASensor)sender).GetFloat);
value = ((ASensor)sender).GetFloat.ToString(new CultureInfo("de-DE"));
break;
}
if (this.DisplayAverage.Count > this.DisplayItems) {

View File

@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using IoTBot.Connector;
using IoTBot.Sensor;
using BlubbFish.Utils.IoT.Sensor;
namespace Dashboard.Tracings {
class Switcher : ATracings {
@ -65,19 +63,19 @@ namespace Dashboard.Tracings {
}
}
protected override void SensorUpdate(ASensor sender, EventArgs e) {
protected override void SensorUpdate(Object sender, EventArgs e) {
this.label.BeginInvoke((MethodInvoker)delegate {
this.label.Text = sender.GetBool?"Eingeschaltet":"Ausgeschaltet";
this.label.Text = ((ASensor)sender).GetBool?"Eingeschaltet":"Ausgeschaltet";
});
this.button1.BeginInvoke((MethodInvoker)delegate {
this.button1.Enabled = !sender.GetBool;
this.button1.Enabled = !((ASensor)sender).GetBool;
});
this.button2.BeginInvoke((MethodInvoker)delegate {
this.button2.Enabled = sender.GetBool;
this.button2.Enabled = ((ASensor)sender).GetBool;
});
}
protected override void SensorsUpdate(ASensor sender, EventArgs e) {
protected override void SensorsUpdate(Object sender, EventArgs e) {
throw new NotImplementedException();
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.