Esempio n. 1
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            if (!(holder is MachineStateViewHolder cell) ||
                _statesLogs.Count <= position)
            {
                return;
            }

            var item = _statesLogs[position];

            cell.IvState.SetImageBitmap(ResourcesHelper.GetImageFromResources(item.state.iconName));
            cell.TvSateName.Text = !string.IsNullOrEmpty(item.description)
                ? item.description
                : item.state.name;
            cell.TvStartDate.Text = item.timeStart.ToString("dd.MM.yy  HH:mm:ss");


            if (item.timeEnd > item.timeStart)
            {
                cell.TvPeriod.Text          = FormatUtils.PeriodStr(item.timeStart, item.timeEnd);
                cell.TvHourGlass.Visibility = ViewStates.Visible;
            }
            else
            {
                cell.TvPeriod.Text          = null;
                cell.TvHourGlass.Visibility = ViewStates.Invisible;
            }

            cell.TvUser.Text = item.userName;
        }
        private void UpdateViewValues()
        {
            if (DataManager.selectedCity != null)
            {
                _tvCity.Text = DataManager.selectedCity.name;
            }
            if (DataManager.selectedDivision != null)
            {
                _tvDivision.Text = DataManager.selectedDivision.name;
            }
            if (DataManager.selectedMachineType != null)
            {
                _tvFacilityType.Text = DataManager.selectedMachineType.name;
                _ivFacilityType.SetImageBitmap(ResourcesHelper.GetImageFromResources(DataManager.selectedMachineType.iconName));
            }
            if (DataManager.selectedMachineState != null)
            {
                _tvWorkState.Text = DataManager.selectedMachineState.name;
                _ivWorkSate.SetImageBitmap(ResourcesHelper.GetImageFromResources(DataManager.selectedMachineState.iconName));
            }
            if (DataManager.selectedMachineServiceState != null)
            {
                _tvServiceState.Text = DataManager.selectedMachineServiceState.name;
                _ivServiceState.SetImageBitmap(ResourcesHelper.GetImageFromResources(DataManager.selectedMachineServiceState.iconName));
            }

            _swOnlyMy.Checked = DataManager.onlyMyMachines;
        }
Esempio n. 3
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var view = convertView ??
                       _activity.LayoutInflater.Inflate(Resource.Layout.item_filter, parent, false);

            if (Count <= position)
            {
                return(view);
            }

            var item = this [position];

            var tvFilterName = view.FindViewById <TextView>(Resource.Id.tvFilterName);

            if (position == 0)
            {
                item.Description     = "Все";
                tvFilterName.Gravity = GravityFlags.Center;
            }
            else
            {
                tvFilterName.Gravity = GravityFlags.Left;
            }


            tvFilterName.Text = item.Description;

            view.FindViewById <ImageView>(Resource.Id.ivFilterThumb)
            .SetImageBitmap(ResourcesHelper.GetImageFromResources(item.ImageName));

            return(view);
        }
