public async Task <GaugeViewModel> ObtenerGaugeViewModel(long grupo, int anio, PersonaViewModel personaViewModel, bool todasLasAreas = false) { MedicionViewModel filtro = new MedicionViewModel(); filtro.Grupo = grupo; filtro.Anio = anio; filtro.BuscarPorNoAplica = true; filtro.NoAplica = false; IList <MedicionViewModel> medicionesViewModel = await Buscar(filtro); GaugeViewModel gaugeViewModel = new GaugeViewModel(); if (medicionesViewModel != null && medicionesViewModel.Count > 0) { MedicionViewModel ultimaMedicionCargada = medicionesViewModel.OrderBy(m => m.Mes).Reverse().First(); // Obtener el último indicador Indicador ultimoIndicador = IndicadorRepository.Buscar(new BuscarIndicadorViewModel { Busqueda = new IndicadorViewModel { Grupo = grupo }, PersonaLogueadaViewModel = personaViewModel, TodasLasAreas = todasLasAreas }).First(); gaugeViewModel.NombreMes = ultimaMedicionCargada.Mes.ToString(); gaugeViewModel.NombreIndicador = ultimoIndicador.Nombre; gaugeViewModel.Valor = ultimaMedicionCargada.Valor; CompletarEscalasGauge(gaugeViewModel, ultimaMedicionCargada); } return(gaugeViewModel); }
public async Task <IViewComponentResult> InvokeAsync(int reportElementId) { GaugeDto gaugeDto = await _reportElementManager.GetGaugeById(reportElementId); GaugeViewModel result = _mapper.Map <GaugeDto, GaugeViewModel>(gaugeDto); return(View(result)); }
public MainPageViewModel() { HorizontalGauge = GaugeViewModel.Compass(GaugeUnit.Mils()); VerticalGauge = GaugeViewModel.Gradometer(GaugeUnit.Mils()); OrientationSensor.ReadingChanged += OrientationChanged; OrientationSensor.Start(SensorSpeed.Default); }
public async Task <IActionResult> UpdateGaugeHours(GaugeViewModel gaugeViewModel) { try { await _reportElementManager.UpdateReportElementHours(gaugeViewModel.Id, (int)gaugeViewModel.Hours); return(Ok("Sucessfully updated hours")); } catch (Exception ex) { return(Ok(ex.Message)); } }
/// <summary> /// Initializez the window and maps the event handlers to the events fired by the Machine package. /// </summary> public MainWindow() { InitializeComponent(); GaugeViewModel = new GaugeViewModel(); RamGauge.DataContext = GaugeViewModel; SetColumnNames(); FreeRamFramesLabel.Content = $"{_ramFrames} out of {_ramFrames}"; _processesBoarderGradient = new LinearGradientBrush( Color.FromRgb(95, 158, 160), Color.FromRgb(86, 71, 135), new Point(0, 0.5), new Point(1, 1) ); OS.RamFramesChanged += OnRamFramesChanged; OS.OsStateChanged += OnOsStateChanged; Counter.PropertyChanged += OnOsCounterPropertyChanged; }
private void CompletarEscalasGauge(GaugeViewModel gauge, MedicionViewModel medicion) { EscalaGraficosViewModel escalas = ObtenerEscalasGrafico(medicion.IndicadorViewModel); gauge.Escala = escalas.EscalaValores; gauge.Colores = escalas.EscalaColores; if (decimal.Parse(gauge.Valor.Replace(".", ",")) < gauge.Escala[0]) { string valor = (gauge.Escala[0] != 0 ? gauge.Escala[0].ToString().Replace(",", ".") : "0"); valor = (valor.Contains(".") ? valor.TrimEnd('0').TrimEnd('.') : valor); gauge.Valor = valor; } else if (decimal.Parse(gauge.Valor.Replace(".", ",")) > gauge.Escala[5]) { string valor = (gauge.Escala[5] != 0 ? gauge.Escala[5].ToString().Replace(",", ".") : "0"); valor = (valor.Contains(".") ? valor.TrimEnd('0').TrimEnd('.') : valor); gauge.Valor = valor; } }