Exemple #1
0
 private void RadioButtonDef_Click(object sender, EventArgs e)
 {
     try
     {
         if (isEdit == true)
         {
             UpdateDataToServer();
         }
         if (isShortList == true)
         {
             CreatePositionsData(orderId);
             SetupPositionsRecyclerView();
         }
         positionsList = positionsList.Where(a => a.Rate != a.Norm || a.Id == 0).ToList();
         RunOnUiThread(() => codeInput.Text     = "");
         RunOnUiThread(() => quentityInput.Text = "");
         RunOnUiThread(() => weightInput.Text   = "");
         MainThread.BeginInvokeOnMainThread(() =>
         {
             adapterPosition            = new PositionsAdapter(positionsList);
             adapterPosition.ItemClick += OnPositionClick;
             ordersRecyclerView.SetAdapter(adapterPosition);
             ordersRecyclerView.ScrollToPosition(0);
         });
         codeInput.ClearFocus();
         quentityInput.ClearFocus();
         weightInput.ClearFocus();
         isEdit      = false;
         isShortList = true;
     }
     catch (Exception ex)
     {
         ErrorMessage("MainActivity - RadioButtonDef_Click :" + ex.Message);
     }
 }
Exemple #2
0
        protected override void OnResume()
        {
            base.OnResume();

            _txtNewFileName?.ClearFocus();
            SubscribeEvents();
        }
Exemple #3
0
        public void Binding_TwoWayFromViewModelToEditTextWithObserveEvent_BindingGetsUpdated()
        {
            var vm = new TestViewModel
            {
                Model = new TestModel()
            };

            var control1 = new EditText(Application.Context);

            _binding = new Binding <string, string>(
                vm,
                () => vm.Model.MyProperty,
                control1,
                () => control1.Text,
                BindingMode.TwoWay)
                       .ObserveTargetEvent(UpdateTriggerMode.LostFocus);

            Assert.AreEqual(null, vm.Model.MyProperty);
            Assert.AreEqual(string.Empty, control1.Text);
            var value = DateTime.Now.Ticks.ToString();

            vm.Model.MyProperty = value;
            Assert.AreEqual(value, vm.Model.MyProperty);
            Assert.AreEqual(vm.Model.MyProperty, control1.Text);

            var newValue = value + "Suffix";

            control1.RequestFocus();
            control1.Text = newValue;
            Assert.AreEqual(newValue, control1.Text);
            Assert.AreEqual(value, vm.Model.MyProperty);
            control1.ClearFocus();
            Assert.AreEqual(newValue, vm.Model.MyProperty);
        }
Exemple #4
0
        void HandleTimeSet(object sender, TimePickerDialog.TimeSetEventArgs e)
        {
            DateTime dt = DateTime.Parse(etDate.Text + " " + e.HourOfDay.ToString() + ":" + e.Minute);

            setDateAndTimeField(dt);
            etTime.ClearFocus();
        }
Exemple #5
0
        public void Binding_TwoWayFromEditTextToEditTextWithObserveEvent_BindingGetsUpdated()
        {
            var control1 = new EditText(Application.Context);
            var control2 = new EditText(Application.Context);

            _binding = new Binding <string, string>(
                control1,
                () => control1.Text,
                control2,
                () => control2.Text,
                BindingMode.TwoWay)
                       .ObserveSourceEvent(UpdateTriggerMode.LostFocus)
                       .ObserveTargetEvent(UpdateTriggerMode.LostFocus);

            Assert.AreEqual(string.Empty, control1.Text);
            Assert.AreEqual(string.Empty, control2.Text);
            var value = DateTime.Now.Ticks.ToString();

            control1.RequestFocus();
            control1.Text = value;
            Assert.AreEqual(value, control1.Text);
            Assert.AreEqual(string.Empty, control2.Text);
            control1.ClearFocus();
            Assert.AreEqual(control1.Text, control2.Text);

            var newValue = value + "Suffix";

            control2.RequestFocus();
            control2.Text = newValue;
            Assert.AreEqual(newValue, control2.Text);
            Assert.AreEqual(value, control1.Text);
            control2.ClearFocus();
            Assert.AreEqual(control2.Text, control1.Text);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.LogIn);

            txtUserName = FindViewById <EditText>(Resource.Id.txtUserName);
            txtPassword = FindViewById <EditText>(Resource.Id.txtPassword);

            mCheckBox = FindViewById <CheckBox>(Resource.Id.ckbRememberMe);

            txtUserName.ClearFocus();
            txtPassword.ClearFocus();

            btnSignIn = FindViewById <Button>(Resource.Id.btnSignIn);
            btnLogIn  = FindViewById <Button>(Resource.Id.btnLogIn);

            //remove keyboar on click anywhere
            mLinearLayout        = FindViewById <LinearLayout>(Resource.Id.LogInID);
            mLinearLayout.Click += MLinearLayout_Click;

            btnSignIn.Click += btnSignIn_Click;
            btnLogIn.Click  += BtnLogIn_Click;

            txtUserName.FocusChange += TxtUserName_FocusChange;
            txtPassword.FocusChange += TxtPassword_FocusChange;
        }
        private void ExitSearchUi()
        {
            searchView.Text = String.Empty;

            if (mSearchFragment != null)
            {
                mSearchFragment.UserVisibleHint = false;

                var transaction = SupportFragmentManager
                                  .BeginTransaction();
                transaction.Remove(mSearchFragment);
                mSearchFragment = null;
                transaction.CommitAllowingStateLoss();
            }

            HideInputMethod(CurrentFocus);
            searchView?.ClearFocus();
            mActionMode?.Finish();
            //locSpinner?.Parent?.RequestFocus();
            inSearchUI = false;

            // Reset to last selected item
            if (query_vm == null && selectedItem != null)
            {
                locSpinner.SetSelection(locAdapter.GetPosition(selectedItem));
            }

            // Set scroll flag
            var toolbarParams = collapsingToolbar.LayoutParameters as AppBarLayout.LayoutParams;

            toolbarParams.ScrollFlags &= AppBarLayout.LayoutParams.ScrollFlagScroll;
        }