Esempio n. 4
0
        private void UpdateViewValues()
        {
            _tvMachineNumberRequest.Text = "Инв. №: " + _machine.inventoryID;
            if (_machine.sensors.Count != 0)
            {
                _tvMachineNumberRequest.Text += " (" + BitConverter.ToString(BitConverter.GetBytes(_machine.sensors[0].nodeID), 1, 1)
                                                + BitConverter.ToString(BitConverter.GetBytes(_machine.sensors[0].nodeID), 0, 1) + ")";
            }

            _ivStateRequest.SetImageBitmap(ResourcesHelper.GetImageFromResources(_machine.serviceState.iconName));
            _tvStateNameRequest.Text = _machine.serviceState.name;
            _tvStartTimeRequest.Text = _machine.serviceStateTimeStart.ToString("dd.MM.yy  HH:mm:ss");
            _tvUserRequest.Text      = _machine.userName;
        }
        private void UpdateViewValues()
        {
            _tvMachineNumber.Text = "Инв. №: " + _machine.inventoryID;
            if (_machine.sensors.Count != 0)
            {
                _tvMachineNumber.Text += " (" + BitConverter.ToString(BitConverter.GetBytes(_machine.sensors[0].nodeID), 1, 1)
                                         + BitConverter.ToString(BitConverter.GetBytes(_machine.sensors[0].nodeID), 0, 1) + ")";
            }

            _ivSensorIcon.SetImageBitmap(ResourcesHelper.GetImageFromResources(_sensor.type.iconName));
            _ivMachineIcon.SetImageBitmap(ResourcesHelper.GetImageFromResources(_machine.type.iconName));

            _tvMachineName.Text  = _machine.GetNameStr();
            _tvDivisionName.Text = _machine.GetDivisionStr();

            var numberFormatInfo = new System.Globalization.CultureInfo("en-Us", false).NumberFormat;

            numberFormatInfo.NumberGroupSeparator   = " ";
            numberFormatInfo.NumberDecimalSeparator = ",";

            if (_sensorBorder.minValue == 0 && _sensorBorder.maxValue == 0 && _sensorBorders.maxSecondsNotOkValue == 0)
            {
                return;
            }

            _etToleranceFromValue.Text = _sensorBorder.minValue.ToString("N", numberFormatInfo);
            _etToValue.Text            = _sensorBorder.maxValue.ToString("N", numberFormatInfo);

            _tvValueSymbolFrom.Text = _sensor.type.mainValueSymbol;
            _tvValueSymbolTo.Text   = _sensor.type.mainValueSymbol;

            var seconds = _sensorBorders.maxSecondsNotOkValue;
            var hours   = seconds / 3600;

            seconds -= hours * 3600;

            var minutes = seconds / 60;

            seconds -= minutes * 60;

            _etHour.Text = hours.ToString();
            _etMin.Text  = minutes.ToString("D2");
            _etSec.Text  = seconds.ToString("D2");

            _ivSensorIcon.Visibility = ViewStates.Visible;
        }
Esempio n. 6
0
 private void UpdatePingIndicatorImage(string name)
 {
     RunOnUiThread(() => _pingIndicator.SetImageBitmap(ResourcesHelper.GetImageFromResources(name)));
 }
Esempio n. 7
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            try
            {
                if (!(holder is MachineViewHolder cell) ||
                    _machines.Count <= position)
                {
                    return;
                }

                var item = _machines[position];

                cell.MachineIcon.SetImageBitmap(ResourcesHelper.GetImageFromResources(item.type.iconName));

                cell.MachineStateIcon.SetImageBitmap(item.serviceState.code > MachineServiceStateCodes.Work
                    ? ResourcesHelper.GetImageFromResources(item.serviceState.iconName)
                    : ResourcesHelper.GetImageFromResources(item.state.iconName));

                cell.Title.Text       = item.GetNameStr();
                cell.Description.Text = item.GetDivisionStr();

                if (item.sensors.Count != 0)
                {
                    var sensor = item.sensors[0];

                    cell.SensorIconCell.SetImageBitmap(ResourcesHelper.GetImageFromResources(sensor.type.iconName));
                    cell.MainValueCell.Text       = sensor.mainValue.ToString("F2");
                    cell.MainValueSymbolCell.Text = sensor.type.mainValueSymbol;

                    var numberFormatInfo = new CultureInfo("en-Us", false).NumberFormat;
                    numberFormatInfo.NumberGroupSeparator   = " ";
                    numberFormatInfo.NumberDecimalSeparator = ",";

                    cell.AdditionalValueCell.Text       = sensor.additionalValue.ToString("N", numberFormatInfo);
                    cell.AdditionalValueSymbolCell.Text = sensor.type.additionalValueSymbol;
                }
                else
                {
                    cell.SensorIconCell.SetImageBitmap(null);
                    cell.MainValueCell.Text             = "";
                    cell.MainValueSymbolCell.Text       = "";
                    cell.AdditionalValueCell.Text       = "";
                    cell.AdditionalValueSymbolCell.Text = "";
                }

                cell.SetColor(Color.Black);

                if (item.state.code == MachineStateCodes.Failure || item.serviceState.code == MachineServiceStateCodes.Broken)
                {
                    cell.SetColor(Color.Red);
                }
                else if (item.divisionPosition.ID != item.divisionOwner.ID && (item.divisionPosition.ID != 0))
                {
                    cell.SetColor(Color.Argb(128, 255, 0, 0));
                }

                if (item.sensors.Count != 0)
                {
                    if ((DateTime.Now - item.sensors[0].lastTime).TotalMinutes > Settings.greyOfflineMinutes)
                    {
                        cell.SetColor(Color.Gray);
                    }
                }
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e);
            }
        }