예제 #1
0
 public EditProdctsViewModel(ProductsLuis productsLuis)
 {
     this.productsLuis = productsLuis;
     this.isEnabled    = true;
     this.apiService   = new ApiService();
     this.ImageSource  = productsLuis.ImageFullPath;
 }
예제 #2
0
 public MainViewModel()
 {
     instance         = this;
     this.apiService  = new Services.ApiService();
     this.dataService = new Services.DataService();
     this.Login       = new LoginViewModel();
     this.Version     = "© Agrolibano, " + Xamarin.Essentials.VersionTracking.CurrentVersion;
 }
예제 #3
0
        public ResultViewModel(bool IsReload, CommandItem commandItem)
        {
            if (IsReload)
            {
                ApiSrv           = new Services.ApiService(ApiConsult.ApiMenuB);
                this.CommandItem = commandItem;

                GetInitialData();
            }
        }
예제 #4
0
        public ControlSchedulesExecutionViewModel(bool IsReload, LogItem logItem)
        {
            if (IsReload)
            {
                ApiSrv       = new Services.ApiService(ApiConsult.ApiMenuB);
                this.LogItem = logItem;

                GetInitialData();
                //GetFakeData();
            }
        }
 public LogObservationsViewModel(bool IsReload, LotAndCommandObservation lotAndCommandData, LogItem logitem)
 {
     if (IsReload)
     {
         ApiSrv                 = new Services.ApiService(ApiConsult.ApiMenuB);
         this.LogItem           = logitem;
         this.LotAndCommandData = lotAndCommandData;
         SelectedObservation    = new ObservationItem();
         GetInitialData();
         //GetFakeData();
     }
 }
예제 #6
0
        public ProcessMonitorViewModel(bool IsReload)
        {
            if (IsReload)
            {
                ApiSrv = new Services.ApiService(ApiConsult.ApiMenuD);

                ToolBarIsVisible = false;
                CheckIcon        = "check";

                GetInitialData();
            }
        }
예제 #7
0
        public OperationsLogViewModel(bool IsReload)
        {
            if (IsReload)
            {
                ApiSrv = new Services.ApiService(ApiConsult.ApiMenuC);

                this.StartDateFromString = DateTime.Now.ToString(DateTimeFormatString.LatinDate);
                this.StartDateToString   = DateTime.Now.ToString(DateTimeFormatString.LatinDate);
                this.EndDateFromString   = DateTime.Now.ToString(DateTimeFormatString.LatinDate);
                this.EndDateToString     = DateTime.Now.ToString(DateTimeFormatString.LatinDate);

                GetInitialData();
            }
        }
예제 #8
0
        public DependenciesViewModel(bool IsReload, CommandItem commandItem)
        {
            if (IsReload)
            {
                ApiSrv = new Services.ApiService(ApiConsult.ApiMenuB);

                this.CommandItem                = commandItem;
                this.ListViewTitleLot           = string.Format("Lotes de los que depende ({0})", commandItem.NameLot.Split('-')[0].Trim());
                this.ListViewTitleLotDetail     = string.Format("Lotes que dependen de éste ({0})", commandItem.NameLot.Split('-')[0].Trim());
                this.ListViewTitleCommand       = string.Format("Lotes-Comandos de los que depende ({0}-{1})", commandItem.NameLot.Split('-')[0].Trim(), commandItem.NameCommand.Split('-')[0].Trim());
                this.ListViewTitleCommandDetail = string.Format("Lotes-Comandos que dependen de éste ({0}-{1})", commandItem.NameLot.Split('-')[0].Trim(), commandItem.NameCommand.Split('-')[0].Trim());

                GetInitialData();
            }
        }
예제 #9
0
 public ExecutionViewModel(bool IsReload, bool IsExecution)
 {
     if (IsReload)
     {
         ApiSrv                    = new Services.ApiService(ApiConsult.ApiMenuB);
         this.IsExecution          = IsExecution;
         this.ToolBarIsVisible     = false;
         this.ActionIcon           = "actions";
         this.CheckIcon            = "check";
         this.ViewIcon             = "view_b";
         this.FullViewIsVisible    = true;
         this.CompactViewIsVisible = false;
         this.IsVisibleEmptyView   = false;
         GetLogs();
     }
 }