Exemple #8
0
        public void Binding_TwoWayFromEditTextToCheckBoxWithObserveEvent_BindingGetsUpdated()
        {
            var control1 = new EditText(Application.Context);
            var control2 = new CheckBox(Application.Context);

            _binding = new Binding <string, bool>(
                control1,
                () => control1.Text,
                control2,
                () => control2.Checked,
                BindingMode.TwoWay)
                       .ObserveSourceEvent(UpdateTriggerMode.LostFocus)
                       .ObserveTargetEvent(); // LostFocus doesn't work programatically with CheckBoxes

            Assert.AreEqual(string.Empty, control1.Text);
            Assert.IsFalse(control2.Checked);
            var value = "True";

            control1.RequestFocus();
            control1.Text = value;
            Assert.AreEqual(value, control1.Text);
            Assert.IsFalse(control2.Checked);
            control1.ClearFocus();
            Assert.IsTrue(control2.Checked);

            control2.Checked = false;
            Assert.IsFalse(control2.Checked);
            Assert.AreEqual("False", control1.Text);
        }
 public override void OnClick(IDialogInterface dialog, int which)
 {
     switch ((DialogButtonType)which)
     {
     case DialogButtonType.Positive:
         if (!int.TryParse(EditText.Text, out int result))
         {
             InvalidInput?.Invoke(this, new InvalidInputEventArgs("Please enter a valid number"));
             EditText.ClearFocus();
         }
         else if (result < MinValue)
         {
             InvalidInput?.Invoke(this, new InvalidInputEventArgs("Value must be at least " + MinValue));
             EditText.ClearFocus();
         }
         else if (result > MaxValue)
         {
             InvalidInput?.Invoke(this, new InvalidInputEventArgs("Value must be at most " + MaxValue));
             EditText.ClearFocus();
         }
         else
         {
             base.OnClick(dialog, which);
         }
         break;
     }
 }
        public static void ApplyTo(EditText addressTextField, EditText numberTextField, Func <Address> currentAddress, Action <string> streetNumberOfAddressUpdated)
        {
            numberTextField.Text = "";

            numberTextField.EditorAction += (s, e) =>
            {
                if (e.ActionId == ImeAction.Done)
                {
                    numberTextField.ClearFocus();
                }
            };

            numberTextField.FocusChange += (s, e) =>
            {
                if (e.HasFocus)
                {
                    FocusOnNumber(addressTextField, numberTextField, currentAddress);
                    numberTextField.ShowKeyboard();
                }
                else
                {
                    var currentAddressValue = currentAddress();
                    currentAddressValue.ChangeStreetNumber(numberTextField.Text);

                    var newFullAddress = currentAddressValue.DisplayAddress;
                    if (streetNumberOfAddressUpdated != null)
                    {
                        streetNumberOfAddressUpdated(numberTextField.Text);
                    }
                    addressTextField.Text = newFullAddress;
                    numberTextField.Text  = "";
                    numberTextField.HideKeyboard();
                }
            };
        }
