Esempio n. 1
0
        private void InitialiseBatteryInformation()
        {
            if (_seekiosSelected.BatteryLife >= 0 && _seekiosSelected.DateLastCommunication != null && _seekiosSelected.DateLastCommunication.HasValue)
            {
                BatteryTextView.Text = string.Format(Resources.GetString(Resource.String.detailSeekios_batteryPercentage)
                                                     , _seekiosSelected.BatteryLife
                                                     , _seekiosSelected.DateLastCommunication.Value.ToString("dd/MM/yyyy")
                                                     , _seekiosSelected.DateLastCommunication.Value.ToString("H:mm"));
            }

            else
            {
                BatteryTextView.Text = Resources.GetString(Resource.String.detailSeekios_noBatteryData);
            }

            //Set battery color
            if (_seekiosSelected.BatteryLife <= 100 && _seekiosSelected.BatteryLife >= 95)
            {
                BatterySvgImageView.SetSvg(this, Resource.Drawable.BatteryFull);
            }
            else if (_seekiosSelected.BatteryLife <= 95 && _seekiosSelected.BatteryLife > 66)
            {
                BatterySvgImageView.SetSvg(this, Resource.Drawable.Battery);
            }
            else if (_seekiosSelected.BatteryLife <= 66 && _seekiosSelected.BatteryLife > 33)
            {
                BatterySvgImageView.SetSvg(this, Resource.Drawable.BatteryMedium);
            }
            else if (_seekiosSelected.BatteryLife <= 33 && _seekiosSelected.BatteryLife > 0)
            {
                BatterySvgImageView.SetSvg(this, Resource.Drawable.BatteryLow);
            }
            else
            {
                BatterySvgImageView.SetSvg(this, Resource.Drawable.NoBattery);
            }

            //Initialisation of the battery loader
            if (!_seekiosSelected.HasGetLastInstruction)
            {
                //BatteryLoaderLayout.Visibility = ViewStates.Visible;
                BatteryRefreshButton.Enabled = false;
            }
            else
            {
                BatteryLoaderLayout.Visibility = ViewStates.Gone;
                BatteryRefreshButton.Enabled   = true;
            }
        }
        private void InitialiseBatteryInformation()
        {
            if (_seekiosSelected.BatteryLife >= 0 && _seekiosSelected.DateLastCommunication != null && _seekiosSelected.DateLastCommunication.HasValue)
            {
                BatteryTextView.Text = string.Format(Resources.GetString(Resource.String.detailSeekios_batteryPercentage)
                                                     , _seekiosSelected.BatteryLife
                                                     , _seekiosSelected.DateLastCommunication.Value.FormatDateTimeFromNow(false));
            }
            else
            {
                BatteryTextView.Text = Resources.GetString(Resource.String.detailSeekios_noBatteryData);
            }

            // Set battery color
            if (_seekiosSelected.BatteryLife <= 100 && _seekiosSelected.BatteryLife >= 95)
            {
                BatterySvgImageView.SetSvg(this, Resource.Drawable.BatteryFull);
            }
            else if (_seekiosSelected.BatteryLife <= 95 && _seekiosSelected.BatteryLife > 66)
            {
                BatterySvgImageView.SetSvg(this, Resource.Drawable.Battery);
            }
            else if (_seekiosSelected.BatteryLife <= 66 && _seekiosSelected.BatteryLife > 33)
            {
                BatterySvgImageView.SetSvg(this, Resource.Drawable.BatteryMedium);
            }
            else if (_seekiosSelected.BatteryLife <= 33 && _seekiosSelected.BatteryLife > 0)
            {
                BatterySvgImageView.SetSvg(this, Resource.Drawable.BatteryLow);
            }
            else
            {
                BatterySvgImageView.SetSvg(this, Resource.Drawable.NoBattery);
            }

            // Initialisation of the battery loader
            if (_seekiosSelected.IsRefreshingBattery)
            {
                BatteryLoaderProgressBar.Visibility = ViewStates.Visible;
                BatteryRefreshButton.Enabled        = false;
            }
            else
            {
                BatteryLoaderProgressBar.Visibility = ViewStates.Invisible;
                BatteryRefreshButton.Enabled        = true;
            }
        }