예제 #10
0
        public LogInquiriesViewModel(bool IsReload, LogItem logitem)
        {
            if (IsReload)
            {
                ApiSrv = new Services.ApiService(ApiConsult.ApiMenuB);

                this.LogItem              = logitem;;
                this.NameLot              = "Seleccione un lote...";
                this.NameCommand          = "Seleccione un comando...";
                this.ResultIsVisible      = false;
                this.FormIsVisible        = true;
                this.LotSelectedIndex     = -1;
                this.CommandSelectedIndex = -1;

                GetInitialData();
                //GetFakeData();
            }
        }
예제 #11
0
        public LogExecutionViewModel(bool IsReload)
        {
            if (IsReload)
            {
                ApiSrv = new Services.ApiService(ApiConsult.ApiMenuA);

                this.StartDateString    = DateTime.Now.ToString(DateTimeFormatString.LatinDate);
                this.EndDateString      = DateTime.Now.ToString(DateTimeFormatString.LatinDate);
                this.WeekDays           = new WeekDays();
                this.WeekDays.Monday    = true;
                this.WeekDays.Tuesday   = true;
                this.WeekDays.Wednesday = true;
                this.WeekDays.Thursday  = true;
                this.WeekDays.Friday    = true;
                this.WeekDays.Saturday  = true;
                this.WeekDays.Sunday    = true;

                GetInitialData();
            }
        }
        public ExecutionStageTwoViewModel(bool IsReload, LogItem logitem)
        {
            if (IsReload)
            {
                ApiSrv                    = new Services.ApiService(ApiConsult.ApiMenuB);
                this.LogItem              = logitem;
                this.IsExecution          = logitem.IsExecution;
                this.ToolBarIsVisible     = false;
                this.ActionIcon           = "actions";
                this.CheckIcon            = "check";
                this.ViewIcon             = "view_b";
                this.FullViewIsVisible    = true;
                this.CompactViewIsVisible = false;
                this.IsVisibleEmptyView   = false;

                GetInstancesByLogAndUser(this.LogItem.IdLog, this.LogItem.IdUser, this.LogItem.IsEventual);

                //GetFakeData();
            }
        }
예제 #13
0
        public ExecutionStageThreeViewModel(bool IsReload, InstanceItem instanceitem)
        {
            if (IsReload)
            {
                ApiSrv                    = new Services.ApiService(ApiConsult.ApiMenuB);
                this.InstanceItem         = instanceitem;
                this.IsExecution          = instanceitem.LogItem.IsExecution;
                this.IsEventual           = instanceitem.LogItem.IsEventual;
                this.ToolBarIsVisible     = false;
                this.ActionIcon           = "actions";
                this.CheckIcon            = "check";
                this.ViewIcon             = "view_b";
                this.FullViewIsVisible    = true;
                this.CompactViewIsVisible = false;
                this.IsVisibleEmptyView   = false;

                GetCommandsByInstance(this.InstanceItem.IdInstance);

                //GetFakeData();
            }
        }