Exemple #11
0
 private void CleanInputs()
 {
     usernameTxt.Text = "";
     passwordTxt.Text = "";
     usernameTxt.ClearFocus();
     passwordTxt.ClearFocus();
 }
        public void Binding_TwoWayFromCheckBoxToEditTextWithUpdateTrigger_BindingGetsUpdated()
        {
            var control1 = new EditText(Application.Context);
            var control2 = new CheckBox(Application.Context);

            _binding = new Binding <bool, string>(
                control2,
                () => control2.Checked,
                control1,
                () => control1.Text,
                BindingMode.TwoWay)
                       .UpdateSourceTrigger() // LostFocus doesn't work programatically with CheckBoxes
                       .ObserveTargetEvent(UpdateTriggerMode.LostFocus);

            Assert.AreEqual("False", control1.Text);
            Assert.IsFalse(control2.Checked);
            control2.Checked = true;
            Assert.IsTrue(control2.Checked);
            Assert.AreEqual("True", control1.Text);

            var value = "False";

            control1.RequestFocus();
            control1.Text = value;
            Assert.AreEqual(value, control1.Text);
            Assert.IsTrue(control2.Checked);
            control1.ClearFocus();
            Assert.IsFalse(control2.Checked);
        }
        private void ClearFocus()
        {
            if (txtA1.IsFocused || txtA2.IsFocused || txtA3.IsFocused || txtA4.IsFocused || txtA5.IsFocused ||
                txtB1.IsFocused || txtB2.IsFocused || txtB3.IsFocused || txtB4.IsFocused || txtB5.IsFocused ||
                txtC1.IsFocused || txtC2.IsFocused || txtC3.IsFocused || txtC4.IsFocused || txtC5.IsFocused ||
                formulaEdit.IsFocused)
            {
                txtA1.ClearFocus();
                txtA2.ClearFocus();
                txtA3.ClearFocus();
                txtA4.ClearFocus();
                txtA5.ClearFocus();
                txtB1.ClearFocus();
                txtB2.ClearFocus();
                txtB3.ClearFocus();
                txtB4.ClearFocus();
                txtB5.ClearFocus();
                txtC1.ClearFocus();
                txtC2.ClearFocus();
                txtC3.ClearFocus();
                txtC4.ClearFocus();
                txtC5.ClearFocus();
                formulaEdit.ClearFocus();
            }

            Activity           activity           = (Activity)_context;
            InputMethodManager inputMethodManager = (InputMethodManager)activity.GetSystemService(Activity.InputMethodService);

            if (activity.CurrentFocus != null)
            {
                inputMethodManager.HideSoftInputFromWindow(activity.CurrentFocus.WindowToken, 0);
            }
        }
        public override void SetListeners()
        {
            EditPin.FocusChange += delegate
            {
                ChangeFocusColor();
            };

            EditPin.AfterTextChanged += delegate
            {
                // grab all text from edit text
                RetrieveScreenInput();
                UpdateScreen();
                // assign pin numbers to TextViews for show
                for (int x = 0; x <= 3; x++)
                {
                    TxtPinArray[x].Text = PinLength >= x + 1 ? EnteredPin[x].ToString() : string.Empty;
                }

                ChangeFocusColor();

                this.LoginButton.Enabled = PinLength >= 4;
                // if 4 numbers, hide the keyboard and focus the login button
                if (PinLength == 4)
                {
                    EditPin.ClearFocus();
                    HideKeyboard(true);
                    this.LoginButton.RequestFocus();
                }
            };
        }
Exemple #15
0
        public void Binding_OneWayFromEditTextToViewModelWithObserveEvent_BindingGetsUpdated()
        {
            var vm = new TestViewModel
            {
                Model = new TestModel()
            };

            var control1 = new EditText(Application.Context);

            _binding = new Binding <string, string>(
                control1,
                () => control1.Text,
                vm,
                () => vm.Model.MyProperty)
                       .ObserveSourceEvent(UpdateTriggerMode.LostFocus);

            Assert.AreEqual(string.Empty, control1.Text);
            Assert.AreEqual(string.Empty, vm.Model.MyProperty);
            var value = DateTime.Now.Ticks.ToString();

            control1.RequestFocus();
            control1.Text = value;
            Assert.AreEqual(value, control1.Text);
            Assert.AreEqual(string.Empty, vm.Model.MyProperty);
            control1.ClearFocus();
            Assert.AreEqual(control1.Text, vm.Model.MyProperty);
        }
Exemple #16
0
 private void OnTextFieldEditorActionListener(object sender, TextView.EditorActionEventArgs e)
 {
     if (e.ActionId == ImeAction.Done)
     {
         TextField.ClearFocus();
     }
 }
Exemple #17
0
        public void Binding_TwoWayFromEditTextToViewModelWithUpdateTrigger_BindingGetsUpdated()
        {
            var vm = new TestViewModel
            {
                Model = new TestModel()
            };

            var control1 = new EditText(Application.Context);

            _binding = new Binding <string, string>(
                control1,
                () => control1.Text,
                vm,
                () => vm.Model.StringProperty,
                BindingMode.TwoWay)
                       .UpdateSourceTrigger(UpdateTriggerMode.LostFocus);

            Assert.AreEqual(string.Empty, control1.Text);
            Assert.AreEqual(string.Empty, vm.Model.StringProperty);
            var value = DateTime.Now.Ticks.ToString();

            control1.RequestFocus();
            control1.Text = value;
            Assert.AreEqual(value, control1.Text);
            Assert.AreEqual(string.Empty, vm.Model.StringProperty);
            control1.ClearFocus();
            Assert.AreEqual(control1.Text, vm.Model.StringProperty);

            value += "Suffix";
            vm.Model.StringProperty = value;
            Assert.AreEqual(value, vm.Model.StringProperty);
            Assert.AreEqual(vm.Model.StringProperty, control1.Text);
        }
        private void OnParentTap()
        {
            _txtNota.ClearFocus();
            var inputManager = _docView.GetSystemService(Context.InputMethodService) as InputMethodManager;

            inputManager.HideSoftInputFromWindow(_txtNota.WindowToken, HideSoftInputFlags.None);
        }
Exemple #19
0
        void DismissKeyboard()
        {
            InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);

            imm.HideSoftInputFromWindow(editText.WindowToken, 0);
            editText.ClearFocus();
        }
