Example #1
0
        private void Wclient_UploadValuesCompleted(object sender, System.Net.UploadValuesCompletedEventArgs e)
        {
            try
            {
                string          json = Encoding.UTF8.GetString(e.Result);
                OperationResult or   = JsonConvert.DeserializeObject <OperationResult>(json);


                if (or.error)
                {
                    // Ha ocurrido un error!
                    RunOnUiThread(() =>
                    {
                        mTextError.Text       = "Ah ocurrido un error al realizar el registro\nPor favor, intente nuevamente mas tarde";
                        mTextError.Visibility = ViewStates.Visible;
                    });
                }
                else
                {
                    // Cargo la vista de Registro de Vehiculo
                    Managment.ActivityManager.TakeMeTo(this, typeof(RegisterVehicleActivity), false);
                }
            } catch (Exception ex)
            {
                Managment.ActivityManager.ShowError(this, new Error(errCode, errMsg));
            }
        }
Example #2
0
        private void Wclient_UploadValuesCompleted(object sender, System.Net.UploadValuesCompletedEventArgs e)
        {
            try
            {
                string          json = Encoding.UTF8.GetString(e.Result);
                OperationResult op   = JsonConvert.DeserializeObject <OperationResult>(json);

                // Elimina las posiciones de ese Usuario
                ClearUserPositions();

                // Levantar Dialog de Agradecimiento y Cerrar la Aplicacion
                FragmentTransaction trans = FragmentManager.BeginTransaction();
                mDialogParkingOk = new DialogParkingOk();
                mDialogParkingOk.Show(trans, "iParking");
                mDialogParkingOk.mCancelEvent += (object o, OnCancelEvent cancelEvent) =>
                {
                    // Cierro la Aplicacion
                    Kill();
                    Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
                };
            }
            catch (Exception ex)
            {
                Console.WriteLine("** Error al tratar de Apagar la Aplicacion **");
            }
        }
        private void Wclient_UploadValuesCompleted(object sender, System.Net.UploadValuesCompletedEventArgs e)
        {
            try
            {
                string          json = Encoding.UTF8.GetString(e.Result);
                OperationResult or   = JsonConvert.DeserializeObject <OperationResult>(json);

                if (or.error)
                {
                    // El Login dio mal
                    mTextError.Visibility = ViewStates.Visible;
                }
                else
                {
                    // Login Correcto, Redirecciono a Selector de Vehiculo
                    mFile = new Managment.FileManager();
                    mFile.SetValue("id", or.data.ToString());
                    mFile.SetValue("email", mClient.email);
                    mFile.SetValue("password", mClient.HashPassword());

                    Managment.ActivityManager.TakeMeTo(this, typeof(VehicleActivity), true);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(" ** ERROR ** : " + ex.Message);
                mTextError.Text       = "Lo sentimos, ha ocurrido un error\nAguarde unos minutos e intente nuevamente";
                mTextError.Visibility = ViewStates.Visible;
            }
            finally
            {
                mProgressBar.Visibility = ViewStates.Invisible;
            }
        }
        private void UploadComplete(object sender, System.Net.UploadValuesCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                string   result = Encoding.UTF8.GetString(e.Result);
                string[] parts  = result.Split('#');

                int    rank = int.Parse(parts[0]);
                int    numberOfParticipants = int.Parse(parts[1]);
                string leaderboard          = parts[2];

                CurrentSession.Person.Rank          = rank;
                CurrentSession.NumberOfParticipants = numberOfParticipants;

                Leaderboard = DataLayer.ParseLeaderboard(leaderboard);
            }
            else
            {
                string message = Strings.ErrorOccuredServer + Environment.NewLine +
                                 e.Error.Message + Environment.NewLine + Strings.TryAgain;

                System.Windows.MessageBox.Show(message, "Nergiz Quiz");
            }
            Page = new FinishPage();
        }
Example #5
0
        private void UploadComplete(object sender, System.Net.UploadValuesCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                string   result = Encoding.UTF8.GetString(e.Result);
                string[] parts  = result.Split('#');

                int numberOfParticipants = int.Parse(parts[1]);
                CurrentSession.NumberOfParticipants = numberOfParticipants;
            }
            else
            {
                string message = Strings.ErrorOccuredServer + Environment.NewLine +
                                 e.Error.Message + Environment.NewLine + Strings.TryAgain;

                System.Windows.MessageBox.Show(message, "Quiz Application");
            }
            Page = new FinishPage();
        }
Example #6
0
        public static void OnUploadValuesCompleted(object sender, System.Net.UploadValuesCompletedEventArgs e)
        {
            if (e.Cancelled == true)
            {
                // MessageBox.Show("Download has been canceled.");
                System.Console.WriteLine("Download has been canceled.");
                return;
            }
            else if (e.Error != null)
            {
                throw e.Error;
            }

            byte[] ba = e.Result;
            System.Console.WriteLine(ba != null);
            // string s = client.Encoding.GetString(ba);
            // string s = System.Text.Encoding.UTF8.GetString(ba);

            string userState = (string)e.UserState;

            System.Console.WriteLine("UserState: \"{0}\".", userState);
        }
Example #7
0
        private void Wclient_UploadValuesCompleted(object sender, System.Net.UploadValuesCompletedEventArgs e)
        {
            try
            {
                string          json = Encoding.UTF8.GetString(e.Result);
                OperationResult or   = JsonConvert.DeserializeObject <OperationResult>(json);

                if (or.error)
                {
                    // Ocurrio un error
                    Console.WriteLine("** Error ** : No se pudo agregar el vehiculo ");
                }
                else
                {
                    getClientVehicles();
                }
            }
            catch (Exception ex)
            {
                Managment.ActivityManager.ShowError(this, new Error(errCode, errMsg));
            }
        }
Example #8
0
        private void Wclient_UploadValuesCompleted(object sender, System.Net.UploadValuesCompletedEventArgs e)
        {
            try
            {
                string          json = Encoding.UTF8.GetString(e.Result);
                OperationResult or   = JsonConvert.DeserializeObject <OperationResult>(json);

                if (or.error)
                {
                    // Existen los datos, pero no son correctos. Redirecciono a Login
                    fm.Clear();
                    Managment.ActivityManager.TakeMeTo(this, typeof(LoginActivity), true);
                }
                else
                {
                    // Existen los datos y son correctos. Redirecciono a Selector de Vehiculo
                    Managment.ActivityManager.TakeMeTo(this, typeof(VehicleActivity), true);
                }
            } catch (Exception ex)
            {
                Managment.ActivityManager.TakeMeTo(this, typeof(LoginActivity), true);
            }
        }
Example #9
0
        private void Wclient_UploadValuesCompleted(object sender, System.Net.UploadValuesCompletedEventArgs e)
        {
            try
            {
                string          json = Encoding.UTF8.GetString(e.Result);
                OperationResult or   = JsonConvert.DeserializeObject <OperationResult>(json);

                if (or.error)
                {
                    // Ha ocurrido un error!
                    Managment.ActivityManager.TakeMeTo(this, typeof(ErrorActivity), true);
                }
                else
                {
                    // Vuelvo a la Pagina de Opciones
                    Managment.ActivityManager.TakeMeTo(this, typeof(MoreOptionsActivity), true);
                }
            } catch (Exception ex)
            {
                Console.WriteLine("** Error de Actualizacion ( Perfil ) ** : " + ex.Message);
                Managment.ActivityManager.TakeMeTo(this, typeof(ErrorActivity), true);
            }
        }
Example #10
0
 protected virtual void OnUploadValuesCompleted(System.Net.UploadValuesCompletedEventArgs e)
 {
 }