예제 #14
0
        private async void FingerPrint()
        {
            try
            {
                ApiSrv = new Services.ApiService(ApiConsult.ApiAuth);
                RefreshAppConfig();
                var request = new AuthenticationRequestConfiguration("Autenticación Biométrica", "ProBatch Mobile 2.0");
                var result  = await CrossFingerprint.Current.AuthenticateAsync(request);

                if (!result.Authenticated)
                {
                    return;
                }

                UserDialogs.Instance.ShowLoading("Iniciando sesión...", MaskType.Black);

                Table_User tableUserFingerPrint = await DBHelper.GetAsyncProbatchCredentials();

                if (tableUserFingerPrint == null)
                {
                    UserDialogs.Instance.HideLoading();
                    Toast.ShowError("No se pudo obtener las credenciales de ProBatch");
                    return;
                }

                try
                {
                    Response resultApiIsAvailable = await ApiSrv.ApiIsAvailable();

                    if (!resultApiIsAvailable.IsSuccess)
                    {
                        UserDialogs.Instance.HideLoading();
                        Toast.ShowError(resultApiIsAvailable.Message);
                        return;
                    }

                    Response resultToken = await ApiSrv.GetToken();

                    if (!resultToken.IsSuccess)
                    {
                        UserDialogs.Instance.HideLoading();
                        Toast.ShowError(resultToken.Message);
                        return;
                    }
                    else
                    {
                        Token   token   = JsonConvert.DeserializeObject <Token>(Crypto.DecodeString(resultToken.Data));
                        LoginPb loginPb = new LoginPb {
                            Username = Crypto.DecodeString(tableUserFingerPrint.Username), Password = Crypto.DecodeString(tableUserFingerPrint.Password)
                        };
                        Response resultLoginProbatch = await ApiSrv.AuthenticateProbath(token.Key, loginPb);

                        if (!resultLoginProbatch.IsSuccess)
                        {
                            UserDialogs.Instance.HideLoading();
                            Toast.ShowError(resultLoginProbatch.Message);
                            return;
                        }
                        else
                        {
                            PbUser = JsonConvert.DeserializeObject <PbUser>(Crypto.DecodeString(resultLoginProbatch.Data));
                            if (!PbUser.IsValid)
                            {
                                UserDialogs.Instance.HideLoading();
                                bool deleteFingerPrintRegister = await UserDialogs.Instance.ConfirmAsync("Credenciales inválidas, deseas eliminar el registro biométrico?", "AST●ProBatch®", "Si", "No");

                                if (deleteFingerPrintRegister)
                                {
                                    IsChecked = false;
                                    Table_Config table_Config = new Table_Config {
                                        Id = 1, UrlDomain = this.UrlDomain, UrlPrefix = this.UrlPrefix, FingerPrintAllow = IsChecked
                                    };
                                    if (!await DBHelper.PullAsyncAppConfig(table_Config))
                                    {
                                        Toast.ShowError("No se pudo actualizar la configuración.");
                                        return;
                                    }
                                    else
                                    {
                                        Table_User table_User = new Table_User {
                                            Id = 1, Username = string.Empty, Password = string.Empty
                                        };
                                        if (!await DBHelper.PullAsyncProbatchCredentials(table_User))
                                        {
                                            Toast.ShowError("No se pudo actualizar la configuración.");
                                            return;
                                        }
                                        else
                                        {
                                            IsVisibleLogin       = true;
                                            IsVisibleFingerPrint = false;
                                        }
                                    }
                                    return;
                                }
                            }
                            else
                            {
                                if (!IsChecked)
                                {
                                    Table_Config table_Config = new Table_Config {
                                        Id = 1, UrlDomain = this.UrlDomain, UrlPrefix = this.UrlPrefix, FingerPrintAllow = this.IsChecked
                                    };
                                    if (!await DBHelper.PullAsyncAppConfig(table_Config))
                                    {
                                        Toast.ShowError("No se pudo actualizar la configuración.");
                                        return;
                                    }
                                    else
                                    {
                                        Table_User table_User = new Table_User {
                                            Id = 1, Username = string.Empty, Password = string.Empty
                                        };
                                        if (!await DBHelper.PullAsyncProbatchCredentials(table_User))
                                        {
                                            Toast.ShowError("No se pudo actualizar la configuración.");
                                            return;
                                        }
                                        else
                                        {
                                            IsVisibleLogin       = true;
                                            IsVisibleFingerPrint = false;
                                        }
                                    }
                                }

                                UserDialogs.Instance.HideLoading();
                                this.Username = string.Empty;
                                this.Password = string.Empty;
                                MainViewModel.GetInstance().Home = new HomeViewModel();
                                Application.Current.MainPage = new NavigationPage(new HomePage());
                                Alert.Show("Bienvenido: " + PbUser.FisrtName.Trim() + ", " + PbUser.LastName.Trim() + "!", "Continuar");
                            }
                        }
                    }
                }
                catch //(Exception ex)
                {
                    UserDialogs.Instance.HideLoading();
                    Toast.ShowError("Ocurrió un error.");
                    return;
                }
            }
            catch //(Exception ex)
            {
                Toast.ShowError("Ocurrió un error datos locales.");
                return;
            }
        }