Exemple #20
0
        public static void ApplyTo(EditText editText, Action onFocus, Action onLostFocus)
        {
            if (editText == null)
            {
                return;
            }

            editText.FocusChange += (sender, e) =>
            {
                if (e.HasFocus)
                {
                    editText.ShowKeyboard();
                    onFocus();
                }
                else
                {
                    onLostFocus();
                    editText.HideKeyboard();
                }
            };

            editText.EditorAction += (sender, e) =>
            {
                if (e.ActionId == ImeAction.Done)
                {
                    editText.ClearFocus();
                }

                e.Handled = false;
            };
        }
Exemple #21
0
 public override void ClearFocus()
 {
     clearingFocus = true;
     HideKeyboard(this);
     backBtn.ClearFocus();
     searchSrcTextView.ClearFocus();
     clearingFocus = false;
 }
Exemple #22
0
        public void OnColorChanged(Color newColor)
        {
            _color = newColor;
            _newColorPanel.SetColor(newColor);
            if (!_fromEditText)
            {
                SetHex(newColor);
                if (_hexEditText.HasFocus)
                {
                    var imm = (InputMethodManager)Activity.GetSystemService(Context.InputMethodService);
                    imm.HideSoftInputFromWindow(_hexEditText.WindowToken, 0);
                    _hexEditText.ClearFocus();
                }
            }

            _fromEditText = false;
        }
Exemple #23
0
        private void anim_AnimationEndUp(object sender, Animation.AnimationEndEventArgs e)
        {
            mIsAnimating = false;
            mSearch.ClearFocus();
            InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Context.InputMethodService);

            inputManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways);
        }
Exemple #24
0
        void anim_AnimationEndUp(object sender, Android.Views.Animations.Animation.AnimationEndEventArgs e)
        {
            mIsAnimating = false;
            mSearch.ClearFocus();
            InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Context.InputMethodService);

            inputManager.HideSoftInputFromWindow(mSearch.WindowToken, HideSoftInputFlags.None);
        }
Exemple #25
0
 private void SignInFailed_InvalidId(object sender, EventArgs e)
 {
     progressBar.Visibility = ViewStates.Invisible;
     signInAttempts++;
     passwordField.Text = "";
     passwordField.ClearFocus();
     redlabel.Visibility = ViewStates.Visible;
 }
 protected override void OnDialogClosed(bool positiveResult)
 {
     if (positiveResult)
     {
         EditText.ClearFocus();
         int value = int.Parse(EditText.Text);
         SetValue(value);
     }
 }
Exemple #27
0
 protected void ClearEditFocus()
 {
     if (editText.HasFocus)
     {
         CloseSoftInput();
         editText.ClearFocus();
         Logger.Debug("focus cleared");
     }
 }
Exemple #28
0
        void HandleDateSet(object sender, DatePickerDialog.DateSetEventArgs e)
        {
            DateTime dtOld = DateTime.Parse(etDate.Text + " " + etTime.Text);
            DateTime dt    = new DateTime(e.Date.Year, e.Date.Month, e.Date.Day,
                                          dtOld.Hour, dtOld.Minute, dtOld.Second, DateTimeKind.Local);

            setDateAndTimeField(dt);
            etDate.ClearFocus();
        }
        private void MyAnimation_AnimationEndUp(object sender, Animation.AnimationEndEventArgs e)
        {
            isAnimating = false;
            mSearch.ClearFocus();
            //hide keyboard
            InputMethodManager inputManager = (InputMethodManager)GetSystemService(InputMethodService);

            inputManager.HideSoftInputFromWindow(CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways);
        }
 public void AfterTextChanged(IEditable s)
 {
     if (EditText.Text.Length != 0)
     {
         EditText.ClearFocus();
         NextEditText.RequestFocus();
         NextEditText.Enabled = true;
     }
 }
