Marked as 'AdvertsingProfitControl 0.9.5.2' by its folder. I believe this version is where most of the main interface for the user was complete and I was toying with the idea of allowing the user to change the shrink on the main form.

This commit is contained in:
2021-01-28 20:03:54 -06:00
parent 676a9dd890
commit 687e37da94
21 changed files with 2755 additions and 292 deletions
+32 -33
View File
@@ -7,8 +7,7 @@ namespace AdvertsingProfitControl
public sealed partial class FrmLogConsole : Form
{
//Source code: https://hashfactor.wordpress.com/2009/03/31/c-winforms-create-a-single-instance-form/
private static readonly FrmLogConsole gLogConsoleInstance = new FrmLogConsole();
private static bool gIsShown = false;
private static bool _gIsShown;
public FrmLogConsole()
{
@@ -18,16 +17,18 @@ namespace AdvertsingProfitControl
logListView.View = View.Details;
//Information for drawing header columns and sub-items in ListView:
//http://stackoverflow.com/questions/561798/how-do-i-align-text-for-a-single-subitem-in-a-listview-using-c
ColumnHeader header = new ColumnHeader();
header.Text = "Advertising Profit Control " + Application.ProductVersion + " Debug Console";
header.Name = "LogConsoleHeader";
header.Width = logListView.Width;
var header = new ColumnHeader
{
Text = @"Advertising Profit Control " + Application.ProductVersion + @" Debug Console",
Name = "LogConsoleHeader",
Width = logListView.Width
};
logListView.Columns.Add(header);
}
static FrmLogConsole()
{
GetStaticInstance.FormClosing += new FormClosingEventHandler(LogConsole_FormClosing);
GetStaticInstance.FormClosing += LogConsole_FormClosing;
//Set the maximum and minimum size of the form.
GetStaticInstance.MaximumSize = new Size(900, 900);
GetStaticInstance.MinimumSize = new Size(400, 400);
@@ -35,27 +36,25 @@ namespace AdvertsingProfitControl
public new void Show()
{
if (gIsShown)
if (_gIsShown)
{
base.Show();
}
else
{
base.Show();
gIsShown = true;
_gIsShown = true;
}
}
public new void Hide()
{
if (gIsShown)
{
base.Hide();
gIsShown = false;
}
if (!_gIsShown) return;
base.Hide();
_gIsShown = false;
}
public enum Level : int
public enum Level
{
Critical = 0,
Error = 1,
@@ -68,7 +67,6 @@ namespace AdvertsingProfitControl
public void WriteToLog(Level level, string message)
{
Color color;
int index;
switch (level)
{
@@ -87,14 +85,17 @@ namespace AdvertsingProfitControl
case Level.Verbose:
color = Color.Blue;
break;
case Level.Debug:
color = Color.Black;
break;
default:
color = Color.Black;
break;
}
index = logListView.Items.Count;
var index = logListView.Items.Count;
try
{
message = String.Format("{0}: {1}", level, message);
message = $"{level}: {message}";
if (level != Level.Info)
{
GlobalClasses.WriteToLog(DateTime.Now + ": " + message + Environment.NewLine);
@@ -107,13 +108,17 @@ namespace AdvertsingProfitControl
MessageBox.Show(e.Message);
}
if (level == Level.Critical)
switch (level)
{
logListView.Items[index].BackColor = Color.Red;
}
else
{
logListView.Items[index].BackColor = Color.WhiteSmoke;
case Level.Critical:
logListView.Items[index].BackColor = Color.Red;
break;
case Level.Error:
logListView.Items[index].ForeColor = Color.Maroon;
break;
default:
logListView.Items[index].BackColor = Color.WhiteSmoke;
break;
}
}
@@ -121,17 +126,11 @@ namespace AdvertsingProfitControl
{
e.Cancel = true;
GetStaticInstance.Hide();
gIsShown = false;
_gIsShown = false;
}
public static FrmLogConsole GetStaticInstance
{
get { return gLogConsoleInstance; }
}
public static FrmLogConsole GetStaticInstance { get; } = new FrmLogConsole();
public bool IsVisable
{
get { return gIsShown; }
}
public bool IsVisable => _gIsShown;
}
}