Skip to content

Commit

Permalink
FormStart to black
Browse files Browse the repository at this point in the history
  • Loading branch information
SK21 committed Dec 1, 2024
1 parent 6b0bfa7 commit f70b30b
Show file tree
Hide file tree
Showing 22 changed files with 103 additions and 196 deletions.
11 changes: 9 additions & 2 deletions RateAppSource/RateController/FormStart.Designer.cs

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

99 changes: 56 additions & 43 deletions RateAppSource/RateController/FormStart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public partial class FormStart : Form
private Label[] Rates;
private PGN32501[] RelaySettings;
private Label[] Targets;
private int mouseX = 0;
private int mouseY = 0;
private int windowLeft = 0;
private int windowTop = 0;

public FormStart()
{
Expand Down Expand Up @@ -167,6 +171,32 @@ public FormStart()
}

public event EventHandler ProductChanged;
private void mouseMove_MouseDown(object sender, MouseEventArgs e)
{
// Log the current window location and the mouse location.
if (e.Button == MouseButtons.Right)
{
windowTop = this.Top;
windowLeft = this.Left;
mouseX = e.X;
mouseY = e.Y;
}
}

private void mouseMove_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
windowTop = this.Top;
windowLeft = this.Left;

Point pos = new Point(0, 0);

pos.X = windowLeft + e.X - mouseX;
pos.Y = windowTop + e.Y - mouseY;
this.Location = pos;
}
}

public int DefaultProduct
{
Expand Down Expand Up @@ -453,7 +483,7 @@ public void DisplaySwitches()
public void LoadSettings()
{
StartSerial();
SetDayMode();
SetDisplay();

if (bool.TryParse(Tls.LoadProperty("UseInches"), out bool tmp)) cUseInches = tmp;
if (bool.TryParse(Tls.LoadProperty("UseTransparent"), out bool Ut)) cUseTransparent = Ut;
Expand Down Expand Up @@ -773,8 +803,9 @@ public void UpdateStatus()
{
ProdName[i].Text = Products.Item(i).ProductName;

ProdName[i].BackColor = SimColor;
ProdName[i].BorderStyle = BorderStyle.FixedSingle;
ProdName[i].BackColor = Color.Transparent;
ProdName[i].ForeColor = SimColor;
ProdName[i].BorderStyle = BorderStyle.None;

Rates[i].Text = Products.Item(i).SmoothRate().ToString("N1");
if (i < 4)
Expand Down Expand Up @@ -970,7 +1001,7 @@ private void button3_Click(object sender, EventArgs e)
ptLowerLeft = btnSender.PointToScreen(ptLowerLeft);
mnuSettings.Show(ptLowerLeft);
UpdateStatus();
SetDayMode();
SetDisplay();
}

private void calibrateToolStripMenuItem1_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -1017,7 +1048,7 @@ private void FormatDisplay()
if (ID < 0) ID = 0;
clsProduct Prd = Products.Item(ID);

this.Width = 290;
this.Width = 277;

btAlarm.Top = 21;
btAlarm.Left = 33;
Expand All @@ -1032,7 +1063,7 @@ private void FormatDisplay()
panSummary.Top = 0;
panSummary.Left = 0;

this.Height = 283;
this.Height = 248;
btnSettings.Top = 180;
btnLeft.Top = 180;
btnRight.Top = 180;
Expand All @@ -1050,7 +1081,7 @@ private void FormatDisplay()
panFan.Top = 0;
panFan.Left = 0;

this.Height = 257;
this.Height = 222;
btnSettings.Top = 154;
btnLeft.Top = 154;
btnRight.Top = 154;
Expand All @@ -1065,7 +1096,7 @@ private void FormatDisplay()
panProducts.Left = 0;

// product panel
this.Height = 257;
this.Height = 222;
btnSettings.Top = 154;
btnLeft.Top = 154;
btnRight.Top = 154;
Expand Down Expand Up @@ -1203,7 +1234,7 @@ private void FormStart_Load(object sender, EventArgs e)
private void groupBox3_Paint(object sender, PaintEventArgs e)
{
GroupBox box = sender as GroupBox;
Tls.DrawGroupBox(box, e.Graphics, this.BackColor, Color.Black, Color.Black);
Tls.DrawGroupBox(box, e.Graphics, this.BackColor, Color.Black, Color.Yellow);
}

private void label34_Click(object sender, EventArgs e)
Expand All @@ -1212,10 +1243,6 @@ private void label34_Click(object sender, EventArgs e)
UpdateStatus();
}

private void lbAogConnected_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}

