Skip to content

Commit

Permalink
Improved WinForms Classes; fixed form drag;added using(){}
Browse files Browse the repository at this point in the history
  • Loading branch information
Cale-Torino committed Mar 7, 2022
1 parent fb7f382 commit 56f36e5
Show file tree
Hide file tree
Showing 16 changed files with 106 additions and 102 deletions.
Binary file not shown.
Binary file modified WinForms/.vs/FreeTAKServer_Manager/v16/.suo
Binary file not shown.
2 changes: 1 addition & 1 deletion WinForms/FreeTAKServer_Manager/Classes/CMD_Class.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace FreeTAKServer_Manager
{


class CMD_Class
public static class CMD_Class
{
public static class CMD_Instance
{
Expand Down
8 changes: 3 additions & 5 deletions WinForms/FreeTAKServer_Manager/Classes/CMD_PID_Class.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
namespace FreeTAKServer_Manager
{
static class CMD_PID_Class
public static class CMD_PID_Class
{
public static int _ServerPIDVar//Server cmd windo PID var
{ get; set; }
public static int _UIPIDVar//UI cmd window PID var
{ get; set; }
public static int _ServerPIDVar { get; set; }//Server cmd windo PID var
public static int _UIPIDVar { get; set; }//UI cmd window PID var
}
}
2 changes: 1 addition & 1 deletion WinForms/FreeTAKServer_Manager/Classes/EncryptionClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace FreeTAKServer_Manager
{
class EncryptionClass
public static class EncryptionClass
{
static byte[] entropy = Encoding.Unicode.GetBytes("15021375505qpwoeirutyalskdjfhgmznxbcv");//salt

Expand Down
7 changes: 3 additions & 4 deletions WinForms/FreeTAKServer_Manager/Classes/LoggerClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

namespace FreeTAKServer_Manager
{
class LoggerClass
public static class LoggerClass
{
public static class Logger
{

//Create logfile log. file
private static string LogFile = Application.StartupPath + @"\Logs\FreeTAKServer_Manager_" + DateTime.Now.ToString("yyyy-dd-M--HH-mm-ss") + ".log";

Expand Down Expand Up @@ -38,6 +37,6 @@ public static void DeleteLog()
return;
}
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace FreeTAKServer_Manager
{
class RunUpdateExeClass
public static class RunUpdateExeClass
{
public static void RunExeActions()
{
Expand Down
11 changes: 5 additions & 6 deletions WinForms/FreeTAKServer_Manager/Forms/About_Form.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Net.Http;
using System.Windows.Forms;
using static FreeTAKServer_Manager.LoggerClass;

namespace FreeTAKServer_Manager
{
Expand Down Expand Up @@ -37,12 +36,12 @@ private void Checkforupdate_button_Click(object sender, EventArgs e)
{
backgroundWorker1.RunWorkerAsync();
}
Logger.WriteLine(" *** Ran UpdateExe:" + Environment.NewLine + " [About_Form] ***");
LoggerClass.WriteLine(" *** Ran UpdateExe:" + Environment.NewLine + " [About_Form] ***");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Could not check for update", MessageBoxButtons.OK, MessageBoxIcon.Error);
Logger.WriteLine(" *** Error:" + ex.Message + " [About_Form] ***");
LoggerClass.WriteLine(" *** Error:" + ex.Message + " [About_Form] ***");
return;
}
}
Expand Down Expand Up @@ -75,8 +74,8 @@ private async void backgroundWorker1_RunWorkerCompleted(object sender, System.Co
//Read the result and display in Textbox
string result = await content.ReadAsStringAsync();//Result string JSON
string reasonPhrase = response.ReasonPhrase;//Reason OK, FAIL etc.
Logger.WriteLine(" *** result:" + result + " [About_Form] ***");
Logger.WriteLine(" *** reasonPhrase:" + reasonPhrase + " [About_Form] ***");
LoggerClass.WriteLine(" *** result:" + result + " [About_Form] ***");
LoggerClass.WriteLine(" *** reasonPhrase:" + reasonPhrase + " [About_Form] ***");
MessageBox.Show(result, "Updater", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
Expand All @@ -85,7 +84,7 @@ private async void backgroundWorker1_RunWorkerCompleted(object sender, System.Co
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Could not test API", MessageBoxButtons.OK, MessageBoxIcon.Error);
Logger.WriteLine(" *** Error:" + ex.Message + " [MainForm] ***");
LoggerClass.WriteLine(" *** Error:" + ex.Message + " [MainForm] ***");
return;
}
}
Expand Down
11 changes: 5 additions & 6 deletions WinForms/FreeTAKServer_Manager/Forms/EmailSetup_Form.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Net.Mail;
using System.Security;
using System.Windows.Forms;
using static FreeTAKServer_Manager.LoggerClass;

namespace FreeTAKServer_Manager
{
Expand Down Expand Up @@ -57,12 +56,12 @@ private void SendEmail()

SmtpServer.Send(mail);
MessageBox.Show("Normal mail Sent", "Mail Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
Logger.WriteLine(" *** Auto Get Python Path Error. Attempting Manual Path Entry [MainForm] ***");
LoggerClass.WriteLine(" *** Auto Get Python Path Error. Attempting Manual Path Entry [MainForm] ***");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Email could not be tested", MessageBoxButtons.OK, MessageBoxIcon.Error);
Logger.WriteLine(" *** Error:" + ex.Message + " [EmailSetup_Form] ***");
LoggerClass.WriteLine(" *** Error:" + ex.Message + " [EmailSetup_Form] ***");
}
}

Expand All @@ -86,7 +85,7 @@ private void Savesettings_button_Click(object sender, EventArgs e)
Username_textBox.Enabled = true;
Password_textBox.Enabled = true;
Savesettings_button.Text = "Save Settings";//Change button text
Logger.WriteLine(" *** Editing email settings [EmailSetup_Form] ***");
LoggerClass.WriteLine(" *** Editing email settings [EmailSetup_Form] ***");
}
catch (Exception ex)
{
Expand All @@ -98,7 +97,7 @@ private void Savesettings_button_Click(object sender, EventArgs e)
Username_textBox.Enabled = false;
Password_textBox.Enabled = false;
MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
Logger.WriteLine(" *** Error:" + ex.Message + " [EmailSetup_Form] ***");
LoggerClass.WriteLine(" *** Error:" + ex.Message + " [EmailSetup_Form] ***");
Savesettings_button.Text = "Edit Settings";//Change button text
return;
}
Expand All @@ -124,7 +123,7 @@ private void Savesettings_button_Click(object sender, EventArgs e)
Username_textBox.Enabled = false;
Password_textBox.Enabled = false;
Savesettings_button.Text = "Edit Settings";//Change button text
Logger.WriteLine(" *** Saved email settings [EmailSetup_Form] ***");
LoggerClass.WriteLine(" *** Saved email settings [EmailSetup_Form] ***");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Net.Http;
using System.Windows.Forms;
using static FreeTAKServer_Manager.LoggerClass;

namespace FreeTAKServer_Manager
{
Expand Down Expand Up @@ -36,7 +35,7 @@ private async void Test_button_Click(object sender, EventArgs e)
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Could not test API", MessageBoxButtons.OK, MessageBoxIcon.Error);
Logger.WriteLine(" *** Error:" + ex.Message + " [MainForm] ***");
LoggerClass.WriteLine(" *** Error:" + ex.Message + " [MainForm] ***");
return;
}
}
Expand Down Expand Up @@ -66,7 +65,7 @@ private async void Custom_button_Click(object sender, EventArgs e)
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Could not custom test API", MessageBoxButtons.OK, MessageBoxIcon.Error);
Logger.WriteLine(" *** Error:" + ex.Message + " [MainForm] ***");
LoggerClass.WriteLine(" *** Error:" + ex.Message + " [MainForm] ***");
return;
}
}
Expand Down
7 changes: 5 additions & 2 deletions WinForms/FreeTAKServer_Manager/Forms/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 56f36e5

Please sign in to comment.