Exemple #31
0
//		async void example(){
//			ParseObject gameScore = new ParseObject("GameScore");
//			gameScore["score"] = 1337;
//			gameScore["playerName"] = "Sean Plott";
//			await gameScore.SaveAsync();
//		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
//			ParseClient.Initialize("LNAuxom26NKczyL2hfU3deDyFvxkR9vAEVt3NYom",
//				"pTK01DCWyIlw3DQJludWbtnBgvpe2PqNFKa8aDmm");
			//example ();
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
			string Dominio_webservice = "http://alertapp-jovel.rhcloud.com/index.php/Mobile";
            WebServices = new Dictionary<string, System.Uri> {
				{"getDenuncias",new System.Uri(Dominio_webservice+"/getDenuncias")},
				{"setDenuncia",new System.Uri(Dominio_webservice+"/setDenuncia")},
				{"getDenunciaPicture",new System.Uri(Dominio_webservice+"/getDenunciaPicture")}
            };
			//este diccionario dejo de usarse pero puede resultar util luego
            ColorTipoDenuncia = new Dictionary<int, float>{
                {1, BitmapDescriptorFactory.HueRed},
                {2, BitmapDescriptorFactory.HueAzure},
                {3, BitmapDescriptorFactory.HueGreen},
                {4, BitmapDescriptorFactory.HueYellow},
            };
			MarkerTipoDenuncia = new Dictionary<int, int>{
				{1, Resource.Drawable.corte_marker},
				{2, Resource.Drawable.fuga_marker},
				{3, Resource.Drawable.damage_marker},
				{4, Resource.Drawable.otros_marker}
			};
            btnNormal = FindViewById<Button>(Resource.Id.btnNormal);
            btnSatellite = FindViewById<Button>(Resource.Id.btnSatellite);
            ibtnReload = FindViewById<ImageButton>(Resource.Id.ibtnReload);
            ibtnGps = FindViewById<ImageButton>(Resource.Id.ibtnGps);
            ibtnSearch = FindViewById<ImageButton>(Resource.Id.ibtnSearch);
            txtBuscar = FindViewById<EditText>(Resource.Id.txtBuscar);
            txtBuscar.ClearFocus();
            btnNormal.RequestFocus();
            btnNormal.Click +=btnNormal_Click;
            btnSatellite.Click +=btnSatellite_Click;
            txtBuscar.EditorAction += txtBuscar_EditorAction;
            ibtnReload.Click += ibtnReload_Click;
            ibtnGps.Click += ibtnGps_Click;
            ibtnSearch.Click += ibtnSearch_Click;

            toolBar = FindViewById<SupportToolbar>(Resource.Id.toolbar);
            toolBar.SetTitleTextColor(Color.White);
            mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawe_layout);
            mLeftDrawer = FindViewById<ListView>(Resource.Id.left_drawer);
            SetSupportActionBar(toolBar);

            mLeftDataSet = new List<string>();
            mLeftDataSet.Add("Bienvenido Luis Jovel");
			mLeftDataSet.Add("Listado de Denuncias");
            mLeftDataSet.Add("Filtrar Resultados");
            mLeftDataSet.Add("     Ver Todos");
            mLeftDataSet.Add("     Corte de servicio");
            mLeftDataSet.Add("     Fuga de Agua");
            mLeftDataSet.Add("     Daño a Infraestructura");
            mLeftDataSet.Add("     Otros");
            mLeftDataSet.Add("Cerrar Sesion");
            mLeftAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, mLeftDataSet);
            mLeftDrawer.ItemClick += mLeftDrawer_ItemClick;
            mLeftDrawer.Adapter = mLeftAdapter;

            mDrawerToggle = new MyActionBarDrawerToggle(
                this,
                mDrawerLayout,
                Resource.String.openDrawer,
                Resource.String.closeDrawer
            );
            mDrawerLayout.SetDrawerListener(mDrawerToggle);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            mDrawerToggle.SyncState();
			//GPS NUEVO
			setupGPS();
            SetUpMap();
			//GPS OBSOLETO