예제 #15
0
        private async void Login()
        {
            if (string.IsNullOrEmpty(this.Username))
            {
                Alert.Show("Debe ingresar un usuario");
                return;
            }

            if (string.IsNullOrEmpty(this.Password))
            {
                Alert.Show("Debe ingresar una contraseña");
                return;
            }

            if (IsChecked)
            {
                if (!IsFingerPrintAvailable)
                {
                    Alert.Show("Sensor de huella no disponible o no configurado.");
                    IsChecked = false;
                    return;
                }
                else
                {
                    var request = new AuthenticationRequestConfiguration("Autenticación Biométrica", "ProBatch Mobile 2.0");
                    var result  = await CrossFingerprint.Current.AuthenticateAsync(request);

                    if (!result.Authenticated)
                    {
                        this.Username = string.Empty;
                        this.Password = string.Empty;
                        IsChecked     = false;
                        return;
                    }
                }
            }

            ApiSrv = new Services.ApiService(ApiConsult.ApiAuth);
            RefreshAppConfig();

            try
            {
                UserDialogs.Instance.ShowLoading("Iniciando sesión...", MaskType.Black);

                Response resultApiIsAvailable = await ApiSrv.ApiIsAvailable();

                if (!resultApiIsAvailable.IsSuccess)
                {
                    UserDialogs.Instance.HideLoading();
                    Toast.ShowError(resultApiIsAvailable.Message);
                    return;
                }

                Response resultToken = await ApiSrv.GetToken();

                if (!resultToken.IsSuccess)
                {
                    UserDialogs.Instance.HideLoading();
                    Toast.ShowError(resultToken.Message);
                    return;
                }
                else
                {
                    Token   token   = JsonConvert.DeserializeObject <Token>(Crypto.DecodeString(resultToken.Data));
                    LoginPb loginPb = new LoginPb {
                        Username = this.Username, Password = this.Password
                    };
                    Response resultLoginProbatch = await ApiSrv.AuthenticateProbath(token.Key, loginPb);

                    if (!resultLoginProbatch.IsSuccess)
                    {
                        UserDialogs.Instance.HideLoading();
                        Toast.ShowError(resultLoginProbatch.Message);
                        return;
                    }
                    else
                    {
                        PbUser = JsonConvert.DeserializeObject <PbUser>(Crypto.DecodeString(resultLoginProbatch.Data));
                        if (!PbUser.IsValid)
                        {
                            UserDialogs.Instance.HideLoading();
                            //Alert.Show("Usuario y/o Password incorrectos");
                            this.IsEnabled = false;
                            this.IsEnabled = true;
                            return;
                        }
                        else
                        {
                            if (IsChecked)
                            {
                                Table_Config table_Config = new Table_Config {
                                    Id = 1, UrlDomain = this.UrlDomain, UrlPrefix = this.UrlPrefix, FingerPrintAllow = this.IsChecked
                                };
                                if (!await DBHelper.PullAsyncAppConfig(table_Config))
                                {
                                    UserDialogs.Instance.HideLoading();
                                    Toast.ShowError("No se pudo actualizar la configuración.");
                                    return;
                                }
                                else
                                {
                                    Table_User table_User = new Table_User {
                                        Id = 1, Username = Crypto.EncryptString(this.Username), Password = Crypto.EncryptString(this.Password)
                                    };
                                    if (!await DBHelper.PullAsyncProbatchCredentials(table_User))
                                    {
                                        UserDialogs.Instance.HideLoading();
                                        Toast.ShowError("No se pudo actualizar la configuración.");
                                        return;
                                    }
                                    else
                                    {
                                        IsVisibleLogin       = false;
                                        IsVisibleFingerPrint = true;
                                    }
                                }
                            }

                            UserDialogs.Instance.HideLoading();
                            this.Username = string.Empty;
                            this.Password = string.Empty;
                            MainViewModel.GetInstance().Home = new HomeViewModel();
                            Application.Current.MainPage = new NavigationPage(new HomePage());
                            Alert.Show("Bienvenido: " + PbUser.FisrtName.Trim() + ", " + PbUser.LastName.Trim() + "!", "Continuar");
                        }
                    }
                }
            }
            catch //(Exception ex)
            {
                UserDialogs.Instance.HideLoading();
                Toast.ShowError("Ocurrió un error.");
                return;
            }
        }