private void lbAogConnected_HelpRequested(object sender, HelpEventArgs hlpevent)
{
Expand All @@ -1228,7 +1255,10 @@ private void lbAogConnected_HelpRequested(object sender, HelpEventArgs hlpevent)

private void lbArduinoConnected_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
int prod = CurrentPage - 1;
if (prod < 0) prod = 0;
Form restoreform = new RCRestore(this, RateType, Products.Item(prod));
restoreform.Show();
}

private void lbArduinoConnected_HelpRequested(object sender, HelpEventArgs hlpevent)
Expand Down Expand Up @@ -1441,40 +1471,23 @@ private void sectionsToolStripMenuItem_Click(object sender, EventArgs e)
frm.Show();
}

private void SetDayMode()
private void SetDisplay()
{
if (Properties.Settings.Default.IsDay)
this.BackColor = Color.Black;
foreach (Control c in this.Controls)
{
this.BackColor = Properties.Settings.Default.DayColour;
foreach (Control c in this.Controls)
{
c.ForeColor = Color.Black;
}

for (int i = 0; i < 5; i++)
{
Indicators[i].BackColor = Properties.Settings.Default.DayColour;
}

lbOn.BackColor = Properties.Settings.Default.DayColour;
lbOff.BackColor = Properties.Settings.Default.DayColour;
c.ForeColor = Color.Yellow;
}
else
{
this.BackColor = Properties.Settings.Default.NightColour;
foreach (Control c in this.Controls)
{
c.ForeColor = Color.White;
}
lbAogConnected.ForeColor = Color.Black;
lbArduinoConnected.ForeColor = Color.Black;

for (int i = 0; i < 5; i++)
{
Indicators[i].BackColor = Properties.Settings.Default.NightColour;
}

lbOn.BackColor = Properties.Settings.Default.NightColour;
lbOff.BackColor = Properties.Settings.Default.NightColour;
for (int i = 0; i < 6; i++)
{
Indicators[i].BackColor = Color.Transparent;
}

lbOn.BackColor = Color.Transparent;
lbOff.BackColor = Color.Transparent;
}

private void SetLanguage()
Expand Down
13 changes: 8 additions & 5 deletions RateAppSource/RateController/RCRestore.Designer.cs

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

28 changes: 14 additions & 14 deletions RateAppSource/RateController/RCRestore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,45 @@ namespace RateController
{
public partial class RCRestore : Form
{
private frmLargeScreen LS;
private clsProduct cCurrentProduct;
private int cRateType;
private Form FormToHide;

public RCRestore(frmLargeScreen CallingForm)
public RCRestore(Form CallingForm, int RateType, clsProduct CurrentProduct)
{
LS = CallingForm;

FormToHide = CallingForm;
cRateType = RateType;
cCurrentProduct = CurrentProduct;
this.TransparencyKey = this.BackColor;

InitializeComponent();
}

private void RCRestore_Load(object sender, EventArgs e)
{
this.Top = LS.Top + LS.Height - this.Height;
this.Left = LS.Left + LS.Width - this.Width;
this.Top = FormToHide.Top + FormToHide.Height - this.Height;
this.Left = FormToHide.Left + FormToHide.Width - this.Width;

LS.WindowState = FormWindowState.Minimized;
lbRateAmount.Font = new Font("MS Gothic", 16, FontStyle.Bold);
lbRateAmount.ForeColor = Color.Yellow;
FormToHide.WindowState = FormWindowState.Minimized;
timer1.Enabled = true;
}

private void RestoreLC_Click(object sender, EventArgs e)
{
LS.WindowState = FormWindowState.Normal;
FormToHide.WindowState = FormWindowState.Normal;
timer1.Enabled = false;
this.Close();
}

private void timer1_Tick(object sender, EventArgs e)
{
switch (LS.mf.RateType)
switch (cRateType)
{
case 1:
lbRateAmount.Text = LS.Prd.CurrentRate().ToString("N1");
lbRateAmount.Text = cCurrentProduct.CurrentRate().ToString("N1");
break;

default:
lbRateAmount.Text = LS.Prd.SmoothRate().ToString("N1");
lbRateAmount.Text = cCurrentProduct.SmoothRate().ToString("N1");
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion RateAppSource/RateController/frmLargeScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private void btMaster_MouseUp(object sender, MouseEventArgs e)

private void btMinimize_Click(object sender, EventArgs e)
{
Form restoreform = new RCRestore(this);
Form restoreform = new RCRestore(this, mf.RateType, Prd);
restoreform.Show();
}

Expand Down
Loading

0 comments on commit f70b30b

Please sign in to comment.