using ArcGIS.Desktop.Framework.Contracts; using OliviaAddInPro.Model.contract; using System; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OliviaAddInPro { public class MarchandoUnaDeViewModel : PropertyChangedBase, IprocessManager { string[] barColors = {"Green","Red","Yellow" }; enum barColorNum { BarColorsVerde=0, BarColorsRojo, BarColorsAmarillo } public MarchandoUnaDeViewModel() { Cancelado = false; textBtn = "Cancelar"; enabBtn = true; colorBar = System.Windows.Media.Brushes.Green; } public bool Cancelado { get; set; } private string textProceso; public string TextProceso { get { return textProceso; } set { base.SetProperty(ref textProceso, value, () => TextProceso); } } private string textEstado; public string TextEstado { get { return textEstado; } set { base.SetProperty(ref textEstado, value, () => TextEstado); } } private string textBtn; public string TextBtn { get { return textBtn; } set { base.SetProperty(ref textBtn, value, () => TextBtn); } } private bool enabBtn; public bool EnabBtn { get { return enabBtn; } set { base.SetProperty(ref enabBtn, value, () => EnabBtn); } } private double progreso; public double Progreso { get { return progreso; } set { base.SetProperty(ref progreso, value, () => Progreso); } } private System.Windows.Media.Brush colorBar; public System.Windows.Media.Brush ColorBar { get { return colorBar; } set { base.SetProperty(ref colorBar, value, () => ColorBar); } } void IprocessManager.SetProceso(string proceso) { TextProceso = proceso; } void IprocessManager.Inicia() { Cancelado = false; TextBtn = "Cancelar"; EnabBtn = true; ColorBar = System.Windows.Media.Brushes.Green; } void IprocessManager.SetEstado(string estado) { TextEstado = estado; } void IprocessManager.SetTextBtn(string textbtn) { TextBtn = textbtn; } void IprocessManager.SetProgress(double progresPorcent) { Progreso = progresPorcent; } double IprocessManager.GetProgress() { return Progreso; } bool IprocessManager.Getcancelled() { return Cancelado; } void IprocessManager.Setcancelled() { CancelaOperacion(); } public void CancelaOperacion() { if(textBtn== "Cancelar") TextProceso = "Cancelando proceso"; else TextProceso = "Proceso finalizado."; Cancelado = true; //deshabilita el botón EnabBtn = false; } void IprocessManager.PonBarColorVerde() { ColorBar = System.Windows.Media.Brushes.Green; } void IprocessManager.PonBarColorRojo() { Progreso = 100; ColorBar = System.Windows.Media.Brushes.Red; } } }