Monday 27 April 2015

Find Out PC & Laptop Power Status From in Battery Or Charging Using Asp.Net C#

Find Out PC & Laptop Power Status  in  Battery Or Charging 


Your PC or Laptop Charging From Battery or Charging in Asp.Net C#.

                                      DEMO
Charge Control Check

                       C# CODING

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Management;
using System.Runtime.InteropServices;
using System.Windows.Forms;

public partial class Battery : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        PowerLineStatus status = SystemInformation.PowerStatus.PowerLineStatus;
        if (status == PowerLineStatus.Offline)
        {
            MessageBox.Show("Running on Battery");
        }
        else
        {
            MessageBox.Show("Running on Power");
        }
              
    }

}
























0 comments:

Post a Comment