예제 #16
0
        private async void GetInitialData()
        {
            try
            {
                UserDialogs.Instance.ShowLoading("Obteniendo operadores...", MaskType.Black);
                ApiSrv = new Services.ApiService(ApiConsult.ApiMenuB);
                if (!await ApiIsOnline())
                {
                    UserDialogs.Instance.HideLoading();
                    Toast.ShowError(AlertMessages.Error);
                    return;
                }
                else
                {
                    if (!await GetTokenSuccess())
                    {
                        UserDialogs.Instance.HideLoading();
                        Toast.ShowError(AlertMessages.Error);
                        return;
                    }
                    else
                    {
                        TokenMenuB = TokenGet;
                        OperatorChangeUserQueryValues operatorChangeUserQueryValues = new OperatorChangeUserQueryValues()
                        {
                            CurrentIdUser = PbUser.IdUser
                        };
                        Response resultOperatorChangeGetUsers = await ApiSrv.GetOperatorChangeUsers(TokenMenuB.Key, operatorChangeUserQueryValues);

                        if (!resultOperatorChangeGetUsers.IsSuccess)
                        {
                            UserDialogs.Instance.HideLoading();
                            Toast.ShowError(AlertMessages.Error);
                            return;
                        }
                        else
                        {
                            Users          = JsonConvert.DeserializeObject <List <OperatorChangeUser> >(Crypto.DecodeString(resultOperatorChangeGetUsers.Data));
                            OperatorsItems = new ObservableCollection <PickerOperatorItem>();
                            foreach (OperatorChangeUser operatorChangeUser in Users)
                            {
                                OperatorsItems.Add(new PickerOperatorItem()
                                {
                                    IdUser       = operatorChangeUser.IdUser,
                                    FullNameUser = string.Format("{0}", operatorChangeUser.IdUser)
                                                   //string.Format("{0} ({1}, {2})", operatorChangeUser.IdUser, operatorChangeUser.FirstNameUser.Trim(), operatorChangeUser.LastNameUser.Trim())
                                });
                            }
                        }
                        UserDialogs.Instance.HideLoading();
                        UserDialogs.Instance.ShowLoading("Obteniendo instancias...", MaskType.Black);
                        OperatorChangeInstanceQueryValues operatorChangeInstanceQueryValues = new OperatorChangeInstanceQueryValues()
                        {
                            IdLog        = this.LogItem.IdLog,
                            IdUser       = PbUser.IdUser,
                            IsSupervisor = AppHelper.UserIsSupervisor(PbUser)
                        };
                        Response resultOperatorChangeGetInstances = await ApiSrv.GetOperatorChangeInstances(TokenMenuB.Key, operatorChangeInstanceQueryValues);

                        if (!resultOperatorChangeGetInstances.IsSuccess)
                        {
                            UserDialogs.Instance.HideLoading();
                            Toast.ShowError(resultOperatorChangeGetInstances.Message);
                            return;
                        }
                        else
                        {
                            Instances            = JsonConvert.DeserializeObject <List <OperatorChangeInstance> >(Crypto.DecodeString(resultOperatorChangeGetInstances.Data));
                            InstanceRunningItems = new ObservableCollection <InstanceRunningItem>();
                            foreach (OperatorChangeInstance operatorChangeInstance in Instances)
                            {
                                InstanceRunningItems.Add(new InstanceRunningItem()
                                {
                                    IdInstance     = operatorChangeInstance.IdInstance,
                                    NameInstance   = operatorChangeInstance.NameInstance,
                                    Running        = operatorChangeInstance.Running,
                                    RunningDisplay = (operatorChangeInstance.Running) ? Answers.Yes : Answers.No
                                });
                            }
                        }
                        UserDialogs.Instance.HideLoading();
                    }
                }
            }
            catch //(Exception ex)
            {
                UserDialogs.Instance.HideLoading();
                Toast.ShowError(AlertMessages.Error);
            }
        }
