Feature: see log button

This commit is contained in:
Szymon Porwolik
2021-02-17 23:33:33 +01:00
parent dfe16df3cc
commit 0050f5fab5
4 changed files with 31 additions and 0 deletions

View File

@@ -78,6 +78,8 @@ internal class Globals
public static string VersionDatabase = ""; // Version - Database public static string VersionDatabase = ""; // Version - Database
public static string VersionPerun = "DEBUG"; // Version - Perun public static string VersionPerun = "DEBUG"; // Version - Perun
public static string LastLogLocation = ""; // Last used log location
public static CurrentMissionClass CurrentMission = new CurrentMissionClass(); // Actual mission information single ton public static CurrentMissionClass CurrentMission = new CurrentMissionClass(); // Actual mission information single ton
public static HardwareMonitorClass HardwareMonitor = new HardwareMonitorClass(); // Hardware monitor singleton public static HardwareMonitorClass HardwareMonitor = new HardwareMonitorClass(); // Hardware monitor singleton

View File

@@ -51,6 +51,7 @@ class LogController
LogStreamWriter = new StreamWriter(LogFileStream); LogStreamWriter = new StreamWriter(LogFileStream);
LogStreamWriter.WriteLine(strLog); LogStreamWriter.WriteLine(strLog);
LogStreamWriter.Close(); LogStreamWriter.Close();
Globals.LastLogLocation = LogFilePath;
} }
catch catch
{ {

View File

@@ -100,6 +100,7 @@
this.label27 = new System.Windows.Forms.Label(); this.label27 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label(); this.label20 = new System.Windows.Forms.Label();
this.tim_HW_status = new System.Windows.Forms.Timer(this.components); this.tim_HW_status = new System.Windows.Forms.Timer(this.components);
this.con_Button_See_log = new System.Windows.Forms.Button();
this.con_GroupBox_1.SuspendLayout(); this.con_GroupBox_1.SuspendLayout();
this.con_GroupBox_2.SuspendLayout(); this.con_GroupBox_2.SuspendLayout();
this.con_GroupBox_3.SuspendLayout(); this.con_GroupBox_3.SuspendLayout();
@@ -149,6 +150,7 @@
// //
// con_GroupBox_1 // con_GroupBox_1
// //
this.con_GroupBox_1.Controls.Add(this.con_Button_See_log);
this.con_GroupBox_1.Controls.Add(this.label15); this.con_GroupBox_1.Controls.Add(this.label15);
this.con_GroupBox_1.Controls.Add(this.con_com_loglevel); this.con_GroupBox_1.Controls.Add(this.con_com_loglevel);
this.con_GroupBox_1.Controls.Add(this.con_List_Received); this.con_GroupBox_1.Controls.Add(this.con_List_Received);
@@ -802,6 +804,18 @@
this.tim_HW_status.Interval = 1000; this.tim_HW_status.Interval = 1000;
this.tim_HW_status.Tick += new System.EventHandler(this.tim_HW_status_Tick); this.tim_HW_status.Tick += new System.EventHandler(this.tim_HW_status_Tick);
// //
// con_Button_See_log
//
this.con_Button_See_log.Enabled = false;
this.con_Button_See_log.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.con_Button_See_log.Location = new System.Drawing.Point(170, 12);
this.con_Button_See_log.Name = "con_Button_See_log";
this.con_Button_See_log.Size = new System.Drawing.Size(56, 20);
this.con_Button_See_log.TabIndex = 24;
this.con_Button_See_log.Text = "See log";
this.con_Button_See_log.UseVisualStyleBackColor = true;
this.con_Button_See_log.Click += new System.EventHandler(this.con_Button_See_log_Click);
//
// form_Main // form_Main
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -930,6 +944,7 @@
private System.Windows.Forms.Label label27; private System.Windows.Forms.Label label27;
private System.Windows.Forms.Label label20; private System.Windows.Forms.Label label20;
private System.Windows.Forms.Timer tim_HW_status; private System.Windows.Forms.Timer tim_HW_status;
private System.Windows.Forms.Button con_Button_See_log;
} }
} }

View File

@@ -504,6 +504,12 @@ namespace Perun_v1
// Do nothing , control does not require update // Do nothing , control does not require update
} }
// Enable see log button
if(Globals.LastLogLocation != "")
{
con_Button_See_log.Enabled = true;
}
// Update mission status // Update mission status
if (Globals.CurrentMission.Mission != "") if (Globals.CurrentMission.Mission != "")
{ {
@@ -763,5 +769,12 @@ namespace Perun_v1
con_Button_Listen_ON_Click(sender, e); // Simulate button click con_Button_Listen_ON_Click(sender, e); // Simulate button click
} }
private void con_Button_See_log_Click(object sender, EventArgs e)
{
if (Globals.LastLogLocation != "")
{
Process.Start(Globals.LastLogLocation);
}
}
} }
} }