Modularized power distribution functions

master
Aaron Johnson 5 years ago
parent 68a8155ed7
commit 74c238b472

@ -31,10 +31,7 @@ namespace Elite_Power_Management_Simulator
private void btn_reset_Click(object sender, EventArgs e)
{
global.eng = 4;
global.sys = 4;
global.wep = 4;
update();
pwr_reset();
}
public void update()
{
@ -43,10 +40,15 @@ namespace Elite_Power_Management_Simulator
prog_wep.Value = global.wep;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
//Power Distribution Functions
public void pwr_reset()
{
//capture up arrow key
if (keyData == Keys.Up)
global.eng = 4;
global.sys = 4;
global.wep = 4;
update();
}
public void pwr_eng()
{
bool fin = false;
if (global.eng < 8)
@ -119,19 +121,8 @@ namespace Elite_Power_Management_Simulator
}
update();
return true;
}
//capture down arrow key
if (keyData == Keys.Down)
{
global.eng = 4;
global.sys = 4;
global.wep = 4;
update();
return true;
}
//capture left arrow key
if (keyData == Keys.Left)
public void pwr_sys()
{
bool fin = false;
if (global.sys < 8)
@ -190,10 +181,8 @@ namespace Elite_Power_Management_Simulator
}
update();
return true;
}
//capture right arrow key
if (keyData == Keys.Right)
public void pwr_wep()
{
bool fin = false;
if (global.wep < 8)
@ -252,6 +241,28 @@ namespace Elite_Power_Management_Simulator
}
update();
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Up)
{
pwr_eng();
return true;
}
if (keyData == Keys.Down)
{
pwr_reset();
return true;
}
if (keyData == Keys.Left)
{
pwr_sys();
return true;
}
if (keyData == Keys.Right)
{
pwr_wep();
return true;
}
return base.ProcessCmdKey(ref msg, keyData);

Loading…
Cancel
Save