예제 #17
0
        private async void Save()
        {
            try
            {
                if (SelectedOperator == null)
                {
                    Alert.Show("Debe seleccionar un operador", "Aceptar");
                    return;
                }
                if (string.IsNullOrWhiteSpace(OperatorPassword))
                {
                    Alert.Show("Debe ingresar el password del operador", "Aceptar");
                    return;
                }
                UserDialogs.Instance.ShowLoading("Validando operador...", MaskType.Black);
                ApiSrv = new Services.ApiService(ApiConsult.ApiAuth);
                if (!await ApiIsOnline())
                {
                    UserDialogs.Instance.HideLoading();
                    Toast.ShowError(AlertMessages.Error);
                    return;
                }
                else
                {
                    if (!await GetTokenSuccess())
                    {
                        UserDialogs.Instance.HideLoading();
                        Toast.ShowError(AlertMessages.Error);
                        return;
                    }
                    else
                    {
                        TokenPbAuth = TokenGet;
                        LoginPb loginPb = new LoginPb {
                            Username = this.SelectedOperator.IdUser, Password = this.OperatorPassword
                        };
                        Response resultValidateOperator = await ApiSrv.AuthenticateProbath(TokenPbAuth.Key, loginPb);

                        if (!resultValidateOperator.IsSuccess)
                        {
                            UserDialogs.Instance.HideLoading();
                            Toast.ShowError(resultValidateOperator.Message);
                            return;
                        }
                        else
                        {
                            OperatorObject operatorObject = JsonConvert.DeserializeObject <OperatorObject>(Crypto.DecodeString(resultValidateOperator.Data));
                            if (!operatorObject.IsValid)
                            {
                                UserDialogs.Instance.HideLoading();
                                Alert.Show(AlertMessages.UserInvalid);
                                return;
                            }
                            else
                            {
                                UserDialogs.Instance.HideLoading();
                                UserDialogs.Instance.ShowLoading("Validando instancias...", MaskType.Black);
                                ApiSrv = new Services.ApiService(ApiConsult.ApiMenuB);
                                if (!TokenValidator.IsValid(TokenMenuB))
                                {
                                    if (!await ApiIsOnline())
                                    {
                                        UserDialogs.Instance.HideLoading();
                                        Toast.ShowError(AlertMessages.Error);
                                        return;
                                    }
                                    else
                                    {
                                        if (!await GetTokenSuccess())
                                        {
                                            UserDialogs.Instance.HideLoading();
                                            Toast.ShowError(AlertMessages.Error);
                                            return;
                                        }
                                        else
                                        {
                                            TokenMenuB = TokenGet;
                                        }
                                    }
                                }
                                StringBuilder Instances        = new StringBuilder();
                                StringBuilder InstancesRunning = new StringBuilder();
                                foreach (InstanceRunningItem instanceRunningItem in InstanceRunningItems)
                                {
                                    Instances.Append(instanceRunningItem.IdInstance);
                                    Instances.Append(",");
                                    if (string.Compare(instanceRunningItem.RunningDisplay, "SI") == 0)
                                    {
                                        InstancesRunning.Append(instanceRunningItem.IdInstance);
                                        InstancesRunning.Append(",");
                                    }
                                }
                                if (!AppHelper.UserIsSupervisor(operatorObject))
                                {
                                    OperatorChangeUserIsInAllInstancesQueryValues operatorChangeUserIsInAllInstancesQueryValues = new OperatorChangeUserIsInAllInstancesQueryValues()
                                    {
                                        IdLog     = this.LogItem.IdLog,
                                        IdUser    = PbUser.IdUser,
                                        Instances = Instances.ToString()
                                    };
                                    Response resultOperatorChangeUserIsInAllInstances = await ApiSrv.GetOperatorChangeUserIsInAllInstances(TokenMenuB.Key, operatorChangeUserIsInAllInstancesQueryValues);

                                    if (!resultOperatorChangeUserIsInAllInstances.IsSuccess)
                                    {
                                        UserDialogs.Instance.HideLoading();
                                        Toast.ShowError(AlertMessages.Error);
                                        return;
                                    }
                                    else
                                    {
                                        UserInInstances = JsonConvert.DeserializeObject <List <OperatorChangeUserIsInAllInstances> >(Crypto.DecodeString(resultOperatorChangeUserIsInAllInstances.Data));
                                        if (!UserInInstances[0].UserIsInAllInstances)
                                        {
                                            UserDialogs.Instance.HideLoading();
                                            Alert.Show(string.Format("Usted no tiene permisos para ejecutar en todas las instancias que tiene asignada el operador: {0}", PbUser.IdUser), "Aceptar");
                                            return;
                                        }
                                    }
                                }
                                if (InstancesRunning.Length > 0)
                                {
                                    UserDialogs.Instance.HideLoading();
                                    UserDialogs.Instance.ShowLoading("Cambiando al operador seleccionado...", MaskType.Black);
                                    ApiSrv = new Services.ApiService(ApiConsult.ApiMenuB);
                                    if (!TokenValidator.IsValid(TokenMenuB))
                                    {
                                        if (!await ApiIsOnline())
                                        {
                                            UserDialogs.Instance.HideLoading();
                                            Toast.ShowError(AlertMessages.Error);
                                            return;
                                        }
                                        else
                                        {
                                            if (!await GetTokenSuccess())
                                            {
                                                UserDialogs.Instance.HideLoading();
                                                Toast.ShowError(AlertMessages.Error);
                                                return;
                                            }
                                            else
                                            {
                                                TokenMenuB = TokenGet;
                                            }
                                        }
                                    }
                                    //string MyIp;
                                    //foreach (IPAddress iPAddress in Dns.GetHostAddresses(Dns.GetHostName()))
                                    //{
                                    //    MyIp = iPAddress.ToString();
                                    //}
                                    OperatorChangeQueryValues operatorChangeQueryValues = new OperatorChangeQueryValues()
                                    {
                                        IdLog     = this.LogItem.IdLog,
                                        NewIdUser = operatorObject.IdUser,
                                        Instances = Instances.ToString(),
                                        OldIdUser = PbUser.IdUser,
                                        StartDate = ConvertStartDateToSp(this.LogItem.ExecutionDateTime),
                                        ClientIp  = "127.0.0.1"
                                    };
                                    Response resultOperatorChange = await ApiSrv.GetOperatorChange(TokenMenuB.Key, operatorChangeQueryValues);

                                    if (!resultOperatorChange.IsSuccess)
                                    {
                                        UserDialogs.Instance.HideLoading();
                                        Toast.ShowError(AlertMessages.Error);
                                        return;
                                    }
                                    else
                                    {
                                        OperatorChanges = JsonConvert.DeserializeObject <List <OperatorChange> >(Crypto.DecodeString(resultOperatorChange.Data));
                                        if (!OperatorChanges[0].IsSuccess)
                                        {
                                            UserDialogs.Instance.HideLoading();
                                            Alert.Show(string.Format("Ocurrió un error al intentar cambiar el operador actual por: {0}", operatorObject.IdUser), "Aceptar");
                                            return;
                                        }
                                        this.SelectedOperator = null;
                                        this.OperatorPassword = string.Empty;
                                        UserDialogs.Instance.HideLoading();
                                        Alert.Show(string.Format("Cambio de operador satisfactorio!"), "Aceptar");
                                    }
                                }
                                else
                                {
                                    UserDialogs.Instance.HideLoading();
                                    Alert.Show(string.Format("No hay instancias en ejecución!"), "Aceptar");
                                }
                            }
                        }
                    }
                }
            }
            catch //(Exception ex)
            {
                Toast.ShowError(AlertMessages.Error);
            }
        }