Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.TransportOrderDetails);
            GetWidgetIDs();

            hintTextView.Text = GetString(Resource.String.scanLe);

            username = LoginActivity.LoadUser();
            user     = WSWmsHelper.GetAllUsers().First(u => u.Login == username);

            fotoButton.Text       = GetString(Resource.String.fotobtn);
            fotoButton.Visibility = BUTTON_INVISIBLE;
            fotoButton.Click     += FotoButton_Click;

            wiegenButton.Text       = GetString(Resource.String.wiegenBtn);
            wiegenButton.Visibility = BUTTON_INVISIBLE;
            wiegenButton.Click     += WiegenButton_Click;

            printButton.Text       = GetString(Resource.String.menuBtnPrintLabels).ToUpper(); ///etiketten
            printButton.Visibility = BUTTON_INVISIBLE;
            printButton.Click     += PrintButton_Click;

            nextButton.Text       = GetString(Resource.String.btnNext_txt);
            nextButton.Visibility = FastFinishTransport ? BUTTON_INVISIBLE : ViewStates.Visible;
            nextButton.Click     += NextButton_Click;

            btnBinEmpty.Text       = GetString(Resource.String.btnTitleBinEmpty).ToUpper();
            btnBinEmpty.Click     += BtnBinEmpty_Click;;
            btnBinEmpty.Visibility = BUTTON_INVISIBLE;

            btnBinFull.Text       = GetString(Resource.String.btnTitleBinFull).ToUpper();
            btnBinFull.Visibility = BUTTON_INVISIBLE;
            btnBinFull.Click     += BtnBinFull_Click;;

            UnpackBundle(null);
            Load();


            btnKeyboard.Click     += BtnKeyboard_Click;
            scanEditText.KeyPress += ScanEditText_KeyPress;
            scanEditText.InputType = Android.Text.InputTypes.Null;

            SetTitle(Resource.String.labelTransportOrderDetails);
        }
        private void InitLogin()
        {
            editTextPort.Visibility     = tvPortLbl.Visibility = ViewStates.Gone;
            spinnerLoginName.Visibility = tvUserLbl.Visibility = ViewStates.Visible;

            btnLogin.Text      = GetString(Resource.String.btnLogin_txt);
            tvPasswordLbl.Text = GetString(Resource.String.lblPassword_txt);
            btnSettings.SetText(Resource.String.btnSettings_txt);

            txtPassword.InputType = InputTypes.ClassText | InputTypes.TextVariationPassword;
            txtPassword.Text      = string.Empty;

            if (!loadUsers || null == spinnerLoginName)
            {
                btnRefresh.Enabled = false;
                return;
            }

            btnRefresh.Enabled = true;

            try
            {
                List <UserDto> usersList = WSWmsHelper.GetAllUsers();
                if (null == usersList)
                {
                    return;
                }

                if (0 < usersList.Count)
                {
                    string savedLogin = LoadUser();

                    int      idx             = 0;
                    int      selectedUserIdx = -1;
                    string[] spinnerItems    = new string[usersList.Count];
                    foreach (UserDto udr in usersList)
                    {
                        if (string.Empty != savedLogin && udr.Login == savedLogin)
                        {
                            selectedUserIdx = idx;
                        }
                        spinnerItems[idx++] = udr.Login;
                    }

                    CustomArrayAdapter adapter = new CustomArrayAdapter(this, spinnerItems.ToList());
                    spinnerLoginName.Adapter = adapter;

                    if (-1 != selectedUserIdx)
                    {
                        spinnerLoginName.SetSelection(selectedUserIdx);
                    }
                }
            }
            catch (WebException wex)
            {
                string msgWSnotAvailable = GetString(Resource.String.msgWSnotAvailable);
                new AlertDialog.Builder(this).SetTitle(msgWSnotAvailable)
                .SetMessage(GetString(Resource.String.msgActivateInetWSandTryAgain))
                .SetPositiveButton(GetString(Resource.String.Ok), (s, e) => { Recreate(); })
                .Show();
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, ex.Message, ToastLength.Long).Show();
            }
        }