namespace batrei_laptop_rev_2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
timer1.Enabled = true;
}
string musik;
private void timer1_Tick(object sender, EventArgs e)
{
PowerStatus status = SystemInformation.PowerStatus;
progressBarStatus.Value = (int)(status.BatteryLifePercent * 100);
lblBatterLevel.Text = String.Format("{0}%", (status.BatteryLifePercent * 100));
if ((status.BatteryLifePercent * 100) > 90)
{
StatusText.Text = "SEGERA CABUT CHARGE'NYA";
axWindowsMediaPlayer1.URL = musik;
}
else if ((status.BatteryLifePercent * 100) < 60)
{
StatusText.Text = "LAPTOP PERLU DI CHARGE";
axWindowsMediaPlayer1.URL = musik;
}
axWindowsMediaPlayer1.openPlayer(musik);
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
if(open.ShowDialog() == DialogResult.OK)
{
musik = open.FileName;
textBox1.Text = open.SafeFileName;
}
}
}
}
if any issue then let me know.
-> M.U