Beispiel #1
0
 private void battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     showActualBatteryState(e.ChargeLevel,
                            e.PowerSource,
                            e.State,
                            Battery.EnergySaverStatus);
 }
 private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     if (udpClient != null)
     {
         var msg = Encoding.ASCII.GetBytes($"{(int)(e.ChargeLevel * 1000)}");
         udpClient.Send(msg, msg.Length);
     }
 }
Beispiel #3
0
        void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
        {
            var level  = e.ChargeLevel;
            var state  = e.State;
            var source = e.PowerSource;

            Console.WriteLine($"Reading: Level: {level}, State: {state}, Source: {source}");
        }
Beispiel #4
0
        private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
        {
            float BLF = float.Parse(Battery.ChargeLevel.ToString()) * 100;

            _batteryLevelView.Text = BLF.ToString() + "%";

            var state = Battery.State;

            switch (state)
            {
            case BatteryState.Charging:
                _state.Text = "Currently charging";
                break;

            case BatteryState.Full:
                _state.Text = "Battery is full";
                break;

            case BatteryState.Discharging:
            case BatteryState.NotCharging:
                _state.Text = "Currently discharging battery or not being charged";
                break;

            case BatteryState.NotPresent:
                _state.Text = "Battery doesn't exist in device (desktop computer)";
                break;

            case BatteryState.Unknown:
                _state.Text = "Unable to detect battery state";
                break;
            }

            var source = Battery.PowerSource;

            switch (source)
            {
            case BatteryPowerSource.Battery:
                _source.Text = "Being powered by the battery";
                break;

            case BatteryPowerSource.AC:
                _source.Text = "Being powered by A/C unit";
                break;

            case BatteryPowerSource.Usb:
                _source.Text = "Being powered by USB cable";
                break;

            case BatteryPowerSource.Wireless:
                _source.Text = "Powered via wireless charging";
                break;

            case BatteryPowerSource.Unknown:
                _source.Text = "Unable to detect power source";
                break;
            }
        }
Beispiel #5
0
 void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     if (batteryToggle)
     {
         var state  = e.State;
         var source = e.PowerSource;
         FindViewById <TextView>(Resource.Id.batterySource).Text = "Battery source: " + source;
         FindViewById <TextView>(Resource.Id.batteryState).Text  = "Battery state: " + state;
     }
 }
Beispiel #6
0
        private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
        {
            BatteryData data = BatteryStatus;

            data.ChargeLevel  = e.ChargeLevel;
            data.BatteryState = e.State.ToString();
            data.PowerSource  = e.PowerSource.ToString();
            data.TimeStamp    = DateTime.UtcNow;
            data.SendNotification();
        }
Beispiel #7
0
        void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
        {
            var level = e.ChargeLevel;

            chargeLevel.Text = level * 100 + "%";
            var state = e.State;

            batteryState.Text = state.ToString();
            var source = e.PowerSource;

            powerSource.Text = source.ToString();
        }
Beispiel #8
0
        void Battery_BatteryChanged(object sender, BatteryInfoChangedEventArgs e)  //gestisco l'evento della batteria
        {
            var level = e.ChargeLevel;

            level = Convert.ToInt32(level * 100);
            // Console.WriteLine("Ecco level:"+level);
            var state  = e.State;
            var source = e.PowerSource;

            //Console.WriteLine($"Reading: Level: {level}, State: {state}, Source: {source}");
            Battery_value.Text = "Battery level: " + level + Environment.NewLine + "Battery Power Source: " + source;
        }
Beispiel #9
0
        void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
        {
            double level = e.ChargeLevel;

            isCharging = e.State;

            if (level < LastCharge)
            {
            }
            BatteryLifeInSeconds = Convert.ToUInt32(level * 100 * ElapsedTime);

            LastCharge  = level;
            ElapsedTime = 0;
        }
        private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
        {
            //Question: If the
            //Battery.EnergySaverStatusChanged += OnEnergySaverStatusChanged;
            // var status = e.EnergySaverStatus; on?

            var level  = e.ChargeLevel;
            var state  = e.State;
            var source = e.PowerSource;

            Console.WriteLine($"Reading: Level: {level}, State: {state}, Source: {source}");

            if (level < 0.20)
            {
                CreateLocalNotification();
            }
        }
Beispiel #11
0
        private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
        {
            //var state = e.State;
            //var source = e.PowerSource;
            //var level = e.ChargeLevel;

            //_batteryState.Text = state.ToString();
            //_batteryChargeSource.Text = source.ToString();
            //_batteryChargeLevel.Text = level.ToString();



            //if (level >= 90)
            //{
            //    int fullBatteryInt = Resource.Drawable.battery100;
            //    //_batteryImage.SetImageDrawable(Resource.Drawable.battery100);
            //    _batteryImage.SetImageResource(fullBatteryInt);
            //}
        }
Beispiel #12
0
 private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     _batteryLevelTextView.Text = Battery.ChargeLevel.ToString();
 }
Beispiel #13
0
 private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     BatteryStats();
     SetCollor();
 }
Beispiel #14
0
 private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     GetBatteryInfo();
 }
Beispiel #15
0
 private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     BatteryLevel.Text = (e.ChargeLevel * 100).ToString() + "%";
 }
Beispiel #16
0
 private void battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     showBatteryInfo(e.ChargeLevel, e.PowerSource, e.State);
 }
 private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     SetDisplay(e.ChargeLevel, e.State == BatteryState.Charging);
 }
Beispiel #18
0
 void OnBatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     OnPropertyChanged(nameof(Level));
     OnPropertyChanged(nameof(State));
     OnPropertyChanged(nameof(PowerSource));
 }
Beispiel #19
0
 public void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     HWInfo.GetBatteryInfo();
     SetBatteryInfo(view);
 }
Beispiel #20
0
 void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
 }
 private void OnBatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     BatteryLevelLabel.Text       = e.ChargeLevel.ToString();
     BatteryStateLabel.Text       = e.State.ToString();
     BatteryPowerSourceLabel.Text = e.PowerSource.ToString();
 }
 private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     Battery_BatteryInfoChanged1(((int)(e.ChargeLevel * 100)), e.State);
 }
 private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     SetBackground(e.ChargeLevel, e.State == BatteryState.Charging || e.State == BatteryState.Full);
 }
Beispiel #24
0
 private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     SetBackground(e.ChargeLevel, e.State == BatteryState.Charging);
     (BindingContext as ViewModel).GetBatteryInformation();
 }
 private void OnBatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     CheckBatteryStatus();
 }
Beispiel #26
0
 // Evento que ocurre cuando el valor de bateria se modifica
 private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     linearGauge.Value      = 100 - (e.ChargeLevel * 100);
     linearGauge.Marks.Text = (100 - linearGauge.Value).ToString();
 }
 private async void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     this.BatteryState       = e.State.ToString();
     this.BatteryChargeLevel = (e.ChargeLevel * 100).ToString() + "%";
     this.BatteryPowerSource = e.PowerSource.ToString();
 }
Beispiel #28
0
 private void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
 {
     txtSource.Text      = Convert.ToString(e.PowerSource);
     txtStatus.Text      = Convert.ToString(e.State);
     txtChargeLevel.Text = Convert.ToString(e.ChargeLevel);
 }