[NF] Debugmode eingebaut
This commit is contained in:
parent
e3bafaf014
commit
7f0de5503f
@ -61,6 +61,8 @@ namespace Dashboard.Connector {
|
|||||||
send.StartInfo.Arguments = args + "-m \""+data.Replace("\"","\\\"")+"\" -t \""+topic+"\" -d";
|
send.StartInfo.Arguments = args + "-m \""+data.Replace("\"","\\\"")+"\" -t \""+topic+"\" -d";
|
||||||
send.StartInfo.CreateNoWindow = true;
|
send.StartInfo.CreateNoWindow = true;
|
||||||
send.StartInfo.UseShellExecute = false;
|
send.StartInfo.UseShellExecute = false;
|
||||||
|
send.StartInfo.RedirectStandardOutput = true;
|
||||||
|
send.StartInfo.RedirectStandardError = true;
|
||||||
send.Start();
|
send.Start();
|
||||||
send.WaitForExit();
|
send.WaitForExit();
|
||||||
MessageSending?.Invoke(this, new MqttEventArgs(data, topic));
|
MessageSending?.Invoke(this, new MqttEventArgs(data, topic));
|
||||||
|
9
Mqtt-Dashboard/Dashboard.csproj.user
Normal file
9
Mqtt-Dashboard/Dashboard.csproj.user
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||||
|
<StartArguments>-debug</StartArguments>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||||
|
<StartArguments>-debug</StartArguments>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
@ -10,7 +10,7 @@ namespace Dashboard {
|
|||||||
public partial class Dashboard : Form {
|
public partial class Dashboard : Form {
|
||||||
private Dictionary<String, ASensor> sensors = new Dictionary<String, ASensor>();
|
private Dictionary<String, ASensor> sensors = new Dictionary<String, ASensor>();
|
||||||
|
|
||||||
public Dashboard() {
|
public Dashboard(Boolean debug) {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ADataBackend.SetInstance(InIReader.GetInstance("settings.ini").GetSection("mqtt"));
|
ADataBackend.SetInstance(InIReader.GetInstance("settings.ini").GetSection("mqtt"));
|
||||||
|
|
||||||
@ -20,9 +20,11 @@ namespace Dashboard {
|
|||||||
this.FormClosed += this.Dashboard_FormClosed;
|
this.FormClosed += this.Dashboard_FormClosed;
|
||||||
this.SizeChanged += this.Dashboard_SizeChanged;
|
this.SizeChanged += this.Dashboard_SizeChanged;
|
||||||
|
|
||||||
|
if (debug) {
|
||||||
ADataBackend.Instance.MessageIncomming += this.Instance_MessageIncomming;
|
ADataBackend.Instance.MessageIncomming += this.Instance_MessageIncomming;
|
||||||
ADataBackend.Instance.MessageSending += this.Instance_MessageSending;
|
ADataBackend.Instance.MessageSending += this.Instance_MessageSending;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Dashboard_SizeChanged(Object sender, EventArgs e) {
|
private void Dashboard_SizeChanged(Object sender, EventArgs e) {
|
||||||
this.flowLayoutPanel2.Size = new System.Drawing.Size(this.Size.Width - 40, this.Size.Width - 76);
|
this.flowLayoutPanel2.Size = new System.Drawing.Size(this.Size.Width - 40, this.Size.Width - 76);
|
||||||
@ -58,11 +60,11 @@ namespace Dashboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void Instance_MessageIncomming(Object sender, MqttEventArgs e) {
|
private void Instance_MessageIncomming(Object sender, MqttEventArgs e) {
|
||||||
System.Diagnostics.Debug.WriteLine("Received = " + e.Message + " on topic " + e.Topic+" at "+DateTime.Now.ToUniversalTime());
|
Console.WriteLine("Received = " + e.Message + " on topic " + e.Topic+" at "+DateTime.Now.ToUniversalTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Instance_MessageSending(Object sender, MqttEventArgs e) {
|
private void Instance_MessageSending(Object sender, MqttEventArgs e) {
|
||||||
System.Diagnostics.Debug.WriteLine("Sended = " + e.Message + " on topic " + e.Topic + " at " + DateTime.Now.ToUniversalTime());
|
Console.WriteLine("Sended = " + e.Message + " on topic " + e.Topic + " at " + DateTime.Now.ToUniversalTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using BlubbFish.Utils;
|
||||||
|
|
||||||
namespace Dashboard {
|
namespace Dashboard {
|
||||||
static class Program {
|
static class Program {
|
||||||
@ -7,10 +9,18 @@ namespace Dashboard {
|
|||||||
/// Der Haupteinstiegspunkt für die Anwendung.
|
/// Der Haupteinstiegspunkt für die Anwendung.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main() {
|
static void Main(String[] args) {
|
||||||
|
Dictionary<String, CmdArgs.VaildArguments> pargs = new Dictionary<String, CmdArgs.VaildArguments> {
|
||||||
|
{ "-debug", new CmdArgs.VaildArguments(CmdArgs.ArgLength.Single) }
|
||||||
|
};
|
||||||
|
CmdArgs.Instance.SetArguments(pargs, args);
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
Application.Run(new Dashboard());
|
Boolean debug = false;
|
||||||
|
if(CmdArgs.Instance.HasArgumentType("-debug")) {
|
||||||
|
debug = true;
|
||||||
|
}
|
||||||
|
Application.Run(new Dashboard(debug));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user