Максим Волков (mwolf_) wrote,
Максим Волков
mwolf_

Братья по клавиатуре донесли прекрасное

Public ReadOnly Property BatteryPercent()
    ' This code will retrieve the BatteryLifePercent property and convert it to a percent.
    Get
        If SystemInformation.PowerStatus.BatteryLifePercent.ToString = "1" Then
            Return "100%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.99" Then
            Return "99%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.98" Then
            Return "98%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.97" Then
            Return "97%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.96" Then
            Return "96%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.95" Then
            Return "95%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.94" Then
            Return "94%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.93" Then
            Return "93%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.92" Then
            Return "92%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.91" Then
            Return "91%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.9" Then
            Return "90%"
        '...
        'skipped, дададада тут ОНО!
        '...
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.2" Then
            Return "20%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.19" Then
            Return "19%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.18" Then
            Return "18%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.17" Then
            Return "17%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.16" Then
            Return "16%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.15" Then
            Return "15%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.14" Then
            Return "14%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.13" Then
            Return "13%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.12" Then
            Return "12%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.11" Then
            Return "11%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.1" Then
            Return "10%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.09" Then
            Return "9%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.08" Then
            Return "8%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.07" Then
            Return "7%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.06" Then
            Return "6%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.05" Then
            Return "5%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.04" Then
            Return "4%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.03" Then
            Return "3%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.02" Then
            Return "2%"
        ElseIf SystemInformation.PowerStatus.BatteryLifePercent.ToString = "0.01" Then
            Return "1%"
        Else
            Return "NA"
        End If
    End Get
End Property

Бедняги. Пойду их воткой после такого отпаивать...

ЗЫ. В коде чуется дух смуглолицых ребят из Банглора.
Tags: программирование
Subscribe
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 15 comments