//            InitializeLocationManager();
            cliente = new WebClient();
            //llamar a web service
            cliente.DownloadDataAsync(WebServices["getDenuncias"]);
            cliente.DownloadDataCompleted += cliente_DownloadDataCompleted;           

            //alertdialog
            builder = new Android.App.AlertDialog.Builder(this);
            alert = builder.Create();
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState)
        {
            base.OnCreateView (inflater, container, savedInstanceState);

            var view = inflater.Inflate (Resource.Layout.LogInDialog, container, false);

            mTxtUserName = view.FindViewById<EditText> (Resource.Id.txtUserName);
            mTxtPassword = view.FindViewById<EditText> (Resource.Id.txtPassword);

            mCheckbox = view.FindViewById<CheckBox> (Resource.Id.LoginCheckBox);

            try{
                var CheckPrefs = Application.Context.GetSharedPreferences("MyCheckState", FileCreationMode.Private);
                checkState = CheckPrefs.GetString("CheckState", null);

            }catch{

            }

            switch (checkState)
            {
            case "False":
                mCheckbox.Checked = false;
                break;
            case "True":
                mCheckbox.Checked = true;
                try{
                    var UsernamePrefs = Application.Context.GetSharedPreferences("username", FileCreationMode.Private);
                    mTxtUserName.Text = UsernamePrefs.GetString("username", null);

                }catch{

                }
                try{
                    var PasswordPrefs = Application.Context.GetSharedPreferences("password", FileCreationMode.Private);
                    mTxtPassword.Text = PasswordPrefs.GetString("password", null);

                }catch{

                }
                break;
            default:
                mCheckbox.Checked = true;
                break;
            }

            mBtnSignUp = view.FindViewById<Button> (Resource.Id.btnLogInDialog);
            mErrorText = view.FindViewById<TextView> (Resource.Id.txtError);

            mProgressBar = view.FindViewById<ProgressBar> (Resource.Id.progressBar);

            mProgressBar.Visibility = ViewStates.Invisible;

            mBtnSignUp.Click +=  (object sender, EventArgs e) => {

                mProgressBar.Visibility = ViewStates.Visible;

                mTxtUserName.ClearFocus();
                mErrorText.ClearFocus();
                mBtnSignUp.RequestFocus();

                mErrorText.Text=string.Format("登录中...");

                //关键盘

                InputMethodManager inputManager = (InputMethodManager)Activity.GetSystemService(Context.InputMethodService);

                inputManager.HideSoftInputFromWindow(mTxtPassword.WindowToken, HideSoftInputFlags.None);
                inputManager.HideSoftInputFromWindow(mTxtUserName.WindowToken, HideSoftInputFlags.None);

                mWorker=new BackgroundWorker();
                mWorker.WorkerSupportsCancellation = true;

                mWorker.DoWork+= delegate(object sender1, DoWorkEventArgs e1) {

                    BackgroundWorker mworker = sender1 as BackgroundWorker;

                    if (mworker.CancellationPending == true) {
                        e1.Cancel = true;
                    } else {
                        checkPassword();
                    }

                };

                mWorker.RunWorkerCompleted+=delegate(object sender1, RunWorkerCompletedEventArgs e1) {

                    if (e1.Cancelled == true) {

                    } else if (!(e1.Error == null)) {

                    } else {
                        worker_RunWorkerCompleted();
                    }

                };

                if (mWorker.IsBusy != true) {
                    mWorker.RunWorkerAsync ();
                }

            };

            return view;
        }
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			view = inflater.Inflate(Resource.Layout.work_path_fragment, container, false);
			workPathLayout = view.FindViewById<LinearLayout>(Resource.Id.work_path_layout);
			coordinatorLayout = view.FindViewById<CoordinatorLayout>(Resource.Id.coordinator_layout);

			string workPath = Pref.WorkPath;
			workPathFragment = (FileListFragment)ChildFragmentManager.FindFragmentById(Resource.Id.work_path_fragment);
			workPathFragment.RefreshFilesList(workPath);
			workPathFragment.SnackbarView = coordinatorLayout;
			//workPathFragment.PrefKey = Pref.WorkPathKey;

			etWorkPath = view.FindViewById<EditText>(Resource.Id.etWorkPath);
			etWorkPath.Text = workPath;
			etWorkPath.FocusChange += (object sender, View.FocusChangeEventArgs e) =>
			{
				try {
					var dir = new DirectoryInfo(etWorkPath.Text);
					if (dir.IsDirectory()) {
						Pref.WorkPath = etWorkPath.Text;
					} else {
						Show("잘못된 경로: " + etWorkPath.Text);
						etWorkPath.Text = Pref.WorkPath;
					}
				} catch {
					Show("잘못된 경로: " + etWorkPath.Text);
					etWorkPath.Text = Pref.WorkPath;
				}
				workPathFragment.RefreshFilesList(etWorkPath.Text);
			};
			etWorkPath.KeyPress += (object sender, View.KeyEventArgs e) =>
			{
				e.Handled = false;
				if (e.KeyCode == Keycode.Enter || e.KeyCode == Keycode.Back || e.KeyCode == Keycode.Escape) {
					var imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);
					imm.HideSoftInputFromWindow(etWorkPath.WindowToken, 0);
					etWorkPath.ClearFocus();
					e.Handled = true;
				}
			};

			workPathToolbar = view.FindViewById<Toolbar>(Resource.Id.work_path_toolbar);
			workPathToolbar.InflateMenu(Resource.Menu.toolbar_work_path_menu);
			workPathToolbar.MenuItemClick += (sender, e) =>
			{
				//Toast.MakeText(this, "Bottom toolbar pressed: " + e.Item.TitleFormatted, ToastLength.Short).Show();
				bool ret;
				switch (e.Item.ItemId) {
					case Resource.Id.toolbar_work_path_menu_up:
					OnBackPressedFragment();
					break;
					case Resource.Id.toolbar_work_path_menu_home:
					if (!Refresh(Pref.WorkPath))
						Show("경로 이동 실패: " + Pref.WorkPath);
					break;
					case Resource.Id.toolbar_work_path_menu_storage:
					if (!Refresh("/storage"))
						Show("경로 이동 실패: " + "/storage");
					break;
					case Resource.Id.toolbar_work_path_menu_sdcard:
					if (!Refresh(Environment.ExternalStorageDirectory.AbsolutePath))
						Show("경로 이동 실패: " + Environment.ExternalStorageDirectory.AbsolutePath);
					break;
					case Resource.Id.toolbar_work_path_menu_extsdcard:
					ret = false;
					try {
						var dir = new DirectoryInfo("/storage");
						foreach (var item in dir.GetDirectories()) {
							if (item.Name.ToLower().StartsWith("ext") || item.Name.ToLower().StartsWith("sdcard1")) {
								foreach (var subItem in item.GetFileSystemInfos()) {
									if (Refresh(item.FullName)) {
										ret = true;
										break;
									}
								}
							}
						}
					} catch { }
					if (!ret)
						Show("경로 이동 실패: " + "SD 카드");
					break;
					case Resource.Id.toolbar_work_path_menu_usbstorage:
					ret = false;
					try {
						var dir = new DirectoryInfo("/storage");
						foreach (var item in dir.GetDirectories()) {
							if (item.Name.ToLower().StartsWith("usb")) {
								foreach (var subItem in item.GetFileSystemInfos()) {
									if (Refresh(item.FullName)) {
										ret = true;
										break;
									}
								}
							}
						}
					} catch { }
					if (!ret)
						Show("경로 이동 실패: " + "USB 저장소");
					break;
				}
			};

			fab = view.FindViewById<FloatingActionButton>(Resource.Id.fab);
			fab.Click += (sender, e) =>
			{
				etWorkPath.Text = workPathFragment.DirPath;
				Pref.WorkPath = etWorkPath.Text;
				workPathFragment.RefreshFilesList();
				Show("경로 설정 완료: " + etWorkPath.Text);
			};

			return view;
		}
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			view = inflater.Inflate(Resource.Layout.backup_path_fragment, container, false);
			backupPathLayout = view.FindViewById<LinearLayout>(Resource.Id.backup_path_layout);
			coordinatorLayout = view.FindViewById<CoordinatorLayout>(Resource.Id.coordinator_layout);

			string backupPath = Pref.BackupPath;
			backupPathFragment = (FileListFragment)ChildFragmentManager.FindFragmentById(Resource.Id.backup_path_fragment);
			backupPathFragment.RefreshFilesList(backupPath);
			backupPathFragment.SnackbarView = coordinatorLayout;
			//backupPathFragment.PrefKey = Pref.BackupPathKey;

			etBackupPath = view.FindViewById<EditText>(Resource.Id.etBackupPath);
			etBackupPath.Text = backupPath;
			etBackupPath.FocusChange += (object sender, View.FocusChangeEventArgs e) =>
			{
				try {
					var dir = new DirectoryInfo(etBackupPath.Text);
					if (dir.IsDirectory()) {
						Pref.BackupPath = etBackupPath.Text;
					} else {
						Show("잘못된 경로: " + etBackupPath.Text);
						etBackupPath.Text = Pref.BackupPath;
					}
				} catch {
					Show("잘못된 경로: " + etBackupPath.Text);
					etBackupPath.Text = Pref.BackupPath;
				}
				backupPathFragment.RefreshFilesList(etBackupPath.Text);
			};
			etBackupPath.KeyPress += (object sender, View.KeyEventArgs e) =>
			{
				e.Handled = false;
				if (e.KeyCode == Keycode.Enter || e.KeyCode == Keycode.Back || e.KeyCode == Keycode.Escape) {
					var imm = (InputMethodManager)Context.GetSystemService(Context.InputMethodService);
					imm.HideSoftInputFromWindow(etBackupPath.WindowToken, 0);
					etBackupPath.ClearFocus();
					e.Handled = true;
				}
			};

			backupPathToolbar = view.FindViewById<Toolbar>(Resource.Id.backup_path_toolbar);
			backupPathToolbar.InflateMenu(Resource.Menu.toolbar_backup_path_menu);
			backupPathToolbar.MenuItemClick += (sender, e) =>
			{
				switch (e.Item.ItemId) {
					case Resource.Id.toolbar_backup_path_menu_up:
						OnBackPressedFragment();
						break;
					case Resource.Id.toolbar_backup_path_menu_home:
						Refresh(Pref.BackupPath);
						break;
					case Resource.Id.toolbar_backup_path_menu_restore:
						Show(Restore());
						break;
				}
			};

			fab = view.FindViewById<FloatingActionButton>(Resource.Id.fab);
			fab.Click += (sender, e) =>
			{
				Show(Backup());
			};

			return view;
		}
        public void Binding_TwoWayFromCheckBoxToEditTextWithUpdateTrigger_BindingGetsUpdated()
        {
            var control1 = new EditText(Application.Context);
            var control2 = new CheckBox(Application.Context);

            _binding = new Binding<bool, string>(
                control2,
                () => control2.Checked,
                control1,
                () => control1.Text,
                BindingMode.TwoWay)
                .UpdateSourceTrigger() // LostFocus doesn't work programatically with CheckBoxes
                .ObserveTargetEvent(UpdateTriggerMode.LostFocus);

            Assert.AreEqual("False", control1.Text);
            Assert.IsFalse(control2.Checked);
            control2.Checked = true;
            Assert.IsTrue(control2.Checked);
            Assert.AreEqual("True", control1.Text);

            var value = "False";
            control1.RequestFocus();
            control1.Text = value;
            Assert.AreEqual(value, control1.Text);
            Assert.IsTrue(control2.Checked);
            control1.ClearFocus();
            Assert.IsFalse(control2.Checked);
        }
        public void Binding_OneWayFromEditTextToEditTextWithUpdateTrigger_BindingGetsUpdated()
        {
            var control1 = new EditText(Application.Context);
            var control2 = new EditText(Application.Context);

            _binding = new Binding<string, string>(
                control1,
                () => control1.Text,
                control2,
                () => control2.Text)
                .UpdateSourceTrigger(UpdateTriggerMode.LostFocus);

            Assert.AreEqual(string.Empty, control1.Text);
            Assert.AreEqual(string.Empty, control2.Text);
            var value = DateTime.Now.Ticks.ToString();
            control1.RequestFocus();
            control1.Text = value;
            Assert.AreEqual(value, control1.Text);
            Assert.AreEqual(string.Empty, control2.Text);
            control1.ClearFocus();
            Assert.AreEqual(control1.Text, control2.Text);
        }
        public void Binding_OneWayFromEditTextToCheckBoxWithObserveEvent_BindingGetsUpdated()
        {
            var control1 = new EditText(Application.Context);
            var control2 = new CheckBox(Application.Context);

            var binding = new Binding<string, bool>(
                control1,
                () => control1.Text,
                control2,
                () => control2.Checked)
                .ObserveSourceEvent(UpdateTriggerMode.LostFocus);

            Assert.AreEqual(string.Empty, control1.Text);
            Assert.IsFalse(control2.Checked);
            var value = "True";
            control1.RequestFocus();
            control1.Text = value;
            Assert.AreEqual(value, control1.Text);
            Assert.IsFalse(control2.Checked);
            control1.ClearFocus();
            Assert.IsTrue(control2.Checked);
        }
        public void Binding_TwoWayFromViewModelToEditTextWithObserveEvent_BindingGetsUpdated()
        {
            var vm = new TestViewModel
            {
                Model = new TestModel()
            };

            var control1 = new EditText(Application.Context);

            var binding = new Binding<string, string>(
                vm,
                () => vm.Model.MyProperty,
                control1,
                () => control1.Text,
                BindingMode.TwoWay)
                .ObserveTargetEvent(UpdateTriggerMode.LostFocus);

            Assert.AreEqual(null, vm.Model.MyProperty);
            Assert.AreEqual(string.Empty, control1.Text);
            var value = DateTime.Now.Ticks.ToString();
            vm.Model.MyProperty = value;
            Assert.AreEqual(value, vm.Model.MyProperty);
            Assert.AreEqual(vm.Model.MyProperty, control1.Text);

            var newValue = value + "Suffix";
            control1.RequestFocus();
            control1.Text = newValue;
            Assert.AreEqual(newValue, control1.Text);
            Assert.AreEqual(value, vm.Model.MyProperty);
            control1.ClearFocus();
            Assert.AreEqual(newValue, vm.Model.MyProperty);
        }
        public void Binding_TwoWayFromEditTextToEditTextWithObserveEvent_BindingGetsUpdated()
        {
            var control1 = new EditText(Application.Context);
            var control2 = new EditText(Application.Context);

            var binding = new Binding<string, string>(
                control1,
                () => control1.Text,
                control2,
                () => control2.Text,
                BindingMode.TwoWay)
                .ObserveSourceEvent(UpdateTriggerMode.LostFocus)
                .ObserveTargetEvent(UpdateTriggerMode.LostFocus);

            Assert.AreEqual(string.Empty, control1.Text);
            Assert.AreEqual(string.Empty, control2.Text);
            var value = DateTime.Now.Ticks.ToString();
            control1.RequestFocus();
            control1.Text = value;
            Assert.AreEqual(value, control1.Text);
            Assert.AreEqual(string.Empty, control2.Text);
            control1.ClearFocus();
            Assert.AreEqual(control1.Text, control2.Text);

            var newValue = value + "Suffix";
            control2.RequestFocus();
            control2.Text = newValue;
            Assert.AreEqual(newValue, control2.Text);
            Assert.AreEqual(value, control1.Text);
            control2.ClearFocus();
            Assert.AreEqual(control2.Text, control1.Text);
        }
        public void Binding_TwoWayFromEditTextToCheckBoxWithObserveEvent_BindingGetsUpdated()
        {
            var control1 = new EditText(Application.Context);
            var control2 = new CheckBox(Application.Context);

            var binding = new Binding<string, bool>(
                control1,
                () => control1.Text,
                control2,
                () => control2.Checked,
                BindingMode.TwoWay)
                .ObserveSourceEvent(UpdateTriggerMode.LostFocus)
                .ObserveTargetEvent(); // LostFocus doesn't work programatically with CheckBoxes

            Assert.AreEqual(string.Empty, control1.Text);
            Assert.IsFalse(control2.Checked);
            var value = "True";
            control1.RequestFocus();
            control1.Text = value;
            Assert.AreEqual(value, control1.Text);
            Assert.IsFalse(control2.Checked);
            control1.ClearFocus();
            Assert.IsTrue(control2.Checked);

            control2.Checked = false;
            Assert.IsFalse(control2.Checked);
            Assert.AreEqual("False", control1.Text);
        }
        public void Binding_OneWayFromEditTextToViewModelWithObserveEvent_BindingGetsUpdated()
        {
            var vm = new TestViewModel
            {
                Model = new TestModel()
            };

            var control1 = new EditText(Application.Context);

            var binding = new Binding<string, string>(
                control1,
                () => control1.Text,
                vm,
                () => vm.Model.MyProperty)
                .ObserveSourceEvent(UpdateTriggerMode.LostFocus);

            Assert.AreEqual(string.Empty, control1.Text);
            Assert.AreEqual(string.Empty, vm.Model.MyProperty);
            var value = DateTime.Now.Ticks.ToString();
            control1.RequestFocus();
            control1.Text = value;
            Assert.AreEqual(value, control1.Text);
            Assert.AreEqual(string.Empty, vm.Model.MyProperty);
            control1.ClearFocus();
            Assert.AreEqual(control1.Text, vm.Model.MyProperty);
        }