Inheritance: MonoBehaviour
        public void Binding_TwoWayFromEditTextToEditTextWithUpdateTrigger_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)
                .UpdateSourceTrigger<View.LongClickEventArgs>("LongClick")
                .ObserveTargetEvent<View.LongClickEventArgs>("LongClick");

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

            var newValue = value + "Suffix";
            control2.Text = newValue;
            Assert.AreEqual(newValue, control2.Text);
            Assert.AreEqual(value, control1.Text);
            control2.PerformLongClick();
            Assert.AreEqual(control2.Text, control1.Text);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Settings);
            ActionBar.SetDisplayHomeAsUpEnabled(true);

            counter = 0;
            var prefs =
                AndroidAppPreferences.Create(Application.Context.GetSharedPreferences(KeySndrApplication.AppPreferencesId, FileCreationMode.Private));

            editIpView = FindViewById<EditText>(Resource.Id.ipEditText);
            editPortView = FindViewById<EditText>(Resource.Id.portEditText);
            useCacheView = FindViewById<CheckBox>(Resource.Id.enableCache);

            if (!string.IsNullOrEmpty(prefs.Ip))
                editIpView.Text = prefs.Ip;
            if (prefs.Port > 0)
                editPortView.Text = prefs.Port.ToString();
            useCacheView.Checked = prefs.UseCache;

            probe = new Probe("KeySndrServer");
            probe.BeaconsUpdated += Probe_BeaconsUpdated;


            t = new Timer(1000);
            t.Elapsed += TimerOnElapsed;
            if (Intent.Extras == null || !Intent.Extras.ContainsKey("search"))
                return;
        }
Beispiel #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON) {
                Finish ();
            }
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE;
            branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE;
            SetContentView (Resource.Layout.ItemCodeList);
            populate (listData);
            listView = FindViewById<ListView> (Resource.Id.ICodeList);
            txtSearch= FindViewById<EditText > (Resource.Id.txtSearch);

            Button butInvBack= FindViewById<Button> (Resource.Id.butICodeBack);
            butInvBack.Click += (object sender, EventArgs e) => {
                base.OnBackPressed();
            };
            viewdlg = SetViewDelegate;
            //PerformFilteringDlg filterDlg=PerformFiltering;
            //listView.Adapter = new CusotmMasterItemListAdapter(this, listData);

            adapter = new GenericListAdapter<Item> (this, listData, Resource.Layout.ItemCodeDtlList, viewdlg);
            listView.Adapter = adapter;
            listView.ItemClick+= ListView_Click;
            txtSearch.TextChanged+= TxtSearch_TextChanged;
        }
        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("EqualizerPresetDetailsActivity - OnCreate");
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.EqualizerPresetDetails);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            _txtPresetName = FindViewById<EditText>(Resource.Id.equalizerPresetDetails_txtPresetName);
            _btnNormalize = FindViewById<Button>(Resource.Id.equalizerPresetDetails_btnNormalize);
            _btnReset = FindViewById<Button>(Resource.Id.equalizerPresetDetails_btnReset);
            _equalizerPresetGraph = FindViewById<EqualizerPresetGraphView>(Resource.Id.equalizerPresetDetails_graphView);
            _btnNormalize.Click += BtnNormalizeOnClick;
            _btnReset.Click += BtnResetOnClick;

            //_txtPresetName.SetOnEditorActionListener(this);

            _listView = FindViewById<ListView>(Resource.Id.equalizerPresetDetails_listView);
            _listAdapter = new EqualizerPresetFadersListAdapter(this, _listView, new EQPreset());
            _listView.SetAdapter(_listAdapter);

            // Save the source activity type for later (for providing Up navigation)
            _sourceActivityType = Intent.GetStringExtra("sourceActivity");
            _presetId = Intent.GetStringExtra("presetId");

            var navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            navigationManager.BindEqualizerPresetDetailsView(null, this, new Guid(_presetId));
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

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

			// Get our button from the layout resource,
			// and attach an event to it
			GetButton = FindViewById<Button> (Resource.Id.GetButton);
			ResultTextView = FindViewById<TextView> (Resource.Id.ResultTextView);
			ResultEditText = FindViewById<EditText> (Resource.Id.ResultEditText);
			DownloadedImageView = FindViewById<ImageView> (Resource.Id.DownloadedImageView);

			GetButton.Click += async (sender, e) => {
				
				Task<int> sizeTask = DownloadHomePageAsync();

				ResultTextView.Text = "Loading...";
				ResultEditText.Text = "Loading...\n";

				DownloadedImageView.SetImageResource ( Android.Resource.Drawable.IcMenuGallery);

				var length = await sizeTask;

				ResultTextView.Text = "length:  " + length;

			};

		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            // find our text fields
            usernameText = FindViewById<EditText>(Resource.Id.text_username);
            emailText = FindViewById<EditText>(Resource.Id.text_email);

            Button button_save_profile = FindViewById<Button>(Resource.Id.button_save_profile);
            button_save_profile.Click += delegate {
                // get the current User
                User user = Session.CurrentSession.User;

                // update his values
                user.Login = usernameText.Text;
                user.EmailAddress = emailText.Text;

                // set up a request observer
                ProfileRequestControllerObserver observer = new ProfileRequestControllerObserver(this);

                // with our observer, set up the request controller
                UserController userController = new  UserController(observer);

                // pass the user into the controller
                userController.SetUser(user);

                ShowDialog(DIALOG_PROGRESS);

                // submit our changes
                userController.SubmitUser();
            };
        }
		protected override void OnCreate(Bundle icicle)
		{
			base.OnCreate(icicle);
			if (!LibsChecker.CheckVitamioLibs(this))
				return;
			SetContentView(Resource.Layout.videoview);
			mEditText = FindViewById<EditText>(Resource.Id.url);
			mVideoView = (VideoView) FindViewById<VideoView>(Resource.Id.surface_view);
			if (path == "")
			{
				// Tell the user to provide a media file URL/path.
				Toast.MakeText(this, "Please edit VideoViewDemo Activity, and set path" + " variable to your media file URL/path", ToastLength.Long).Show();
				return;
			}
			else
			{
				//            
				//			 * Alternatively,for streaming media you can use
				//			 * mVideoView.setVideoURI(Uri.parse(URLstring));
				//			 
				mVideoView.SetVideoPath(path);
				mVideoView.SetMediaController(new IO.Vov.Vitamio.Widget.MediaController(this));
				mVideoView.RequestFocus();
				mVideoView.Prepared += (object sender, MediaPlayer.PreparedEventArgs e) => e.P0.SetPlaybackSpeed (1.0f);
			}

		}
		private void InitView()
		{
			//设置标题栏
			var btn_headerBack = FindViewById<Button> (Resource.Id.btn_header_back);

			btn_headerBack.Click += (sender, e) => 
			{
				this.Finish();
				OverridePendingTransition(Android.Resource.Animation.SlideInLeft,Android.Resource.Animation.SlideOutRight);
			};
			FindViewById<TextView> (Resource.Id.tv_header_title).Text = "生日";
			edit_birth = FindViewById<EditText>(Resource.Id.edit_birth);
			edit_birth.Click += (sender, e) => 
			{
				var datepickdialog = new DatePickDialogUtil(this,edit_birth.Text);
				datepickdialog.DatePickDialogShow(edit_birth);

			};
			edit_birth.Text = !string.IsNullOrEmpty (Global.MyInfo.Age) ?Convert.ToDateTime(Global.MyInfo.Age).ToString("yyyy-MM-dd") :"";
			btn_Save = FindViewById<Button> (Resource.Id.btn_Save);
			btn_Save.Click += (sender, e) => 
			{
				Save();
			};
		}
Beispiel #9
0
        public Screen7Summary(Activity context, PointDto point)
            : base(context, Resource.Layout.Edit7Summary, point)
        {
            PointPart7Summary item = Point.PointDataDto.PointPart7Summary;

            invalidMoveAvailable = View.FindViewById<Spinner>(Resource.Id.invalid_move_availability);
            invalidHearingAvailable = View.FindViewById<Spinner>(Resource.Id.invalid_hearing_availability);
            invalidEyeAvailable = View.FindViewById<Spinner>(Resource.Id.invalid_eye_availability);
            otherText = View.FindViewById<EditText>(Resource.Id.otherComments);
            reportDate = View.FindViewById<EditText>(Resource.Id.protocolDate);

            invalidMoveAvailable.Adapter = new BoolSpinnerAdapter(context, "ќбъект доступен",
                                                                  "ќбъект не доступен (если нет пандуса, не соответствует ширина проемов, высота порогов)");
            invalidHearingAvailable.Adapter = new BoolSpinnerAdapter(context, "ќбъект доступен",
                                                                     "ќбъект не доступен (если отсутствуют световые табло, индукционна¤ петл¤)");
            invalidEyeAvailable.Adapter = new BoolSpinnerAdapter(context, "ќбъект доступен",
                                                                 "ќбъект не доступен (если отсутствуют тактильные маршруты, звуковое оповещение, контрастна¤ маркировка дверей и стекл¤нных поверхностей)");

            reportDate.Text = item.ReportDate.ToLocalTime().Date.ToString(CultureInfo.CurrentCulture);

            invalidMoveAvailable.SetSelection(BoolSpinnerAdapter.SetPositionOf(item.InvalidMoveAvailability));
            invalidHearingAvailable.SetSelection(BoolSpinnerAdapter.SetPositionOf(item.InvalidHearingAvailability));
            invalidEyeAvailable.SetSelection(BoolSpinnerAdapter.SetPositionOf(item.InvalidEyeAvailability));

            otherText.Text = item.OtherComments;
        }
Beispiel #10
0
        public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate (Resource.Layout.FeedbackFragment, container, false);
            feedbackPositiveButton = view.FindViewById<ImageButton> (Resource.Id.FeedbackPositiveButton);
            feedbackNeutralButton = view.FindViewById<ImageButton> (Resource.Id.FeedbackNeutralButton);
            feedbackNegativeButton = view.FindViewById<ImageButton> (Resource.Id.FeedbackNegativeButton);

            feedbackPositiveButton.Click += (sender, e) => SetRating (ratingPositive);
            feedbackNeutralButton.Click += (sender, e) => SetRating (ratingNeutral);
            feedbackNegativeButton.Click += (sender, e) => SetRating (ratingNegative);

            feedbackMessageEditText = view.FindViewById<EditText> (Resource.Id.FeedbackMessageText).SetFont (Font.Roboto);
            feedbackMessageEditText.AfterTextChanged += OnEdit;

            submitFeedbackButton = view.FindViewById<Button> (Resource.Id.SendFeedbackButton).SetFont (Font.Roboto);
            submitFeedbackButton.Click += OnSendClick;

            feedbackContainer = view.FindViewById<LinearLayout> (Resource.Id.FeedbackContainer);
            disclaimerContainer = view.FindViewById<LinearLayout> (Resource.Id.FeedbackDisclaimer);
            noUserRegisterButton = view.FindViewById<Button> (Resource.Id.FeedbackRegisterButton);

            bool offline = ServiceContainer.Resolve<AuthManager> ().OfflineMode;
            disclaimerContainer.Visibility = offline ? ViewStates.Visible : ViewStates.Gone;
            feedbackContainer.Visibility = offline ? ViewStates.Gone : ViewStates.Visible;

            noUserRegisterButton.Click += OpenRegisterScreen;

            SetRating (userRating);

            return view;
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            RelativeLayout view = (RelativeLayout)inflater.Inflate (Resource.Layout.raffledetail_gettemppass, container, false);
            rootview = view;

            TextView hinttextview=(TextView)view.FindViewById (Resource.Id.gettemppass_hinttext_textview);
            hinttextview.Text = RequestTPScreenData.ProvideClientInfoTextViewText;

            emailorphone = (EditText)view.FindViewById (Resource.Id.gettemppass_emailorphone_edittext);
            emailorphone.Hint = RequestTPScreenData.ClientInfoTextFieldPlaceholder;

            requesttemppass = (Button)view.FindViewById (Resource.Id.gettemppass_requesttemppass_button);
            requesttemppass.Text = RequestTPScreenData.RequestTPBtnTitle;
            //send web request
            requesttemppass.Click+=OnRequestTempPassClick;

            TextView signuptextview=view.FindViewById<TextView> (Resource.Id.gettemppass_register_textview);
            nn_activity.SetClickAbleText (signuptextview,RequestTPScreenData.DontHaveAccountLabelText+RequestTPScreenData.SignUpBtnTitle,RequestTPScreenData.SignUpBtnTitle,()=>{

                if(FormatManager.chechinput(emailorphone.Text,FormatManager.FormatOption.Email)){
                    (nn_activity as HomeScreen).ShowBuyerSignUp(emailorphone.Text);
                }
                else{
                    (nn_activity as HomeScreen).ShowBuyerSignUp("");
                }

            });

            return view;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            txtAuditDate = FindViewById<EditText>(Resource.Id.txtAuditDate);
            txtAuditor = FindViewById<EditText>(Resource.Id.txtAuditor);
            txtManu= FindViewById<EditText>(Resource.Id.txtManu);
            txtModel = FindViewById<EditText>(Resource.Id.txtModel);
            txtComputerName = FindViewById<EditText>(Resource.Id.txtCompName);
            txtOperSys = FindViewById<EditText>(Resource.Id.txtOS);
            txtOperSysArch = FindViewById<EditText>(Resource.Id.txtOSArch);
            txtServicePack = FindViewById<EditText>(Resource.Id.txtServicePack);
            txtSerialNo = FindViewById<EditText>(Resource.Id.txtSerialNo);
            txtProcessorName = FindViewById<EditText>(Resource.Id.txtProcessName);
            txtProcessorsAmt = FindViewById<EditText>(Resource.Id.txtProcessorsNo);
            txtRamAmt = FindViewById<EditText>(Resource.Id.txtRam);
            txtHardDriveSize = FindViewById<EditText>(Resource.Id.txtHardDriveSize);
            txtAvailSpace = FindViewById<EditText>(Resource.Id.txtAvailSpace);
            txtComments = FindViewById<EditText>(Resource.Id.txtComments);

            btnSave = FindViewById<Button>(Resource.Id.btnUpdate);
            btnViewMore = FindViewById<Button>(Resource.Id.btnViewMore);
            btnScan = FindViewById<Button>(Resource.Id.btnScan);

            btnViewMore.Click += BtnViewMore_Click;
            btnScan.Click += BtnScan_Click;
            btnSave.Click += BtnSave_Click;
        }
		public bool IsLoginFormValidate(EditText email, EditText password, ref View focus) {
			var icon = email.Context.Resources.GetDrawable(Android.Resource.Drawable.StatNotifyError);
			var emailText = email.Text;
			var passwordText = password.Text;
			if (emailText == null || emailText == String.Empty) {
				email.SetError(requiredFieldErrorMessage, icon);
				focus = email;
				return false;
			}
			Regex emailRegex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
			if (!emailRegex.IsMatch(emailText)) {
				email.SetError(incorrectEmailErrorMessage, icon);
				focus = email;
				return false;
			}
			else if (passwordText == null || passwordText == String.Empty) {
				password.SetError(requiredFieldErrorMessage, icon);
				focus = password;
				return false;
			}
			Regex passwordRegex = new Regex(@"\d+");
			if (passwordText.Length < 6 || (passwordText.Length > 6 && !passwordRegex.IsMatch(passwordText))) {
				password.SetError(incorrectPasswordErrorMessage, icon);
				focus = password;
				return false;
			}

			return true;
		}
		public void Display (string body, string title, GoalsAvailable availableGoal, string cancelButtonTitle, string acceptButtonTitle = "", Action<GoalsAvailable, int> action = null)
		{
			EditText goalTextBox = new EditText (Forms.Context);
			AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder (Forms.Context);
			alertDialogBuilder.SetTitle (title);
			alertDialogBuilder.SetMessage (body);
			alertDialogBuilder.SetView (goalTextBox);

			goalTextBox.InputType = Android.Text.InputTypes.NumberFlagSigned;

			var inputFilter = new Android.Text.InputFilterLengthFilter (7);
			var filters = new Android.Text.IInputFilter[1];

			filters [0] = inputFilter;

			goalTextBox.SetFilters (filters);
			goalTextBox.InputType = Android.Text.InputTypes.ClassNumber;

			alertDialogBuilder.SetPositiveButton ("OK", (senderAlert, args) => {
				if(action != null)
				{
					int goalValue;
					int.TryParse(goalTextBox.Text, out goalValue);
					action.Invoke(availableGoal, goalValue);
				}

			} );
			alertDialogBuilder.SetNeutralButton ("CANCEL", (senderAlert, args) => {

			} );

			alertDialogBuilder.Show ();

		}
Beispiel #15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

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

            // Get our button from the layout resource,
            // and attach an event to it
            _MomentId = FindViewById<EditText> (Resource.Id.moment_id);
            _MomentValue = FindViewById<EditText> (Resource.Id.moment_value);
            _ButtonMoment = FindViewById<Button> (Resource.Id.btn_moment);
            _ButtonStart = FindViewById<Button> (Resource.Id.btn_start);

            _ButtonStart.Click += delegate {
                StartActivity(typeof(SecondaryActivity));
            };

            _ButtonMoment.Click += delegate {
                String momentId = _MomentId.Text;
                double? momentValue = _MomentValue.Text.Length > 0 ? (double?)Double.Parse(_MomentValue.Text) : null;

                if (!momentValue.HasValue) {
                    Kiip.Instance.SaveMoment(momentId, this);
                } else {
                    Kiip.Instance.SaveMoment(momentId, momentValue.Value, this);
                }
            };
        }
Beispiel #16
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            if (!((GlobalvarsApp)this.Application).ISLOGON) {
                Finish ();
            }
            SetTitle (Resource.String.submenu_cust);
            SetContentView (Resource.Layout.ListCustView);
            // Create your application here
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            populate (listData);
            listView = FindViewById<ListView> (Resource.Id.CustList);

            Button butInvBack= FindViewById<Button> (Resource.Id.butCustBack);
            txtSearch= FindViewById<EditText > (Resource.Id.txtSearch);
            butInvBack.Click += (object sender, EventArgs e) => {
                base.OnBackPressed();
            };

            listView.ItemClick+= ListView_ItemClick; ;
            //istView.Adapter = new CusotmCustomerListAdapter(this, listData);
            viewdlg = SetViewDelegate;
            adapter = new GenericListAdapter<Trader> (this, listData, Resource.Layout.ListCustDtlView, viewdlg);
            listView.Adapter = adapter;
            txtSearch.TextChanged+= TxtSearch_TextChanged;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource

            SetContentView(Resource.Layout.Main);

            setupParent(FindViewById<LinearLayout>(Resource.Id.mainLayout));
            listViewGoodsMain = FindViewById<ListView>(Resource.Id.listViewGoodsMain);

            goodsItemsList = new List<GoodsItem>();
            goodsItemsList.Add(new GoodsItem() { Id = 1, Quantity = 1, Name = "Пельмешки"});
            goodsItemsList.Add(new GoodsItem() { Id = 2, Quantity = 2, Name = "Сосисоны" });

            myGoodsItemsAdapter = new GoodsItemsAdapter(this, goodsItemsList);
            listViewGoodsMain.Adapter = myGoodsItemsAdapter;

            var emptyText = FindViewById<TextView>(Resource.Id.textViewGoodsListEmpty);
            listViewGoodsMain.EmptyView = emptyText;

            editTextNewProduct = FindViewById<EditText>(Resource.Id.EditTextNewProduct);
            editTextNewProduct.EditorAction += editTextNewProduct_EditorAction;
            editTextNewProduct.Click += editTextNewProduct_Click;

            checkBoxRed = FindViewById<CheckBox>(Resource.Id.checkBoxRed);
            checkBoxRed.Click += checkBoxRed_Click;
        }
Beispiel #18
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			
			int taskID = Intent.GetIntExtra("TaskID", 0);
			if(taskID > 0) {
				task = TaskManager.GetTask(taskID);
			}
			
			// set our layout to be the home screen
			SetContentView(Resource.Layout.TaskDetails);
			nameTextEdit = FindViewById<EditText>(Resource.Id.NameText);
			notesTextEdit = FindViewById<EditText>(Resource.Id.NotesText);
			saveButton = FindViewById<Button>(Resource.Id.SaveButton);
			
			// find all our controls
			cancelDeleteButton = FindViewById<Button>(Resource.Id.CancelDeleteButton);
			
			// set the cancel delete based on whether or not it's an existing task
			cancelDeleteButton.Text = (task.ID == null ? "Cancel" : "Delete");
			
			nameTextEdit.Text = task.Name; 
			notesTextEdit.Text = task.Notes;

			// button clicks 
			cancelDeleteButton.Click += (sender, e) => { CancelDelete(); };
			saveButton.Click += (sender, e) => { Save(); };
		}
Beispiel #19
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			
			int taskID = Intent.GetIntExtra("TaskID", 0);
			if(taskID > 0)
			{
				this._task = Tasky.BL.Managers.TaskManager.GetTask(taskID);
			}
			
			// set our layout to be the home screen
			this.SetContentView(Resource.Layout.TaskDetails);
			this._nameTextEdit = this.FindViewById<EditText>(Resource.Id.txtName);
			this._notesTextEdit = this.FindViewById<EditText>(Resource.Id.txtNotes);
			this._saveButton = this.FindViewById<Button>(Resource.Id.btnSave);
			
			// find all our controls
			this._cancelDeleteButton = this.FindViewById<Button>(Resource.Id.btnCancelDelete);
			
			
			// set the cancel delete based on whether or not it's an existing task
			if(this._cancelDeleteButton != null)
			{ this._cancelDeleteButton.Text = (this._task.ID == 0 ? "Cancel" : "Delete"); }
			
			// name
			if(this._nameTextEdit != null) { this._nameTextEdit.Text = this._task.Name; }
			
			// notes
			if(this._notesTextEdit != null) { this._notesTextEdit.Text = this._task.Notes; }
			
			// button clicks 
			this._cancelDeleteButton.Click += (sender, e) => { this.CancelDelete(); };
			this._saveButton.Click += (sender, e) => { this.Save(); };
		}
Beispiel #20
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            etNum1 = FindViewById<EditText>(Resource.Id.etNum1);
            etNum2 = FindViewById<EditText>(Resource.Id.etNum2);
            btnAdd = (Button)FindViewById(Resource.Id.btnAdd);
            btnSub = (Button)FindViewById(Resource.Id.btnSub);
            btnMult = (Button)FindViewById(Resource.Id.btnMult);
            btnDiv = (Button)FindViewById(Resource.Id.btnDiv);
            tvResult = (TextView)FindViewById(Resource.Id.tvResult);

            btnAdd.Click += btnOper_Click;
            btnSub.Click += btnOper_Click;
            btnMult.Click += btnOper_Click;
            btnDiv.Click += btnOper_Click;

            var sPref = GetSharedPreferences(PreferencesActivity.XAPPP001PREF_NAME, FileCreationMode.Private);
            String num1Val = sPref.GetString(PreferencesActivity.PREFKEY_CALCULATOR_NUM1_VALUE, "0");
            String num2Val = sPref.GetString(PreferencesActivity.PREFKEY_CALCULATOR_NUM2_VALUE, "0");

            etNum1.Text = num1Val;
            etNum2.Text = num2Val;

            if (bundle != null)
            {
                etNum1.Text = bundle.GetString(Resource.Id.etNum1.ToString(), num1Val);
                etNum2.Text = bundle.GetString(Resource.Id.etNum2.ToString(), num2Val);
                tvResult.Text = bundle.GetString(Resource.Id.tvResult.ToString(), String.Empty);
                Log.Debug(GetType().FullName, "Recovered instance state");
            }
        }
		public override void OnActivityCreated (Bundle savedInstanceState)
		{
			base.OnActivityCreated (savedInstanceState);

			//radiogroup
			radio_advice_Group = View.FindViewById<RadioGroup> (Resource.Id.radio_advice_Group);
			radio_advice_Group.SetOnCheckedChangeListener (this);
			//radiobutton
			rbtn_zixun = View.FindViewById<RadioButton> (Resource.Id.rbtn_zixun);
			rbtn_zixun.Tag = ((int)AdviceType.Consult).ToString();
			//默认咨询选中
			rbtn_zixun.Checked = true;
			rbtn_jianyi = View.FindViewById<RadioButton> (Resource.Id.rbtn_jianyi);
			rbtn_jianyi.Tag =((int)AdviceType.Suggest).ToString ();
			rbtn_tousu = View.FindViewById<RadioButton> (Resource.Id.rbtn_tousu);
			rbtn_tousu.Tag = ((int)AdviceType.Complain).ToString ();
			rbtn_other = View.FindViewById<RadioButton> (Resource.Id.rbtn_other);
			rbtn_other.Tag = ((int)AdviceType.Other).ToString();

			edit_advice_title = View.FindViewById<EditText> (Resource.Id.edit_advice_title);
			edit_advice_content = View.FindViewById<EditText> (Resource.Id.edit_advice_content);
			//发表按钮
			btn_Publish = View.FindViewById<Button> (Resource.Id.btn_Publish);
			btn_Publish.Click += (sender, e) => 
			{
				PublishAdvice();
			};

			//初始化view完成
			IsPrepared = true;
			LasyloadData ();
		}
		protected async override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			
			String beaconID = Intent.GetStringExtra("BeaconID");
			if (!String.IsNullOrWhiteSpace(beaconID)) {
				beacon = await BeaconManager.GetBeaconAsync(beaconID);
			} else {
				currentGenerateGuid = Guid.NewGuid ();
				beacon.ID = currentGenerateGuid.ToString ();
			}
			
			// set our layout to be the home screen
			SetContentView(Resource.Layout.BeaconDetails);
			nameTextEdit = FindViewById<EditText>(Resource.Id.NameText);
			notesTextEdit = FindViewById<EditText>(Resource.Id.NotesText);
			saveButton = FindViewById<Button>(Resource.Id.SaveButton);
			
			// find all our controls
			cancelDeleteButton = FindViewById<Button>(Resource.Id.CancelDeleteButton);
			
			// set the cancel delete based on whether or not it's an existing task
			cancelDeleteButton.Text = (currentGenerateGuid != null ? "Cancel" : "Delete");

			nameTextEdit.Text = beacon.Name; 
			notesTextEdit.Text = beacon.Notes;

			// button clicks 
			cancelDeleteButton.Click += async (sender, e) => { await CancelDelete(); };
			saveButton.Click += async (sender, e) => { await Save(); };
		}
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			Dialog.SetTitle (GetString (Resource.String.sign_in));
			var v = inflater.Inflate (Resource.Layout.fingerprint_dialog_container, container, false);
			mCancelButton = (Button)v.FindViewById (Resource.Id.cancel_button);
			mCancelButton.Click += (object sender, EventArgs e) => Dismiss ();

			mSecondDialogButton = (Button)v.FindViewById (Resource.Id.second_dialog_button);
			mSecondDialogButton.Click += (object sender, EventArgs e) => {
				if (mStage == Stage.Fingerprint) {
					GoToBackup ();
				} else {
					VerifyPassword ();
				}
			};

			mFingerprintContent = v.FindViewById (Resource.Id.fingerprint_container);
			mBackupContent = v.FindViewById (Resource.Id.backup_container);
			mPassword = v.FindViewById<EditText> (Resource.Id.password);
			mPassword.SetOnEditorActionListener (this);
			mPasswordDescriptionTextView = v.FindViewById<TextView> (Resource.Id.password_description);
			mUseFingerprintFutureCheckBox = v.FindViewById<CheckBox> (Resource.Id.use_fingerprint_in_future_check);
			mNewFingerprintEnrolledTextView = v.FindViewById<TextView> (Resource.Id.new_fingerprint_enrolled_description);
			mFingerprintUiHelper = mFingerprintUiHelperBuilder.Build (
				(ImageView)v.FindViewById (Resource.Id.fingerprint_icon),
				(TextView)v.FindViewById (Resource.Id.fingerprint_status), this);
			UpdateStage ();

			// If fingerprint authentication is not available, switch immediately to the backup
			// (password) screen.
			if (!mFingerprintUiHelper.IsFingerprintAuthAvailable)
				GoToBackup ();

			return v;
		}
		private void InitView()
		{
			//设置标题栏
			var img_header_back = FindViewById<ImageView> (Resource.Id.img_header_back);
			img_header_back.Click += (sender, e) => 
			{
				this.Finish();
				OverridePendingTransition(Android.Resource.Animation.SlideInLeft,Android.Resource.Animation.SlideOutRight);
			};
			var tv_back = FindViewById<TextView> (Resource.Id.tv_back);
			tv_back.Text = "返回";
			var tv_desc = FindViewById<TextView> (Resource.Id.tv_desc);
			tv_desc.Text = "银行卡信息";

			edit_cardOwnerName = FindViewById<EditText> (Resource.Id.edit_cardOwnerName);
			edit_IdCardNo = FindViewById<EditText> (Resource.Id.edit_IdCardNo);
			edit_bankopenloc = FindViewById<EditText> (Resource.Id.edit_bankopenloc);
			edit_bankbranch = FindViewById<EditText> (Resource.Id.edit_bankbranch);
			edit_bankCardNo = FindViewById<EditText> (Resource.Id.edit_bankCardNo);
			edit_prePhoneNo = FindViewById<EditText> (Resource.Id.edit_prePhoneNo);
			edit_Code = FindViewById<EditText> (Resource.Id.edit_Code);
			img_choosebank = FindViewById<ImageView> (Resource.Id.img_choosebank);

			tv_SendCodeStatusShow = FindViewById<TextView> (Resource.Id.tv_SendCodeStatusShow);

			cb_defaut_bank = FindViewById<CheckBox> (Resource.Id.cb_defaut_bank);
			btn_Send = FindViewById<Button> (Resource.Id.btn_Send);
			btn_Add = FindViewById<Button> (Resource.Id.btn_Add);

			//选择银行卡
			img_choosebank.Click += (sender, e) => 
			{
				var intent = new Intent(this,typeof(ChooseBankTypeActivity));
				var requestCode = 0;  
				StartActivityForResult(intent,requestCode);
			};
			//安全码验证
			edit_Code.TextChanged += (sender, e) => 
			{
				if(edit_Code.Text.Length>0)
					btn_Add.Enabled = true;
				else
					btn_Add.Enabled =false;
			};
			//初始化计时器,启动
			mc = new MyCount(this,60000,1000);
			//发送验证码
			btn_Send.Click += (sender, e) => 
			{
				tv_SendCodeStatusShow.Visibility = ViewStates.Invisible;
				btn_Send.Enabled = false;
				SendCode();
			};

			//添加银行卡信息
			btn_Add.Click += (sender, e) => 
			{
				AddBank();
			};
		}
 public KundeListviewSearchDialog(MainActivity activity, string title, EditText edTarget,StateFragmentArtikelPreisInfo state): base(activity)
 {
     _activity = activity;  
     _title = title;
     _edTarget = edTarget;
     _state = state;
 }
        /// <summary>
        /// Called when [create].
        /// </summary>
        /// <param name="bundle">The bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            try
            {
                base.OnCreate(bundle);
                this.RequestWindowFeature(WindowFeatures.NoTitle);
                SetContentView(Resource.Layout.Login);
                var loginButton = FindViewById<Button>(Resource.Id.btnLogin);
                loginButton.Click += loginButton_Click;
                txtUserName = FindViewById<EditText>(Resource.Id.txtUserName);
                txtPassword = FindViewById<EditText>(Resource.Id.txtPassword);
                chkRememberMe = FindViewById<CheckBox>(Resource.Id.chkRememberMe);
                ResetControl();
                txtUserName.Text = DecurtisDomain;
                txtUserName.SetSelection(txtUserName.Text.Length);
                if (ApplicationData.User != null && !string.IsNullOrEmpty(ApplicationData.User.LoginName))
                {
                    txtUserName.Text = ApplicationData.User.LoginName;
                }
            }
            catch (Exception e)
            {
                AlertMessage(GetString(Resource.String.Error), e.Message.ToString());
            }

            // Create your application here
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            SetContentView (Resource.Layout.Login);

            // Services
            LoginService = new Service.LoginService ();

            // UI elements
            UsernameInput = FindViewById<EditText> (Resource.Id.loginInputUsername);
            PasswordInput = FindViewById<EditText> (Resource.Id.loginInputPassword);
            LoginButton = FindViewById<Button> (Resource.Id.loginBtn);

            // Login button click event
            LoginButton.Click += OnLoginButtonClick;

            // GPS Button test
            Button gpsButton = FindViewById<Button> (Resource.Id.gpsBtn);
            gpsButton.Click += (object sender, System.EventArgs e) => {
                LocationManager location = GetSystemService(LocationService) as LocationManager;
                Criteria gpsCriteria = new Criteria() {
                    Accuracy = Accuracy.Coarse,
                    AltitudeRequired = false,
                    BearingRequired = false,
                    CostAllowed = true,
                    PowerRequirement = Power.NoRequirement,
                    SpeedRequired = false,
                };

                Location currentLocation = location.GetLastKnownLocation(location.GetBestProvider(gpsCriteria, false));
            };
        }
        protected override async void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

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

            CurrentPlatform.Init ();

            // await InitLocalStoreAsync();
            //await InitLocalStoreAsync();

            // Get the Mobile Service sync table instance to use
            var beaconTable = client.GetSyncTable <Beacon> ();

            textNewToDo = FindViewById<EditText> (Resource.Id.textNewToDo);

            // Create an adapter to bind the items with the view
            adapter = new Adapters.BeaconAdapter(this, Resource.Layout.Row_List_To_Do);
            var listViewBeacon = FindViewById<ListView> (Resource.Id.listViewToDo);
            listViewBeacon.Adapter = adapter;

            // Load the items from the Mobile Service
            OnRefreshItemsSelected ();
        }
Beispiel #29
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            m_dataManager = DataManager.GetDataManager();

            m_connectionButton = FindViewById<Button>(Resource.Id.connectButton);
            m_login = FindViewById<EditText>(Resource.Id.loginField);
            m_password = FindViewById<EditText>(Resource.Id.passwordField);
            m_checkBox = FindViewById<CheckBox>(Resource.Id.rememberPass);

            // Store user data
            if (m_dataManager.RetreiveData<bool>("loginCheckBox") == true)
            {
                m_login.Text = m_dataManager.RetreiveData<string>("login");
                m_password.Text = m_dataManager.RetreiveData<string>("password");
                m_checkBox.Checked = m_dataManager.RetreiveData<bool>("loginCheckBox");
            }

            StartService(new Intent(this, typeof(NetworkService)));
            BindService(new Intent(this, typeof(NetworkService)), this, Bind.AutoCreate);

            m_connectionButton.Click += delegate {
                m_netwokService.SetLoginInfo(m_login.Text, m_password.Text);
                m_netwokService.LoginEvent += OnLogin;
                m_netwokService.Login();
            };
        }
Beispiel #30
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
                case Resource.Id.actionNew:
                    string default_game_name = "Game";
                    AlertDialog.Builder alert1 = new AlertDialog.Builder(this.Activity);
                    EditText input = new EditText(this.Activity);
                    input.Text = default_game_name;
                    alert1.SetTitle("Game Name");
                    alert1.SetView(input);
                    alert1.SetPositiveButton("OK", delegate { AddGame(input.Text); });
                    alert1.SetNegativeButton("Cancel", (s, e) => { });
                    alert1.Show();
                    _adapter.NotifyDataSetChanged();
                    return true;

                case Resource.Id.actionRefresh:
                    GameData.Service.RefreshCache();
                    _adapter.NotifyDataSetChanged();
                    return true;

                default:
                    return base.OnOptionsItemSelected(item);
            }
        }
Beispiel #31
0
        private void ItemCountLayout()
        {
            //ItemCount
            TextView itemLabel = new TextView(context);

            itemLabel.Text                  = "Item Count";
            itemLabel.LayoutParameters      = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent);
            itemLabel.Gravity               = GravityFlags.CenterVertical;
            itemLabel.TextSize              = 15;
            itemCountEntry                  = new EditText(context);
            itemCountEntry.Gravity          = GravityFlags.Left;
            itemCountEntry.Text             = itemCountPosition.ToString();
            itemCountEntry.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent);
            itemCountEntry.TextSize         = 16;
            itemCountEntry.InputType        = Android.Text.InputTypes.ClassPhone;
            itemCountEntry.TextChanged     += (object sender, Android.Text.TextChangedEventArgs e) => {
                if (itemCountEntry.Text.Length > 0)
                {
                    try
                    {
                        constCount = Convert.ToInt32(e.Text.ToString());
                    }
                    catch (Exception)
                    {
                        constCount = 1;
                    }
                }

                itemCountPosition = constCount;
                ApplyChanges();
            };

            TextView spaceLabel = new TextView(context);

            spaceLabel.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.167), ViewGroup.LayoutParams.WrapContent);

            //itemCountLayout
            LinearLayout itemCountLayout = new LinearLayout(context);

            itemCountLayout.Orientation = Android.Widget.Orientation.Horizontal;
            itemCountLayout.AddView(itemLabel);
            itemCountLayout.AddView(itemCountEntry);
            proprtyOptionsLayout.AddView(itemCountLayout);

            //spaceText
            TextView spaceText4 = new TextView(context);

            spaceText4.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60, GravityFlags.Center);
            proprtyOptionsLayout.AddView(spaceText4);

            //layout1
            LinearLayout layout1 = new LinearLayout(context);

            layout1.Orientation = Android.Widget.Orientation.Horizontal;
            layout1.AddView(spaceLabel);
            layout1.AddView(proprtyOptionsLayout);

            //propertylayout
            propertylayout.AddView(topProperty);
            propertylayout.AddView(layout1);
            propertylayout.FocusableInTouchMode = true;
            propertylayout.Touch += (object sender, View.TouchEventArgs e) =>
            {
                Rect outRect = new Rect();
                itemCountEntry.GetGlobalVisibleRect(outRect);

                if (!outRect.Contains((int)e.Event.RawX, (int)e.Event.RawY))
                {
                    itemCountEntry.ClearFocus();
                }
                hideSoftKeyboard((Activity)context);
            };
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            try
            {
                SetContentView(Resource.Layout.PersonalData);
                edit_city_coord_for_edit = city_coord_for_edit_prefs.Edit();
                nameET             = FindViewById <EditText>(Resource.Id.nameET);
                last_nameET        = FindViewById <EditText>(Resource.Id.last_nameET);
                patronimicET       = FindViewById <EditText>(Resource.Id.patronimicET);
                emailET            = FindViewById <EditText>(Resource.Id.emailET);
                phoneET            = FindViewById <EditText>(Resource.Id.phoneET);
                cityTV             = FindViewById <TextView>(Resource.Id.cityTV);
                saveBn             = FindViewById <Button>(Resource.Id.saveBn);
                mainRL             = FindViewById <RelativeLayout>(Resource.Id.mainRL);
                backRelativeLayout = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout);
                back_button        = FindViewById <ImageButton>(Resource.Id.back_button);
                coordinatesTV      = FindViewById <TextView>(Resource.Id.coordinatesTV);
                activityIndicator  = FindViewById <ProgressBar>(Resource.Id.activityIndicator);
                activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply);
                singleDataScrollView            = FindViewById <ScrollView>(Resource.Id.singleDataScrollView);
                back_button.Click              += (s, e) => { OnBackPressed(); };
                backRelativeLayout.Click       += (s, e) => { OnBackPressed(); };
                activityIndicator.Visibility    = Android.Views.ViewStates.Visible;
                singleDataScrollView.Visibility = Android.Views.ViewStates.Gone;
                saveBn.Visibility               = Android.Views.ViewStates.Gone;
                var user_data = await profileAndExpertMethodsPCL.UserProfileData(userMethods.GetUsersAuthToken());

                if (user_data == "401")
                {
                    Toast.MakeText(this, Resource.String.you_not_logined, ToastLength.Long).Show();
                    userMethods.ClearTable();
                    userMethods.ClearUsersDataTable();
                    userMethods.ClearTableNotif();
                    StartActivity(typeof(MainActivity));
                    return;
                }
                activityIndicator.Visibility    = Android.Views.ViewStates.Gone;
                singleDataScrollView.Visibility = Android.Views.ViewStates.Visible;
                saveBn.Visibility = Android.Views.ViewStates.Visible;

                Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf");
                FindViewById <TextView>(Resource.Id.headerTV).SetTypeface(tf, TypefaceStyle.Bold);
                FindViewById <TextView>(Resource.Id.removeBn).SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.textViesw2).SetTypeface(tf, TypefaceStyle.Normal);
                FindViewById <TextView>(Resource.Id.textVssiew2).SetTypeface(tf, TypefaceStyle.Normal);
                nameET.SetTypeface(tf, TypefaceStyle.Normal);
                last_nameET.SetTypeface(tf, TypefaceStyle.Normal);
                patronimicET.SetTypeface(tf, TypefaceStyle.Normal);
                cityTV.SetTypeface(tf, TypefaceStyle.Normal);
                coordinatesTV.SetTypeface(tf, TypefaceStyle.Normal);
                saveBn.SetTypeface(tf, TypefaceStyle.Normal);
                emailET.SetTypeface(tf, TypefaceStyle.Normal);
                phoneET.SetTypeface(tf, TypefaceStyle.Normal);

                try
                {
                    var deserialized_user_data = JsonConvert.DeserializeObject <UserProfile>(user_data);
                    try
                    {
                        string[] words = deserialized_user_data.fullName.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                        nameET.Text       = words[0];
                        patronimicET.Text = words[1];
                        last_nameET.Text  = words[2];
                        edit_city_coord_for_edit.PutString("surname", words[2]);
                        edit_city_coord_for_edit.PutString("name", words[0]);
                        edit_city_coord_for_edit.PutString("middlename", words[1]);
                    }
                    catch { }
                    emailET.Text = userMethods.GetUsersEmail();
                    phoneET.Text = deserialized_user_data.phone;
                    cityTV.Text  = deserialized_user_data.city.name;
                    edit_city_coord_for_edit.PutString("city_id", deserialized_user_data.city.id);
                    edit_city_coord_for_edit.PutString("city_name", deserialized_user_data.city.name);
                    edit_city_coord_for_edit.PutString("lat", deserialized_user_data.coordinates.latitude);
                    edit_city_coord_for_edit.PutString("lng", deserialized_user_data.coordinates.longitude);
                    try
                    {
                        if (Convert.ToInt32(deserialized_user_data.coordinates.latitude) == 0)
                        {
                            edit_city_coord_for_edit.PutString("lat", pref.GetString("latitude", String.Empty));
                        }
                    }
                    catch { }
                    try
                    {
                        if (Convert.ToInt32(deserialized_user_data.coordinates.longitude) == 0)
                        {
                            edit_city_coord_for_edit.PutString("lng", pref.GetString("longitude", String.Empty));
                        }
                    }
                    catch { }
                    edit_city_coord_for_edit.PutString("phone", deserialized_user_data.phone);
                    edit_city_coord_for_edit.PutString("email", userMethods.GetUsersEmail());
                    edit_city_coord_for_edit.Apply();
                }
                catch
                {
                    deserialized_user_data_categs_empty = JsonConvert.DeserializeObject <UserProfileServiceCategoriesEmpty>(user_data);
                    try
                    {
                        string[] words = deserialized_user_data_categs_empty.fullName.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                        nameET.Text       = words[0];
                        patronimicET.Text = words[1];
                        last_nameET.Text  = words[2];
                        edit_city_coord_for_edit.PutString("surname", words[2]);
                        edit_city_coord_for_edit.PutString("name", words[0]);
                        edit_city_coord_for_edit.PutString("middlename", words[1]);
                    }
                    catch { }
                    emailET.Text = userMethods.GetUsersEmail();
                    phoneET.Text = deserialized_user_data_categs_empty.phone;
                    cityTV.Text  = deserialized_user_data_categs_empty.city.name;
                    edit_city_coord_for_edit.PutString("city_id", deserialized_user_data_categs_empty.city.id);
                    edit_city_coord_for_edit.PutString("city_name", deserialized_user_data_categs_empty.city.name);
                    edit_city_coord_for_edit.PutString("lat", deserialized_user_data_categs_empty.coordinates.latitude);
                    edit_city_coord_for_edit.PutString("lng", deserialized_user_data_categs_empty.coordinates.longitude);
                    try
                    {
                        if (Convert.ToInt32(deserialized_user_data_categs_empty.coordinates.latitude) == 0)
                        {
                            edit_city_coord_for_edit.PutString("lat", pref.GetString("latitude", String.Empty));
                        }
                    }
                    catch { }
                    try
                    {
                        if (Convert.ToInt32(deserialized_user_data_categs_empty.coordinates.longitude) == 0)
                        {
                            edit_city_coord_for_edit.PutString("lng", pref.GetString("longitude", String.Empty));
                        }
                    }
                    catch { }
                    edit_city_coord_for_edit.PutString("phone", deserialized_user_data_categs_empty.phone);
                    edit_city_coord_for_edit.PutString("email", userMethods.GetUsersEmail());
                    edit_city_coord_for_edit.Apply();
                }
                FindViewById <RelativeLayout>(Resource.Id.cityRL).Click += (s, e) =>
                {
                    StartActivity(typeof(CountryForProfileCityActivity));
                };
                FindViewById <RelativeLayout>(Resource.Id.locationRL).Click += (s, e) =>
                {
                    StartActivity(typeof(NewProfileCoordsMapActivity));
                };
                saveBn.Click += async(s, e) =>
                {
                    if (
                        !String.IsNullOrEmpty(last_nameET.Text) &&
                        !String.IsNullOrEmpty(nameET.Text) &&
                        !String.IsNullOrEmpty(phoneET.Text) &&
                        !String.IsNullOrEmpty(patronimicET.Text) &&
                        !String.IsNullOrEmpty(emailET.Text))
                    {
                        activityIndicator.Visibility    = Android.Views.ViewStates.Visible;
                        singleDataScrollView.Visibility = Android.Views.ViewStates.Gone;
                        saveBn.Visibility = Android.Views.ViewStates.Gone;
                        var res = await profileAndExpertMethods.EditMyProfileInfo(
                            userMethods.GetUsersAuthToken(),
                            phoneET.Text,
                            emailET.Text,
                            last_nameET.Text,
                            nameET.Text,
                            patronimicET.Text,
                            city_coord_for_edit_prefs.GetString("city_id", String.Empty),
                            city_coord_for_edit_prefs.GetString("lat", String.Empty),
                            city_coord_for_edit_prefs.GetString("lng", String.Empty));

                        activityIndicator.Visibility    = Android.Views.ViewStates.Gone;
                        singleDataScrollView.Visibility = Android.Views.ViewStates.Visible;
                        saveBn.Visibility = Android.Views.ViewStates.Visible;
                        if (res.Contains("с таким email уже"))
                        {
                            Toast.MakeText(this, GetString(Resource.String.email_already_exists), ToastLength.Short).Show();
                        }
                        else if (res.Contains("или неверно заполнен те"))
                        {
                            Toast.MakeText(this, GetString(Resource.String.wrong_phone), ToastLength.Short).Show();
                        }
                        else
                        {
                            ISharedPreferences       pref = Application.Context.GetSharedPreferences("reg_data", FileCreationMode.Private);
                            ISharedPreferencesEditor edit = pref.Edit();
                            edit.PutString("surname", "");
                            edit.PutString("name", "");
                            edit.PutString("patronymic", "");
                            edit.PutString("phone", "");
                            edit.PutString("email", "");
                            edit.Apply();
                            var token = JsonConvert.DeserializeObject <SingleToken>(res).authToken;
                            userMethods.InsertUser(token, emailET.Text);

                            StartActivity(typeof(UserProfileActivity));
                        }
                    }
                    else
                    {
                        Toast.MakeText(this, GetString(Resource.String.fill_all_entries), ToastLength.Short).Show();
                    }
                };
            }
            catch
            {
                StartActivity(typeof(MainActivity));
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.AddScreen);
            // Create your application here

            Button saveButton   = FindViewById <Button>(Resource.Id.saveButton);
            Button cancelButton = FindViewById <Button>(Resource.Id.cancelButton);

            RadioGroup  radioButton   = FindViewById <RadioGroup>(Resource.Id.radioGroup1);
            RadioButton checkedButton = FindViewById <RadioButton>(radioButton.CheckedRadioButtonId);


            saveButton.Click += (sender, e) =>
            {
                EditText inputText = FindViewById <EditText>(Resource.Id.textInput);
                string   input     = inputText.Text;
                inputText.Text = null;

                var saveTruths = Application.Context.GetSharedPreferences("MySavedTruths", FileCreationMode.Private);
                var editT      = saveTruths.Edit();
                var saveDares  = Application.Context.GetSharedPreferences("MySavedDares", FileCreationMode.Private);
                var editD      = saveTruths.Edit();

                if (inputText.Text != null)
                {
                    if (t)
                    {
                        editT.PutString("Truths", input);
                        editT.Commit();
                        Android.Widget.Toast.MakeText(this, "Added to the list", ToastLength.Short).Show();
                        inputText.Text = "";
                    }
                    else if (t == false)
                    {
                        editD.PutString("Dares", input);
                        editD.Commit();
                        Android.Widget.Toast.MakeText(this, "Added to the list", ToastLength.Short).Show();
                        inputText.Text = "";
                    }
                    inputText.Text = null;

                    var intent = new Intent(this, typeof(customizedList));
                    StartActivity(intent);
                }
                else
                {
                    Android.Widget.Toast.MakeText(this, "You cant have an empty truth or dare", ToastLength.Short).Show();
                }
            };

            cancelButton.Click += (sender, e) =>
            {
                EditText inputText = FindViewById <EditText>(Resource.Id.textInput);
                inputText.Text = null;

                var saveStringA = Application.Context.GetSharedPreferences("MySavedDares", FileCreationMode.Private);
                var editA       = saveStringA.Edit();

                var saveString = Application.Context.GetSharedPreferences("MySavedTruths", FileCreationMode.Private);
                var edit       = saveString.Edit();
                edit.Clear();
                edit.Commit();
                editA.Clear();
                editA.Commit();

                var intent = new Intent(this, typeof(customizedList));
                StartActivity(intent);
            };
        }
        public override void RunVoicePromptAsync(string prompt, Action postDisplayCallback, Action <string> callback)
        {
            new Thread(() =>
            {
                string input = null;
                ManualResetEvent dialogDismissWait = new ManualResetEvent(false);

                RunActionUsingMainActivityAsync(mainActivity =>
                {
                    mainActivity.RunOnUiThread(() =>
                    {
                        #region set up dialog
                        TextView promptView = new TextView(mainActivity)
                        {
                            Text = prompt, TextSize = 20
                        };
                        EditText inputEdit = new EditText(mainActivity)
                        {
                            TextSize = 20
                        };
                        LinearLayout scrollLayout = new LinearLayout(mainActivity)
                        {
                            Orientation = global::Android.Widget.Orientation.Vertical
                        };
                        scrollLayout.AddView(promptView);
                        scrollLayout.AddView(inputEdit);
                        ScrollView scrollView = new ScrollView(mainActivity);
                        scrollView.AddView(scrollLayout);

                        AlertDialog dialog = new AlertDialog.Builder(mainActivity)
                                             .SetTitle("Sensus is requesting input...")
                                             .SetView(scrollView)
                                             .SetPositiveButton("OK", (o, e) =>
                        {
                            input = inputEdit.Text;
                        })
                                             .SetNegativeButton("Cancel", (o, e) =>
                        {
                        })
                                             .Create();

                        dialog.DismissEvent += (o, e) =>
                        {
                            dialogDismissWait.Set();
                        };

                        ManualResetEvent dialogShowWait = new ManualResetEvent(false);

                        dialog.ShowEvent += (o, e) =>
                        {
                            dialogShowWait.Set();

                            if (postDisplayCallback != null)
                            {
                                postDisplayCallback();
                            }
                        };

                        // dismiss the keyguard when dialog appears
                        dialog.Window.AddFlags(global::Android.Views.WindowManagerFlags.DismissKeyguard);
                        dialog.Window.AddFlags(global::Android.Views.WindowManagerFlags.ShowWhenLocked);
                        dialog.Window.AddFlags(global::Android.Views.WindowManagerFlags.TurnScreenOn);
                        dialog.Window.SetSoftInputMode(global::Android.Views.SoftInput.AdjustResize | global::Android.Views.SoftInput.StateAlwaysHidden);

                        // dim whatever is behind the dialog
                        dialog.Window.AddFlags(global::Android.Views.WindowManagerFlags.DimBehind);
                        dialog.Window.Attributes.DimAmount = 0.75f;

                        dialog.Show();
                        #endregion

                        #region voice recognizer
                        new Thread(() =>
                        {
                            // wait for the dialog to be shown so it doesn't hide our speech recognizer activity
                            dialogShowWait.WaitOne();

                            // there's a slight race condition between the dialog showing and speech recognition showing. pause here to prevent the dialog from hiding the speech recognizer.
                            Thread.Sleep(1000);

                            Intent intent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
                            intent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm);
                            intent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 1500);
                            intent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1500);
                            intent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 15000);
                            intent.PutExtra(RecognizerIntent.ExtraMaxResults, 1);
                            intent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default);
                            intent.PutExtra(RecognizerIntent.ExtraPrompt, prompt);

                            mainActivity.GetActivityResultAsync(intent, AndroidActivityResultRequestCode.RecognizeSpeech, result =>
                            {
                                if (result != null && result.Item1 == Result.Ok)
                                {
                                    IList <string> matches = result.Item2.GetStringArrayListExtra(RecognizerIntent.ExtraResults);
                                    if (matches != null && matches.Count > 0)
                                    {
                                        mainActivity.RunOnUiThread(() =>
                                        {
                                            inputEdit.Text = matches[0];
                                        });
                                    }
                                }
                            });
                        }).Start();
                        #endregion
                    });
                }, true, false);

                dialogDismissWait.WaitOne();
                callback(input);
            }).Start();
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            this.SetContentView(Resource.Layout.LoginActivityLayout);

            textUsername         = this.FindViewById <EditText>(Resource.Id.textUsername);
            textPassword         = this.FindViewById <EditText>(Resource.Id.textPassword);
            buttonLogin          = this.FindViewById <Android.Widget.Button>(Resource.Id.buttonLogin);
            textLoginInfo        = this.FindViewById <TextView>(Resource.Id.textLoginInfo);
            textLoginInfosubtext = this.FindViewById <TextView>(Resource.Id.textLoginInfosubtext);

            this.Title = "User Login";



            buttonLogin.Click += async(sender, e) =>
            {
                var user     = string.Empty;
                var password = string.Empty;

                this.RunOnUiThread(() => { user = this.textUsername.Text; });
                this.RunOnUiThread(() => { password = this.textPassword.Text; });

                username = user;
                userpass = password;


                //AzureService service = new AzureService();
                var api = new ZendeskApi("https://greenworkstools1552039260.zendesk.com/api/v2", user, password, "");

                this.textLoginInfo.Text = "Connecting to Zendesk...";

                IList <TicketField> allfields = new List <TicketField>();

                try
                {
                    //retrieve ticket fields from Zendesk
                    GroupTicketFieldResponse fields = await api.Tickets.GetTicketFieldsAsync();

                    foreach (TicketField fielddata in fields.TicketFields)
                    {
                        allfields.Add(fielddata);
                    }
                    if (!String.IsNullOrEmpty(allfields[2].Title))
                    {
                        this.textLoginInfo.Text = "Succesfully connected and validated user!";
                        await Task.Delay(1000);

                        StartActivity(typeof(DecoderActivity));
                    }
                    else
                    {
                        this.textLoginInfo.Text = "Unable to retrieve ticket fields!";
                    }
                }
                catch (WebException ex)
                {
                    this.textLoginInfo.Text        = "Invalid Username or Password";
                    this.textLoginInfosubtext.Text = ex.Message;
                    await Task.Delay(2000);

                    this.textLoginInfo.Text        = "Enter a valid Username and Password";
                    this.textLoginInfosubtext.Text = "";
                    //throw new WebException(ex.Message + " " + ex.Response.Headers.ToString(), ex);
                }

                /*if (this.textUsername.Text == service.textUsername)
                 * {
                 *  if (this.textPassword.Text == service.textPassword)
                 *  {
                 *      this.textLoginInfo.Text = "User Found!";
                 *
                 *      currentUser.Name = service.textName;
                 *      currentUser.Date = DateTime.Now;
                 *
                 *      this.textLoginInfo.Text = "Succesfully Logged in!";
                 *      StartActivity(typeof(DecoderActivity));
                 *  }
                 *  else
                 *  {
                 *      this.textLoginInfo.Text = "Invalid Password";
                 *  }
                 * }
                 * else
                 * {
                 *  this.textLoginInfo.Text = "Unrecognized Username";
                 * }*/
            };
        }
        private void HideKeyboard(EditText userInput)
        {
            InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService);

            imm.HideSoftInputFromWindow(userInput.WindowToken, 0);
        }
Beispiel #37
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.profile);
            var    email       = Intent.GetStringExtra("userEmail");
            var    pass        = Intent.GetStringExtra("password");
            var    profileType = Intent.GetStringExtra("loginAs");
            Button logOutT     = FindViewById <Button>(Resource.Id.logOutT);
            Button edit        = FindViewById <Button>(Resource.Id.Edit);
            Button save        = FindViewById <Button>(Resource.Id.Save);

            save.Enabled = false;

            EditText nameET     = FindViewById <EditText>(Resource.Id.name);
            EditText bioET      = FindViewById <EditText>(Resource.Id.bio);
            EditText emailET    = FindViewById <EditText>(Resource.Id.EmailID);
            EditText passET     = FindViewById <EditText>(Resource.Id.PasswordID);
            EditText ageET      = FindViewById <EditText>(Resource.Id.AgeID);
            EditText contactET  = FindViewById <EditText>(Resource.Id.ContactID);
            EditText genderET   = FindViewById <EditText>(Resource.Id.GenderID);
            EditText subject1ET = FindViewById <EditText>(Resource.Id.subject1ID);
            EditText subject2ET = FindViewById <EditText>(Resource.Id.subject2ID);

            DBHelper sqlFunctions = new DBHelper(this);
            ICursor  details      = sqlFunctions.getUserDetails(email, pass, profileType);

            while (details.MoveToNext())
            {
                Console.WriteLine(" Value  Of Name  FROM DB  --> " + details.GetString(details.GetColumnIndexOrThrow("Name")));

                nameET.Text     = details.GetString(details.GetColumnIndexOrThrow("Name"));
                bioET.Text      = details.GetString(details.GetColumnIndexOrThrow("Bio"));
                emailET.Text    = email;
                passET.Text     = pass;
                ageET.Text      = details.GetString(details.GetColumnIndexOrThrow("Age"));
                contactET.Text  = details.GetString(details.GetColumnIndexOrThrow("Contact"));
                genderET.Text   = details.GetString(details.GetColumnIndexOrThrow("gender"));
                subject1ET.Text = details.GetString(details.GetColumnIndexOrThrow("Subject1"));
                subject2ET.Text = details.GetString(details.GetColumnIndexOrThrow("Subject2"));
            }
            edit.Click += delegate
            {
                nameET.Enabled     = true;
                bioET.Enabled      = true;
                passET.Enabled     = true;
                ageET.Enabled      = true;
                contactET.Enabled  = true;
                genderET.Enabled   = true;
                subject1ET.Enabled = true;
                subject2ET.Enabled = true;
                edit.Enabled       = false;
                edit.Visibility    = ViewStates.Invisible;
                save.Enabled       = true;
                save.Visibility    = ViewStates.Visible;
            };
            save.Click += delegate
            {
                nameET.Enabled     = false;
                bioET.Enabled      = false;
                passET.Enabled     = false;
                ageET.Enabled      = false;
                contactET.Enabled  = false;
                genderET.Enabled   = false;
                subject1ET.Enabled = false;
                subject2ET.Enabled = false;
                edit.Enabled       = true;
                edit.Visibility    = ViewStates.Visible;
                save.Enabled       = false;
                save.Visibility    = ViewStates.Invisible;
            };
            logOutT.Click += delegate
            {
                Intent logOutteach = new Intent(this, typeof(MainActivity));
                StartActivity(logOutteach);
            };
        }
Beispiel #38
0
        public static View LoadMultilineElementLayout(Context context, View convertView, ViewGroup parent, int layoutId, out EditText value)
        {
            var layout = convertView ?? LoadLayout(context, parent, layoutId);

            if (layout != null)
            {
                value = layout.FindViewById <EditText>(Resource.Id.dialog_ValueField);
            }
            else
            {
                Log.Error("Android.Dialog", "LoadMultilineElementLayout: Failed to load resource: " + layoutId.ToString(CultureInfo.InvariantCulture));
                value = null;
            }
            return(layout);
        }
        private void CreateLayout()
        {
            // This section creates the UI elements and adds them to the layout view of the GUI

            // Create a stack layout
            LinearLayout layout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };

            // Create a list of stretch renderer choices the user can choose from
            _RendererTypes            = new ListView(this);
            _RendererTypes.ItemClick += RendererTypes_SelectionChanged;
            layout.AddView(_RendererTypes);

            // ------------

            // Create a sub layout to organize the label and 1st parameter on a single horizontal line
            LinearLayout subLayout1 = new LinearLayout(this)
            {
                Orientation = Orientation.Horizontal
            };

            // Create label that displays the 1st parameter used by the stretch renderer
            _Label_Parameter1 = new TextView(this)
            {
                Text = "Minimum value (0 - 255):"
            };
            subLayout1.AddView(_Label_Parameter1);

            // Create text field for 1st parameter used by the stretch renderer that the user can modify
            _Input_Parameter1 = new EditText(this)
            {
                Text = "10"
            };
            subLayout1.AddView(_Input_Parameter1);

            // Add the sub layout to the main layout
            layout.AddView(subLayout1);

            // ------------

            // Create a sub layout to organize the label and 2nd parameter on a single horizontal line
            LinearLayout subLayout2 = new LinearLayout(this)
            {
                Orientation = Orientation.Horizontal
            };

            // Create label that displays the 2nd parameter used by the stretch renderer
            _Label_Parameter2 = new TextView(this)
            {
                Text = "Maximum value (0 - 255):"
            };
            subLayout2.AddView(_Label_Parameter2);

            // Create text field for 2nd parameter used by the stretch renderer that the user can modify
            _Input_Parameter2 = new EditText(this)
            {
                Text = "150"
            };
            subLayout2.AddView(_Input_Parameter2);

            // Add the sub layout to the main layout
            layout.AddView(subLayout2);

            // ------------

            // Create button to change stretch renderer of the raster
            _UpdateRenderer = new Button(this)
            {
                Text = "Update Renderer"
            };
            // Hook to touch/click event of the button
            _UpdateRenderer.Click += OnUpdateRendererClicked;
            layout.AddView(_UpdateRenderer);

            // Create the map view and add it to the main layout
            _myMapView = new MapView(this);
            layout.AddView(_myMapView);

            // Set the layout as the sample view
            SetContentView(layout);
        }
Beispiel #40
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);


            //Assigning Views with their layout ID
            EditText IDEmp       = (EditText)FindViewById(Resource.Id.id_emp);
            EditText NameEmp     = (EditText)FindViewById(Resource.Id.name_emp);
            EditText PhoneEmp    = (EditText)FindViewById(Resource.Id.phone_emp);
            EditText RemoveID    = (EditText)FindViewById(Resource.Id.removeid_emp);
            Button   CreateEntry = (Button)FindViewById(Resource.Id.Btn_Create);
            Button   UpdateEntry = (Button)FindViewById(Resource.Id.Btn_Update);
            Button   DeleteEntry = (Button)FindViewById(Resource.Id.Btn_Delete);
            Button   ReadEntry   = (Button)FindViewById(Resource.Id.Btn_Read);

            dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "data.db3");
            db     = new SQLiteConnection(dbPath);
            db.CreateTable <Employee>();


            //Create Function
            CreateEntry.Click += delegate {
                Employee employee = new Employee(Int32.Parse(IDEmp.Text), NameEmp.Text, PhoneEmp.Text);
                db.Insert(employee);
                Toast.MakeText(Application.Context, "Created a new employee profile", ToastLength.Long).Show();
            };

            //Update Function
            UpdateEntry.Click += delegate {
                var table = db.Table <Employee>();

                int i = 0;
                foreach (var item in table)
                {
                    if (item.ID.ToString().Equals(IDEmp.Text))
                    {
                        db.Execute("UPDATE Employee SET name = ?, phoneNumber = ? Where id = ?", NameEmp.Text, PhoneEmp.Text, IDEmp.Text);
                        Toast.MakeText(Application.Context, "Updated employee profile associated with Employee No.: " + IDEmp.Text, ToastLength.Long).Show();
                        i = 1;
                        break;
                    }
                }

                //If no record was found
                if (i == 0)
                {
                    Toast.MakeText(Application.Context, "Profile with this Employee No. hasn't been created yet", ToastLength.Long).Show();
                }
            };

            //Delete Function
            DeleteEntry.Click += delegate {
                var table = db.Table <Employee>();

                int i = 0;
                foreach (var item in table)
                {
                    if (item.ID.ToString().Equals(RemoveID.Text))
                    {
                        //Update Query
                        string query = "delete from Employee where id=" + RemoveID.Text;
                        db.Execute(query);
                        Toast.MakeText(Application.Context, "Deleted employee profile associated with Employee No.: " + RemoveID.Text, ToastLength.Long).Show();
                        i = 1;
                        break;
                    }
                }

                //If no record was found
                if (i == 0)
                {
                    Toast.MakeText(Application.Context, "Profile with this Employee No. hasn't been created yet", ToastLength.Long).Show();
                }
            };

            message = "";

            //Read Function
            ReadEntry.Click += delegate {
                var table = db.Table <Employee>();


                foreach (var item in table)
                {
                    message = message + item.ID + "," + item.Name + "," + item.PhoneNumber + "\n";
                }
                StartActivity(new Android.Content.Intent(this, typeof(Read)));
            };
        }
Beispiel #41
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            //DB existance check
            var db = new SQLiteConnection(DBPath);

            if (!System.IO.File.Exists(DBPath))
            {
                Console.WriteLine("Database Create:" + DBPath);
            }
            else
            {
                Console.WriteLine("Already Database Created: " + DBPath);
            }

            EditText tv_Id = FindViewById <EditText>(Resource.Id.input_id);
            EditText tv_Pw = FindViewById <EditText>(Resource.Id.input_pw);



            Button bt_Login = FindViewById <Button>(Resource.Id.bt_Login);
            Button bt_Join  = FindViewById <Button>(Resource.Id.bt_Join);


            db.CreateTable <CustomerTable>();

            bt_Login.Click += delegate
            {
                if (tv_Id.Text == "")
                {
                    var toast = Toast.MakeText(ApplicationContext, "Enter Id Plz~", ToastLength.Short);
                    toast.Show();
                }
                else if (tv_Pw.Text == "")
                {
                    var toast = Toast.MakeText(ApplicationContext, "Enter Password Plz~", ToastLength.Short);
                    toast.Show();
                }
                else
                {
                    var    checkID = from s in db.Table <CustomerTable>() where s.CustomerID.Equals(tv_Id.Text) select s;
                    int    cnt     = 0;
                    string tablePW = null;
                    foreach (var s in checkID)
                    {
                        cnt++;
                        tablePW = s.CustomerPW;
                    }

                    if (cnt == 0)
                    {
                        var errorToast = Toast.MakeText(ApplicationContext, "This Id is not exsist ", ToastLength.Short);
                        errorToast.Show();
                    }
                    else
                    {
                        if (tablePW == tv_Pw.Text)
                        {
                            var intent = new Intent(this, typeof(indexActivity));
                            StartActivity(intent);
                        }
                        else
                        {
                            var errorToast = Toast.MakeText(ApplicationContext, "Check Your Password ", ToastLength.Short);
                            errorToast.Show();
                        }
                    }
                }
            };

            bt_Join.Click += delegate
            {
                var intent = new Intent(this, typeof(regiActivity));
                StartActivity(intent);
            };
        }
Beispiel #42
0
        public static View LoadEntryButtonLayout(Context context, View convertView, ViewGroup parent, int layoutId, out TextView label, out EditText value, out ImageButton button)
        {
            var layout = convertView ?? LoadLayout(context, parent, layoutId);

            if (layout != null)
            {
                label  = layout.FindViewById <TextView>(Resource.Id.dialog_LabelField);
                value  = layout.FindViewById <EditText>(Resource.Id.dialog_ValueField);
                button = layout.FindViewById <ImageButton>(Resource.Id.dialog_Button);
            }
            else
            {
                Log.Error("Android.Dialog", "LoadStringEntryLayout: Failed to load resource: " + layoutId.ToString(CultureInfo.InvariantCulture));
                label  = null;
                value  = null;
                button = null;
            }
            return(layout);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
                TaskScheduler.UnobservedTaskException      += TaskSchedulerOnUnobservedTaskException;

                SetContentView(Resource.Layout.ChatMessagelayout);
                var requiredPermissions = new String[]
                {
                    Manifest.Permission.Internet,
                    Manifest.Permission.WriteExternalStorage,
                    Manifest.Permission.ReadExternalStorage,
                    Manifest.Permission.Camera,
                    Manifest.Permission.ReadContacts
                };
                ActivityCompat.RequestPermissions(this, requiredPermissions, REQUEST_LOCATION);

                var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.app_bar);
                SetSupportActionBar(toolbar);
                //SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                //SupportActionBar.SetHomeButtonEnabled(true);
                //SupportActionBar.SetDisplayUseLogoEnabled(true);
                ////SupportActionBar.SetIcon(Resource.Drawable.logo512_512);
                LinearLayout    li_toolbarDetails   = FindViewById <LinearLayout>(Resource.Id.li_toolbarDetails);
                CircleImageView IV_Userlogo         = FindViewById <CircleImageView>(Resource.Id.iv_customforUserlogo);
                CircleImageView _IVarrow_back_white = FindViewById <CircleImageView>(Resource.Id.iv_arrow_back_white);
                TextView        toolbar_title       = FindViewById <TextView>(Resource.Id.toolbar_title);
                li_toolbarDetails.Click   += Li_toolbarDetails_Click;
                IV_Userlogo.Click         += IV_Userlogo_Click;
                toolbar_title.Click       += Toolbar_title_Click;
                _IVarrow_back_white.Click += _IVarrow_back_white_Click;



                // Create your application here
                ContactObject = JsonConvert.DeserializeObject <ContactViewModel>(Intent.GetStringExtra("ContactObject"));
                if (ContactObject != null)
                {
                    ContactName        = ContactRepository.GetContactbyUserId(ContactObject.ContactId).name;
                    contactId          = ContactObject.ContactId;
                    toolbar_title.Text = ContactName;
                }

                if (ContactObject.ProfileImageUrl != null && ContactObject.ProfileImageUrl != "")
                {
                    Picasso.With(this)
                    .Load(ContactObject.ProfileImageUrl)
                    .Resize(100, 100)
                    .CenterCrop().Placeholder(Resource.Drawable.default_profile)
                    .Into(IV_Userlogo);
                }
                else
                {
                    IV_Userlogo.SetBackgroundResource(Resource.Drawable.default_profile);
                }

                txtChatSendMessage              = FindViewById <EditText>(Resource.Id.txtSendMessage);
                btnAttachment                   = (Button)FindViewById(Resource.Id.btnextra_msg);
                btnSendButton                   = FindViewById <Button>(Resource.Id.btnsend_msg);
                ButtonLayout                    = FindViewById <LinearLayout>(Resource.Id.linearLayout3);
                txtChatSendMessage.TextChanged += TxtChatSendMessage_TextChanged;

                mySwipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swiperefresh);
                var refreshListEvent = new SwipeRefreshLayoutPrivateMessage(this);
                mySwipeRefreshLayout.SetOnRefreshListener(refreshListEvent);
                refreshListEvent.LoadMoreEvent += RefreshListEvent_LoadMoreEvent;

                mRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
                if (mRecyclerView != null)
                {
                    mRecyclerView.HasFixedSize = true;
                    var layoutManager = new LinearLayoutManager(this);
                    mRecyclerView.SetLayoutManager(layoutManager);
                }

                imgCamera_msg = FindViewById <ImageView>(Resource.Id.imgCamera_msg);

                chatConversation = ChatConversationRepository.GetConversationbyContactId(ContactObject.ContactId);

                btnSendButton.Click += btnSendButton_Click;
                btnAttachment.Click += BtnAttachment_Click;
                imgCamera_msg.Click += ImgCamera_msg_Click;
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            EditText letra         = FindViewById <EditText>(Resource.Id.txtLetra);
            Button   enviar        = FindViewById <Button>(Resource.Id.btnenviar);
            EditText palabra       = FindViewById <EditText>(Resource.Id.txtPalabra);
            Button   enviarpalabra = FindViewById <Button>(Resource.Id.btnenviarPalabra);

            TextView  resultado = FindViewById <TextView>(Resource.Id.lblResultado);
            ImageView imagen    = FindViewById <ImageView>(Resource.Id.imgResultado);

            void actualizar()
            {
                switch (juego.Ahorcado.getInstancia().Estado)
                {
                case 0:
                    //imagen.SetImageResource(Resource.Drawable.uno);
                    break;

                case 1:
                    imagen.SetImageResource(Resource.Drawable.uno);
                    break;

                case 2:
                    imagen.SetImageResource(Resource.Drawable.dos);
                    break;

                case 3:
                    imagen.SetImageResource(Resource.Drawable.tres);
                    break;

                case 4:
                    imagen.SetImageResource(Resource.Drawable.cuatro);
                    break;

                case 5:
                    imagen.SetImageResource(Resource.Drawable.cinco);
                    break;

                case 6:
                    imagen.SetImageResource(Resource.Drawable.seis);
                    break;

                case 7:
                    imagen.SetImageResource(Resource.Drawable.siete);
                    break;

                case 8:
                    imagen.SetImageResource(Resource.Drawable.ocho);
                    break;
                }
            }

            enviar.Click += (sender, e) =>
            {
                char   l   = letra.Text[0];
                string res = juego.Ahorcado.getInstancia().Buscar(l);
                resultado.Text = res;
                actualizar();
            };
            enviarpalabra.Click += (sender, e) =>
            {
                string p   = palabra.Text;
                string res = juego.Ahorcado.getInstancia().BuscarPalabra(p);
                resultado.Text = res;
                actualizar();
            };
        }
Beispiel #45
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.SecondView);

            view = FindViewById <TextView>(Resource.Id.dateTextView1);
            int    i = ViewModel.record.Day;
            int    b = ViewModel.record.Month;
            int    c = ViewModel.record.Year;
            string a = string.Format("{0}/{1}/{2}", i, b, c);

            view.SetText(a, TextView.BufferType.Normal);

            int indexIndent = i * 1000000 + b * 10000 + c;

            SimpleDateFormat sdf     = new SimpleDateFormat("dd/MM/yyyy");
            Date             strDate = sdf.Parse(a);

            name = FindViewById <EditText>(Resource.Id.nameEditView);
            time = FindViewById <MvxTimePicker>(Resource.Id.timePicker);

            sound     = FindViewById <Button>(Resource.Id.musicButton);
            more      = FindViewById <EditText>(Resource.Id.lastEditText);
            addButton = FindViewById <Button>(Resource.Id.addButton);
            am        = GetSystemService(AlarmService).JavaCast <AlarmManager>();

            sound.Click += (object sender, EventArgs e) =>
            {
                ViewModel.record.Name = name.Text;
                ViewModel.record.Hour = time.Value.Hours;
                ViewModel.record.Min  = time.Value.Minutes;

                ViewModel.record.More = more.Text;
                ViewModel.MyButtonCommand.Execute();
            };

            if (ViewModel.record.Name != null)
            {
                name.Text   = ViewModel.record.Name;
                time.Hour   = ViewModel.record.Hour;
                time.Minute = ViewModel.record.Min;

                sound.Text = ViewModel.record.Sound;
                more.Text  = ViewModel.record.More;
            }

            addButton.Click += (object sender, System.EventArgs e) =>
            {
                if (name.Text == "")
                {
                    Toast toast1 = Toast.MakeText(this, "Напишите название", ToastLength.Short);
                    toast1.Show();
                    return;
                }

                if (sound.Text == "Выберите мелодию")
                {
                    Toast toast1 = Toast.MakeText(this, "Выберите музыку", ToastLength.Short);
                    toast1.Show();
                    return;
                }
                ViewModel.record.Name = name.Text;
                ViewModel.record.Hour = time.Value.Hours;
                ViewModel.record.Min  = time.Value.Minutes;
                ViewModel.record.More = more.Text;

                var alarmIntent = new Intent(this, typeof(Alarm));
                alarmIntent.PutExtra("title", name.Text);
                if (time.Value.Minutes < 10)
                {
                    alarmIntent.PutExtra("time", time.Value.Hours + ":0" + time.Value.Minutes);
                }
                else
                {
                    alarmIntent.PutExtra("time", time.Value.Hours + ":" + time.Value.Minutes);
                }
                alarmIntent.PutExtra("more", more.Text);
                alarmIntent.PutExtra("soundId", ViewModel.record.SoundId.ToString());
                TimeSpan ts       = (new DateTime(c, b, i, time.Value.Hours, time.Value.Minutes, 0) - new DateTime(1970, 1, 1, 0, 0, 0));
                long     currTime = (long)ts.TotalMilliseconds - 18000000;

                var pending = PendingIntent.GetBroadcast(this, indexIndent, alarmIntent, PendingIntentFlags.UpdateCurrent);
                am.Set(AlarmType.RtcWakeup, currTime, pending);

                Toast toast = Toast.MakeText(this, "Запись сделана", ToastLength.Short);
                toast.Show();

                ViewModel.MyButtonCommand2.Execute();
            };
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);

            ActionBar.Title = "Записи";
        }
Beispiel #46
0
 public CurrencyTextWatcher(EditText _mEditText, Context _context, string _currencySign)
 {
     mEditText     = _mEditText;
     mContext      = _context;
     mCurrencySign = _currencySign;
 }
Beispiel #47
0
        protected override void OnCreate(Bundle bundle)
        {
            _design.ApplyTheme();
            base.OnCreate(bundle);

            //use FlagSecure to make sure the last (revealed) character of the password is not visible in recent apps
            if (PreferenceManager.GetDefaultSharedPreferences(this).GetBoolean(
                    GetString(Resource.String.ViewDatabaseSecure_key), true))
            {
                Window.SetFlags(WindowManagerFlags.Secure, WindowManagerFlags.Secure);
            }

            _ioc = App.Kp2a.GetDbForQuickUnlock()?.Ioc;

            if (_ioc == null)
            {
                Finish();
                return;
            }

            SetContentView(Resource.Layout.QuickUnlock);

            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.mytoolbar);

            SetSupportActionBar(toolbar);

            var collapsingToolbar = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar);

            collapsingToolbar.SetTitle(GetString(Resource.String.QuickUnlock_prefs));

            if (App.Kp2a.GetDbForQuickUnlock().KpDatabase.Name != "")
            {
                FindViewById(Resource.Id.filename_label).Visibility       = ViewStates.Visible;
                ((TextView)FindViewById(Resource.Id.filename_label)).Text = App.Kp2a.GetDbForQuickUnlock().KpDatabase.Name;
            }
            else
            {
                if (
                    PreferenceManager.GetDefaultSharedPreferences(this)
                    .GetBoolean(GetString(Resource.String.RememberRecentFiles_key),
                                Resources.GetBoolean(Resource.Boolean.RememberRecentFiles_default)))
                {
                    ((TextView)FindViewById(Resource.Id.filename_label)).Text = App.Kp2a.GetFileStorage(_ioc).GetDisplayName(_ioc);
                }
                else
                {
                    ((TextView)FindViewById(Resource.Id.filename_label)).Text = "*****";
                }
            }


            TextView txtLabel = (TextView)FindViewById(Resource.Id.QuickUnlock_label);

            _quickUnlockLength = App.Kp2a.QuickUnlockKeyLength;

            if (PreferenceManager.GetDefaultSharedPreferences(this)
                .GetBoolean(GetString(Resource.String.QuickUnlockHideLength_key), false))
            {
                txtLabel.Text = GetString(Resource.String.QuickUnlock_label_secure);
            }
            else
            {
                txtLabel.Text = GetString(Resource.String.QuickUnlock_label, new Java.Lang.Object[] { _quickUnlockLength });
            }


            EditText pwd = (EditText)FindViewById(Resource.Id.QuickUnlock_password);

            pwd.SetEms(_quickUnlockLength);
            Util.MoveBottomBarButtons(Resource.Id.QuickUnlock_buttonLock, Resource.Id.QuickUnlock_button, Resource.Id.bottom_bar, this);

            Button btnUnlock = (Button)FindViewById(Resource.Id.QuickUnlock_button);

            btnUnlock.Click += (object sender, EventArgs e) =>
            {
                OnUnlock(_quickUnlockLength, pwd);
            };



            Button btnLock = (Button)FindViewById(Resource.Id.QuickUnlock_buttonLock);

            btnLock.Text   = btnLock.Text.Replace("ß", "ss");
            btnLock.Click += (object sender, EventArgs e) =>
            {
                App.Kp2a.Lock(false);
                Finish();
            };
            pwd.EditorAction += (sender, args) =>
            {
                if ((args.ActionId == ImeAction.Done) || ((args.ActionId == ImeAction.ImeNull) && (args.Event.Action == KeyEventActions.Down)))
                {
                    OnUnlock(_quickUnlockLength, pwd);
                }
            };

            _intentReceiver = new QuickUnlockBroadcastReceiver(this);
            IntentFilter filter = new IntentFilter();

            filter.AddAction(Intents.DatabaseLocked);
            RegisterReceiver(_intentReceiver, filter);

            if ((int)Build.VERSION.SdkInt >= 23)
            {
                Kp2aLog.Log("requesting fingerprint permission");
                RequestPermissions(new[] { Manifest.Permission.UseFingerprint }, FingerprintPermissionRequestCode);
            }
            else
            {
            }
        }
Beispiel #48
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.LayHousing);

            spnbuilding = FindViewById <Spinner> (Resource.Id.spnbuilding);
            spnroof     = FindViewById <Spinner> (Resource.Id.spnroof);
            spnwall     = FindViewById <Spinner> (Resource.Id.spnwall);
            spnlight    = FindViewById <Spinner> (Resource.Id.spnlight);
            spndrink    = FindViewById <Spinner> (Resource.Id.spndrink);
            spncook     = FindViewById <Spinner> (Resource.Id.spncook);
            spntenure   = FindViewById <Spinner> (Resource.Id.spntenure);

            btnAddaddress = FindViewById <Button> (Resource.Id.btnAddAddress);

            txtfulladdress = FindViewById <EditText> (Resource.Id.txtfulladdress);

            txtfulladdress.Text = Intent.GetStringExtra("fulladdress");

            btnAddaddress.Click += new EventHandler(btnAddaddress_Clicked);

            var adapterbuilding = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Building_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adapterbuilding.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spnbuilding.Adapter = adapterbuilding;

            var adapterroof = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Roof_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adapterroof.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spnroof.Adapter = adapterroof;

            var adpwall = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Wall_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adpwall.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spnwall.Adapter = adpwall;

            var adplight = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Light_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adplight.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spnlight.Adapter = adplight;

            var adpdrink = ArrayAdapter.CreateFromResource(
                this, Resource.Array.DRINK_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adpdrink.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spndrink.Adapter = adpdrink;

            var adpcook = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Cook_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adpcook.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spncook.Adapter = adpcook;

            var adptenure = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Tenure_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adptenure.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spntenure.Adapter = adptenure;


            string[] array;
            var      items = ConHousing.GetListSingle("select * from tblHousing where address_id='" + Intent.GetStringExtra("address_id") + "'");

            if (items != null)
            {
                array = Resources.GetStringArray(Resource.Array.Building_Spinner);
                fcnspinner(spnbuilding, array, items.building);
                array = Resources.GetStringArray(Resource.Array.Roof_Spinner);
                fcnspinner(spnroof, array, items.roof);
                array = Resources.GetStringArray(Resource.Array.Wall_Spinner);
                fcnspinner(spnwall, array, items.wall);
                array = Resources.GetStringArray(Resource.Array.Light_Spinner);
                fcnspinner(spnlight, array, items.light);
                array = Resources.GetStringArray(Resource.Array.DRINK_Spinner);
                fcnspinner(spndrink, array, items.drink);
                array = Resources.GetStringArray(Resource.Array.Cook_Spinner);
                fcnspinner(spncook, array, items.cooking);
                array = Resources.GetStringArray(Resource.Array.Tenure_Spinner);
                fcnspinner(spntenure, array, items.tenure);
            }
        }
        private void SetQuestion()
        {
            try
            {
                #region Question One

                switch (DataInfoObject.QuestionOneType)
                {
                case "free_text_question":
                {
                    QuestionOneLayout.LayoutResource = Resource.Layout.ViewSub_Question_EditText;

                    if (InflatedQuestionOne == null)
                    {
                        InflatedQuestionOne = QuestionOneLayout.Inflate();
                    }

                    QuestionOneLayout.Visibility = ViewStates.Visible;

                    TxtQuestion      = InflatedQuestionOne.FindViewById <TextView>(Resource.Id.QuestionTextView);
                    TxtQuestion.Text = Methods.FunString.DecodeString(DataInfoObject.QuestionOne);

                    EdtQuestion = InflatedQuestionOne.FindViewById <EditText>(Resource.Id.QuestionEditText);
                    Methods.SetColorEditText(EdtQuestion, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                    EdtQuestion.TextChanged += (sender, args) =>
                    {
                        try
                        {
                            QuestionOneAnswer = args.Text.ToString();
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    };
                    break;
                }

                case "yes_no_question":
                {
                    QuestionOneLayout.LayoutResource = Resource.Layout.ViewSub_Question_CheckBox;

                    if (InflatedQuestionOne == null)
                    {
                        InflatedQuestionOne = QuestionOneLayout.Inflate();
                    }

                    QuestionOneLayout.Visibility = ViewStates.Visible;

                    TxtQuestion      = InflatedQuestionOne.FindViewById <TextView>(Resource.Id.QuestionTextView);
                    TxtQuestion.Text = Methods.FunString.DecodeString(DataInfoObject.QuestionOne);

                    RdoYes = InflatedQuestionOne.FindViewById <RadioButton>(Resource.Id.radioYes);
                    RdoNo  = InflatedQuestionOne.FindViewById <RadioButton>(Resource.Id.radioNo);
                    RdoYes.CheckedChange += (sender, args) =>
                    {
                        try
                        {
                            var isChecked = RdoYes.Checked;
                            if (!isChecked)
                            {
                                return;
                            }
                            RdoNo.Checked     = false;
                            QuestionOneAnswer = "yes";
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    };
                    RdoNo.CheckedChange += (sender, args) =>
                    {
                        try
                        {
                            var isChecked = RdoNo.Checked;
                            if (!isChecked)
                            {
                                return;
                            }
                            RdoNo.Checked     = false;
                            QuestionOneAnswer = "no";
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    };
                    break;
                }

                case "multiple_choice_question":
                {
                    QuestionOneLayout.LayoutResource = Resource.Layout.ViewSub_Question_List;

                    if (InflatedQuestionOne == null)
                    {
                        InflatedQuestionOne = QuestionOneLayout.Inflate();
                    }

                    QuestionOneLayout.Visibility = ViewStates.Visible;

                    TxtQuestion      = InflatedQuestionOne.FindViewById <TextView>(Resource.Id.QuestionTextView);
                    TxtQuestion.Text = Methods.FunString.DecodeString(DataInfoObject.QuestionOne);

                    EdtQuestion = InflatedQuestionOne.FindViewById <EditText>(Resource.Id.QuestionEditText);
                    Methods.SetColorEditText(EdtQuestion, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                    Methods.SetFocusable(EdtQuestion);
                    EdtQuestion.Touch += (sender, args) =>
                    {
                        if (args.Event.Action != MotionEventActions.Down)
                        {
                            return;
                        }

                        DialogType = "QuestionOne";
                        var dialogList = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);

                        var arrayAdapter = new List <string>();
                        if (DataInfoObject.QuestionOneAnswers?.Count > 0)
                        {
                            arrayAdapter = DataInfoObject.QuestionOneAnswers;
                        }

                        dialogList.Title(Methods.FunString.DecodeString(DataInfoObject.QuestionOne));
                        dialogList.Items(arrayAdapter);
                        dialogList.NegativeText(GetText(Resource.String.Lbl_Close)).OnNegative(this);
                        dialogList.AlwaysCallSingleChoiceCallback();
                        dialogList.ItemsCallback(this).Build().Show();
                    };
                    break;
                }

                default:
                    QuestionOneLayout.Visibility = ViewStates.Gone;
                    break;
                }

                #endregion

                #region Question Two

                switch (DataInfoObject.QuestionTwoType)
                {
                case "free_text_question":
                {
                    QuestionTwoLayout.LayoutResource = Resource.Layout.ViewSub_Question_EditText;

                    if (InflatedQuestionTwo == null)
                    {
                        InflatedQuestionTwo = QuestionTwoLayout.Inflate();
                    }

                    QuestionTwoLayout.Visibility = ViewStates.Visible;

                    TxtQuestion      = InflatedQuestionTwo.FindViewById <TextView>(Resource.Id.QuestionTextView);
                    TxtQuestion.Text = Methods.FunString.DecodeString(DataInfoObject.QuestionTwo);

                    EdtQuestion = InflatedQuestionTwo.FindViewById <EditText>(Resource.Id.QuestionEditText);
                    Methods.SetColorEditText(EdtQuestion, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                    EdtQuestion.TextChanged += (sender, args) =>
                    {
                        try
                        {
                            QuestionTwoAnswer = args.Text.ToString();
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    };
                    break;
                }

                case "yes_no_question":
                {
                    QuestionTwoLayout.LayoutResource = Resource.Layout.ViewSub_Question_CheckBox;

                    if (InflatedQuestionTwo == null)
                    {
                        InflatedQuestionTwo = QuestionTwoLayout.Inflate();
                    }

                    QuestionTwoLayout.Visibility = ViewStates.Visible;

                    TxtQuestion      = InflatedQuestionTwo.FindViewById <TextView>(Resource.Id.QuestionTextView);
                    TxtQuestion.Text = Methods.FunString.DecodeString(DataInfoObject.QuestionTwo);

                    RdoYes = InflatedQuestionTwo.FindViewById <RadioButton>(Resource.Id.radioYes);
                    RdoNo  = InflatedQuestionTwo.FindViewById <RadioButton>(Resource.Id.radioNo);
                    RdoYes.CheckedChange += (sender, args) =>
                    {
                        try
                        {
                            var isChecked = RdoYes.Checked;
                            if (!isChecked)
                            {
                                return;
                            }
                            RdoNo.Checked     = false;
                            QuestionTwoAnswer = "yes";
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    };
                    RdoNo.CheckedChange += (sender, args) =>
                    {
                        try
                        {
                            var isChecked = RdoNo.Checked;
                            if (!isChecked)
                            {
                                return;
                            }
                            RdoNo.Checked     = false;
                            QuestionTwoAnswer = "no";
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    };
                    break;
                }

                case "multiple_choice_question":
                {
                    QuestionTwoLayout.LayoutResource = Resource.Layout.ViewSub_Question_List;

                    if (InflatedQuestionTwo == null)
                    {
                        InflatedQuestionTwo = QuestionTwoLayout.Inflate();
                    }

                    QuestionTwoLayout.Visibility = ViewStates.Visible;

                    TxtQuestion      = InflatedQuestionTwo.FindViewById <TextView>(Resource.Id.QuestionTextView);
                    TxtQuestion.Text = Methods.FunString.DecodeString(DataInfoObject.QuestionTwo);

                    EdtQuestion = InflatedQuestionTwo.FindViewById <EditText>(Resource.Id.QuestionEditText);
                    Methods.SetColorEditText(EdtQuestion, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                    Methods.SetFocusable(EdtQuestion);
                    EdtQuestion.Touch += (sender, args) =>
                    {
                        if (args.Event.Action != MotionEventActions.Down)
                        {
                            return;
                        }

                        DialogType = "QuestionTwo";
                        var dialogList = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);

                        var arrayAdapter = new List <string>();
                        if (DataInfoObject.QuestionTwoAnswers?.Count > 0)
                        {
                            arrayAdapter = DataInfoObject.QuestionTwoAnswers;
                        }

                        dialogList.Title(Methods.FunString.DecodeString(DataInfoObject.QuestionTwo));
                        dialogList.Items(arrayAdapter);
                        dialogList.NegativeText(GetText(Resource.String.Lbl_Close)).OnNegative(this);
                        dialogList.AlwaysCallSingleChoiceCallback();
                        dialogList.ItemsCallback(this).Build().Show();
                    };
                    break;
                }

                default:
                    QuestionTwoLayout.Visibility = ViewStates.Gone;
                    break;
                }

                #endregion

                #region Question Three

                switch (DataInfoObject.QuestionThreeType)
                {
                case "free_text_question":
                {
                    QuestionThreeLayout.LayoutResource = Resource.Layout.ViewSub_Question_EditText;

                    if (InflatedQuestionThree == null)
                    {
                        InflatedQuestionThree = QuestionThreeLayout.Inflate();
                    }

                    QuestionThreeLayout.Visibility = ViewStates.Visible;

                    TxtQuestion      = InflatedQuestionThree.FindViewById <TextView>(Resource.Id.QuestionTextView);
                    TxtQuestion.Text = Methods.FunString.DecodeString(DataInfoObject.QuestionThree);

                    EdtQuestion = InflatedQuestionThree.FindViewById <EditText>(Resource.Id.QuestionEditText);
                    Methods.SetColorEditText(EdtQuestion, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                    EdtQuestion.TextChanged += (sender, args) =>
                    {
                        try
                        {
                            QuestionThreeAnswer = args.Text.ToString();
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    };
                    break;
                }

                case "yes_no_question":
                {
                    QuestionThreeLayout.LayoutResource = Resource.Layout.ViewSub_Question_CheckBox;

                    if (InflatedQuestionThree == null)
                    {
                        InflatedQuestionThree = QuestionThreeLayout.Inflate();
                    }

                    QuestionThreeLayout.Visibility = ViewStates.Visible;

                    TxtQuestion      = InflatedQuestionThree.FindViewById <TextView>(Resource.Id.QuestionTextView);
                    TxtQuestion.Text = Methods.FunString.DecodeString(DataInfoObject.QuestionThree);

                    RdoYes = InflatedQuestionThree.FindViewById <RadioButton>(Resource.Id.radioYes);
                    RdoNo  = InflatedQuestionThree.FindViewById <RadioButton>(Resource.Id.radioNo);
                    RdoYes.CheckedChange += (sender, args) =>
                    {
                        try
                        {
                            var isChecked = RdoYes.Checked;
                            if (!isChecked)
                            {
                                return;
                            }
                            RdoNo.Checked       = false;
                            QuestionThreeAnswer = "yes";
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    };
                    RdoNo.CheckedChange += (sender, args) =>
                    {
                        try
                        {
                            var isChecked = RdoNo.Checked;
                            if (!isChecked)
                            {
                                return;
                            }
                            RdoNo.Checked       = false;
                            QuestionThreeAnswer = "no";
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    };
                    break;
                }

                case "multiple_choice_question":
                {
                    QuestionThreeLayout.LayoutResource = Resource.Layout.ViewSub_Question_List;

                    if (InflatedQuestionThree == null)
                    {
                        InflatedQuestionThree = QuestionThreeLayout.Inflate();
                    }

                    QuestionThreeLayout.Visibility = ViewStates.Visible;

                    TxtQuestion      = InflatedQuestionThree.FindViewById <TextView>(Resource.Id.QuestionTextView);
                    TxtQuestion.Text = Methods.FunString.DecodeString(DataInfoObject.QuestionThree);

                    EdtQuestion = InflatedQuestionThree.FindViewById <EditText>(Resource.Id.QuestionEditText);
                    Methods.SetColorEditText(EdtQuestion, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                    Methods.SetFocusable(EdtQuestion);
                    EdtQuestion.Touch += (sender, args) =>
                    {
                        if (args.Event.Action != MotionEventActions.Down)
                        {
                            return;
                        }

                        DialogType = "QuestionThree";
                        var dialogList = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);

                        var arrayAdapter = new List <string>();
                        if (DataInfoObject.QuestionThreeAnswers?.Count > 0)
                        {
                            arrayAdapter = DataInfoObject.QuestionThreeAnswers;
                        }

                        dialogList.Title(Methods.FunString.DecodeString(DataInfoObject.QuestionThree));
                        dialogList.Items(arrayAdapter);
                        dialogList.NegativeText(GetText(Resource.String.Lbl_Close)).OnNegative(this);
                        dialogList.AlwaysCallSingleChoiceCallback();
                        dialogList.ItemsCallback(this).Build().Show();
                    };
                    break;
                }

                default:
                    QuestionThreeLayout.Visibility = ViewStates.Gone;
                    break;
                }

                #endregion
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.SignUp);

            btnConfirm = FindViewById<Button>(Resource.Id.btnConfirm);
            etFirstName = FindViewById<EditText>(Resource.Id.etFirstName);
            etLastName = FindViewById<EditText>(Resource.Id.etLastName);
            etPhone = FindViewById<EditText>(Resource.Id.etPhone);
            etAddress = FindViewById<EditText>(Resource.Id.etAddress);
            etCountry = FindViewById<EditText>(Resource.Id.etCountry);
            etUsername = FindViewById<EditText>(Resource.Id.etUsername);
            etPassword = FindViewById<EditText>(Resource.Id.etPassword);




            btnConfirm.Click += (Sender, e) =>
            {
                Intent LoginIntent = new Intent(this, typeof(Login));
                StartActivity(LoginIntent);

                //var request = HttpWebRequest.Create(string.Format(@"https://10.0.2.2:5001/api/Customers"));
                //request.ContentType = "application/json";
                //request.Method = "POST";

                //User newUser = new User();
                //newUser.UserName = etUsername.Text;
                //newUser.Password = etPassword.Text;
                //newUser.First_Name = etFirstName.Text;
                //newUser.Last_Name = etLastName.Text;
                //newUser.Phone_Number = etPhone.Text;
                //newUser.Address = etAddress.Text;
                //newUser.Country = etCountry.Text;


                //var userJason = JsonConvert.SerializeObject(newUser);


                //using (var streamWriter = new StreamWriter(request.GetRequestStream()))
                //{

                //    streamWriter.Write(userJason);
                //}
                //using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                //{

                //    if (response.StatusCode != HttpStatusCode.Created)
                //    {
                //        Console.Out.WriteLine("Error fetching data. Server returned status code: {0}", response.StatusCode);
                //        Toast.MakeText(this, "Failed to create user. Please retry!", ToastLength.Long);
                //    }
                //    else
                //    {
                //        Toast.MakeText(this, "User created successfully", ToastLength.Long);


                //        Intent LoginIntent = new Intent(this, typeof(Login));
                //        StartActivity(LoginIntent);
                //    }
                //}
            };
        }
        private void BtnClickSaveGiftData_Click(object sender, EventArgs e)
        {
            //Pass style identifier.
            EditText edtPassStyleIdentifierGift = FindViewById <EditText>(Resource.Id.passStyleIdentifierGift);
            string   styleId = edtPassStyleIdentifierGift.Text.Trim().ToString();

            if (TextUtils.IsEmpty(styleId))
            {
                Toast.MakeText(this, "Template Id cant be empty.", ToastLength.Long).Show();
                return;
            }

            //Construct gift card data.
            PassObject.Builder passBuilder = PassObject.GetBuilder();

            //Common fields.
            List <CommonField> commonFields = new List <CommonField>();
            //Append fields.
            List <AppendField> appendFields = new List <AppendField>();

            //Background and description
            EditText edtBackgroundColor     = FindViewById <EditText>(Resource.Id.giftBackGroundImage);
            EditText edtBackgroundColorDesc = FindViewById <EditText>(Resource.Id.giftBackGroundImageDesc);

            //1 Background image of the card.
            CommonField backgroundImageCommonField = CommonField.GetBuilder()
                                                     .SetKey(WalletPassConstant.PassCommonFieldKeyBackgroundImg)
                                                     .SetLabel(edtBackgroundColorDesc.Text.Trim().ToString())
                                                     .SetValue(edtBackgroundColor.Text.Trim().ToString())
                                                     .Build();

            commonFields.Add(backgroundImageCommonField);

            //2 Logo on the card
            //Logo
            EditText    edtGiftCardLogo = FindViewById <EditText>(Resource.Id.giftCardLogo);
            CommonField logoCommonField = CommonField.GetBuilder()
                                          .SetKey(WalletPassConstant.PassCommonFieldKeyLogo)
                                          .SetLabel("This is logo label")
                                          .SetValue(edtGiftCardLogo.Text.Trim().ToString())
                                          .Build();

            commonFields.Add(logoCommonField);

            //3 Merchant name
            EditText edtMerchantName = FindViewById <EditText>(Resource.Id.giftMerchantName);

            CommonField merchantNameCommonField = CommonField.GetBuilder()
                                                  .SetKey(WalletPassConstant.PassCommonFieldKeyMerchantName)
                                                  .SetLabel("This is Merchant Name label")
                                                  .SetValue(edtMerchantName.Text.Trim().ToString())
                                                  .Build();

            commonFields.Add(merchantNameCommonField);

            //4 Card name
            EditText    edtGiftCardname     = FindViewById <EditText>(Resource.Id.giftCardname);
            CommonField cardNameCommonField = CommonField.GetBuilder()
                                              .SetKey(WalletPassConstant.PassCommonFieldKeyName)
                                              .SetLabel("This is Card name label")
                                              .SetValue(edtGiftCardname.Text.Trim().ToString())
                                              .Build();

            commonFields.Add(cardNameCommonField);

            //5 Card number
            EditText edtGiftCardNumber = FindViewById <EditText>(Resource.Id.giftCardNumber);
            string   giftCardNumber    = edtGiftCardNumber.Text.Trim().ToString();

            if (TextUtils.IsEmpty(giftCardNumber))
            {
                Toast.MakeText(this, "Card number can't be empty.", ToastLength.Long).Show();
                return;
            }
            CommonField cardNumberCommonField = CommonField.GetBuilder()
                                                .SetKey(WalletPassConstant.PassCommonFieldKeyCardNumber)
                                                .SetLabel("This is CardNumber label")
                                                .SetValue(giftCardNumber)
                                                .Build();

            commonFields.Add(cardNumberCommonField);

            //6 Balance
            EditText    edtGiftBalance     = FindViewById <EditText>(Resource.Id.giftBalance);
            CommonField balanceCommonField = CommonField.GetBuilder()
                                             .SetKey(WalletPassConstant.PassCommonFieldKeyBalance)
                                             .SetLabel("This is balance label")
                                             .SetValue(edtGiftBalance.Text.Trim().ToString())
                                             .Build();

            commonFields.Add(balanceCommonField);

            //Gift currrency
            EditText edtGiftCurrency = FindViewById <EditText>(Resource.Id.giftCurrency);

            passBuilder.SetCurrencyCode(edtGiftCurrency.Text.Trim().ToString());

            //7 Barcode or Qrcode
            EditText edtPassBarcodeAlternate = FindViewById <EditText>(Resource.Id.passBarcodeAlternateText);
            string   barType             = BarCode.BarcodeTypeQrCode;
            EditText edtPassBarcodeValue = FindViewById <EditText>(Resource.Id.passBarcodeValue);

            switch (barcodeStyleList[barcodeStyleIndex])
            {
            case "Codabar":
                barType = BarCode.BarcodeTypeCodabar;
                break;

            case "QrCode":
                barType = BarCode.BarcodeTypeQrCode;
                break;

            default:
                break;
            }

            BarCode barCode = BarCode.GetBuilder()
                              .SetType(barType)
                              .SetValue(edtPassBarcodeValue.Text.Trim().ToString())
                              .SetText(edtPassBarcodeAlternate.Text.Trim().ToString())
                              .Build();

            passBuilder.SetBarCode(barCode);

            //9 Balance update time
            // balance update time
            long update = 0;

            if (TextUtils.IsEmpty(updateTime))
            {
                Toast.MakeText(this, "Please select balance updateTime", ToastLength.Long).Show();
                return;
            }
            else
            {
                update = BasisTimesUtils.GetLongtimeOfYMD(updateTime);
            }

            //Simple date format
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
            // Create SimpleDateFormat
            string      updateTimeValue = format.Format(new Java.Util.Date(update));
            CommonField balanceUpdateTimeAppendfield = CommonField.GetBuilder()
                                                       .SetKey(WalletPassConstant.PassCommonFieldKeyBalanceRefreshTime)
                                                       .SetLabel("Updated")
                                                       .SetValue(updateTimeValue)
                                                       .Build();

            commonFields.Add(balanceUpdateTimeAppendfield);

            //10 Pin
            EditText    edtGiftCardPin = FindViewById <EditText>(Resource.Id.giftCardPin);
            CommonField pinCommonField = CommonField.GetBuilder()
                                         .SetKey(WalletPassConstant.PassCommonFieldKeyBlancePin)
                                         .SetLabel("PIN Number")
                                         .SetValue(edtGiftCardPin.Text.ToString())
                                         .Build();

            commonFields.Add(pinCommonField);

            //11 Event number
            EditText    edtGiftEventNumber     = FindViewById <EditText>(Resource.Id.giftEventNumber);
            AppendField eventNumberAppendField = AppendField.GetBuilder()
                                                 .SetKey(WalletPassConstant.PassAppendFieldKeyEventNumber)
                                                 .SetLabel("Event Number")
                                                 .SetValue(edtGiftEventNumber.Text.Trim().ToString())
                                                 .Build();

            appendFields.Add(eventNumberAppendField);

            //12 Message
            //message
            EditText edtMessageHeaderGift    = FindViewById <EditText>(Resource.Id.messageHeaderGift);
            EditText edtMessageBodyGift      = FindViewById <EditText>(Resource.Id.messageBodyGift);
            EditText edtMessageHeaderGiftOne = FindViewById <EditText>(Resource.Id.messageHeaderGift1);
            EditText edtMessageBodyGiftOne   = FindViewById <EditText>(Resource.Id.messageBodyGift1);

            List <AppendField> messageList = new List <AppendField>();

            messageList.Add(AppendField.GetBuilder()
                            .SetKey("1")
                            .SetLabel(edtMessageHeaderGift.Text.Trim().ToString())
                            .SetValue(edtMessageBodyGift.Text.Trim().ToString())
                            .Build());
            messageList.Add(AppendField.GetBuilder()
                            .SetKey("2")
                            .SetLabel(edtMessageHeaderGiftOne.Text.Trim().ToString())
                            .SetValue(edtMessageBodyGiftOne.Text.Trim().ToString())
                            .Build());
            passBuilder.AddMessageList(messageList);

            //13 Scrolling images
            List <AppendField> imageList                 = new List <AppendField>();
            EditText           edtScrollingImagesOne     = FindViewById <EditText>(Resource.Id.giftScrollingImages1);
            EditText           edtScrollingImagesDescOne = FindViewById <EditText>(Resource.Id.giftScrollingDesc1);
            EditText           edtScrollingImagesTwo     = FindViewById <EditText>(Resource.Id.giftScrollingImages2);
            EditText           edtScrollingImagesDescTwo = FindViewById <EditText>(Resource.Id.giftScrollingDesc2);

            imageList.Add(AppendField.GetBuilder()
                          .SetKey("1")
                          .SetLabel(edtScrollingImagesDescOne.Text.Trim().ToString())
                          .SetValue(edtScrollingImagesDescTwo.Text.Trim().ToString())
                          .Build());
            imageList.Add(AppendField.GetBuilder()
                          .SetKey("2")
                          .SetLabel(edtScrollingImagesDescTwo.Text.Trim().ToString())
                          .SetValue(edtScrollingImagesTwo.Text.Trim().ToString())
                          .Build());
            passBuilder.AddImageList(imageList);

            //UrlList
            EditText edtGiftUrlLabel    = FindViewById <EditText>(Resource.Id.giftUrlLable);
            EditText edtGiftUrlValue    = FindViewById <EditText>(Resource.Id.giftUrlValue);
            EditText edtGiftUrlLabelOne = FindViewById <EditText>(Resource.Id.giftUrlLable1);
            EditText edtGiftUrlValueOne = FindViewById <EditText>(Resource.Id.giftUrlValue1);

            List <AppendField> urlList = new List <AppendField>();

            urlList.Add(AppendField.GetBuilder()
                        .SetKey("1")
                        .SetLabel(edtGiftUrlLabel.Text.Trim().ToString())
                        .SetValue(edtGiftUrlValue.Text.Trim().ToString())
                        .Build());
            urlList.Add(AppendField.GetBuilder()
                        .SetKey("2")
                        .SetLabel(edtGiftUrlLabelOne.Text.Trim().ToString())
                        .SetValue(edtGiftUrlValueOne.Text.Trim().ToString())
                        .Build());
            passBuilder.AddUrlList(urlList);

            //14 Nearby stores
            EditText    edtGiftNearbyStoresUrl  = FindViewById <EditText>(Resource.Id.giftNearbyStoresUrl);
            EditText    edtGiftNearbyStoresName = FindViewById <EditText>(Resource.Id.giftNearbyStoresName);
            AppendField nearbyAppendField       = AppendField.GetBuilder()
                                                  .SetKey(WalletPassConstant.PassAppendFieldKeyNearbyLocations)
                                                  .SetLabel(edtGiftNearbyStoresName.Text.Trim().ToString())
                                                  .SetValue(edtGiftNearbyStoresUrl.Text.Trim().ToString())
                                                  .Build();

            appendFields.Add(nearbyAppendField);

            //15 Main page
            EditText edtGiftMainPageUrl  = FindViewById <EditText>(Resource.Id.giftMainPageUrl);
            EditText edtGiftMainPageName = FindViewById <EditText>(Resource.Id.giftMainPageName);

            AppendField mainPageAppendField = AppendField.GetBuilder()
                                              .SetKey(WalletPassConstant.PassAppendFieldKeyMainpage)
                                              .SetLabel(edtGiftMainPageName.Text.Trim().ToString())
                                              .SetValue(edtGiftMainPageUrl.Text.Trim().ToString())
                                              .Build();

            appendFields.Add(mainPageAppendField);
            //16 Hotline
            EditText    edtGiftHotlinePone = FindViewById <EditText>(Resource.Id.giftHotlinePone);
            EditText    edtGiftHotlineName = FindViewById <EditText>(Resource.Id.giftHotlineName);
            AppendField hotlineAppendField = AppendField.GetBuilder()
                                             .SetKey(WalletPassConstant.PassAppendFieldKeyHotline)
                                             .SetLabel(edtGiftHotlineName.Text.Trim().ToString())
                                             .SetValue(edtGiftHotlinePone.Text.Trim().ToString())
                                             .Build();
            //Public constant
            //Time check
            long start = 0;
            long end   = 0;
            Date date  = new Date();

            if (TextUtils.IsEmpty(startTime))
            {
                Toast.MakeText(this, "Please select Starttime", ToastLength.Long).Show();
                return;
            }
            else
            {
                start = BasisTimesUtils.GetLongtimeOfYMD(startTime);
            }

            if (TextUtils.IsEmpty(endTime))
            {
                Toast.MakeText(this, "Please select EndTime", ToastLength.Long).Show();
                return;
            }
            else
            {
                end = BasisTimesUtils.GetLongtimeOfYMD(endTime);
            }

            if (end <= start || end <= date.Time)
            {
                Toast.MakeText(this, "Please check (EndTime > StartTime)&& (EndTime > Current Time)", ToastLength.Long).Show();
                return;
            }
            //serial Number
            EditText organizationPassIdGift = FindViewById <EditText>(Resource.Id.organizationPassIdGift);
            string   organizationPassId     = organizationPassIdGift.Text.Trim().ToString();

            if (TextUtils.IsEmpty(organizationPassId))
            {
                Toast.MakeText(this, "SerialNumber can't be empty.", ToastLength.Long).Show();
                return;
            }

            EditText passTypeId = FindViewById <EditText>(Resource.Id.passTypeIdentifier);
            string   typeId     = passTypeId.Text.Trim().ToString();

            if (TextUtils.IsEmpty(typeId))
            {
                Toast.MakeText(this, "Pass Type can't be empty", ToastLength.Long).Show();
                return;
            }

            EditText edtIssuerIdGift = FindViewById <EditText>(Resource.Id.issuerIdGift);
            string   issuerId        = edtIssuerIdGift.Text.Trim().ToString();

            if (TextUtils.IsEmpty(issuerId))
            {
                Toast.MakeText(this, "Issuer id can't be empty.", ToastLength.Long).Show();
                return;
            }

            //State
            string state = WalletPassConstant.PassStateActive;

            switch (dataList[index])
            {
            case "ACTIVE":
                state = WalletPassConstant.PassStateActive;
                break;

            case "COMPLETED":
                state = WalletPassConstant.PassStateCompleted;
                break;

            case "EXPIRED":
                state = WalletPassConstant.PassStateExpired;
                break;

            case "INACTIVE":
                state = WalletPassConstant.PassStateInactive;
                break;

            default:
                break;
            }

            appendFields.Add(hotlineAppendField);
            //PassStyleIdentifier
            EditText edtPassStyleIdentifier = FindViewById <EditText>(Resource.Id.passStyleIdentifierGift);

            passBuilder.SetOrganizationPassId(edtGiftCardNumber.Text.Trim().ToString());
            passBuilder.SetPassStyleIdentifier(edtPassStyleIdentifier.Text.Trim().ToString());
            passBuilder.SetPassTypeIdentifier(typeId);
            passBuilder.SetSerialNumber(organizationPassId);
            passBuilder.SetStatus(PassStatus.GetBuilder().SetState(state).SetEffectTime(format.Format(new Date(start))).SetExpireTime(format.Format(new Date(end))).Build());
            passBuilder.AddAppendFields(appendFields);
            passBuilder.AddCommonFields(commonFields);
            PassObject passObject = passBuilder.Build();

            Log.Info("GiftCardActivity", "passObject: " + passObject.ToJson());
            Intent intent = new Intent(this, typeof(PassTestActivity));

            intent.PutExtra("passObject", passObject.ToJson());
            intent.PutExtra("passId", organizationPassId);
            intent.PutExtra("issuerId", issuerId);
            intent.PutExtra("typeId", typeId);
            StartActivity(intent);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.User_Profile);

            toolb = FindViewById <Toolbar>(Resource.Id.my_toolbar);

            SetSupportActionBar(toolb);
            spinnerView = FindViewById <Spinner>(Resource.Id.spinner1);

            spinnerView.Adapter = new ArrayAdapter
                                      (this, Android.Resource.Layout.SimpleListItem1, myCategory);

            valueFromLoginUser = Intent.GetStringExtra("userName");
            myUser             = FindViewById <TextView>(Resource.Id.welcomeuser);
            myUser.Text        = "Welcome," + valueFromLoginUser;
            // this.Title = "welcome admin";
            spinnerView.ItemSelected += MyItemSelectedMethod;

            alert = new Android.App.AlertDialog.Builder(this);

            //edit buttons
            myDB = new DBHelperClass(this);
            //alert = new Android.App.AlertDialog.Builder(this);
            mypid          = FindViewById <TextView>(Resource.Id.user_id);
            _username      = FindViewById <EditText>(Resource.Id.userNamee);
            _email         = FindViewById <EditText>(Resource.Id.userEmail);
            _contact       = FindViewById <EditText>(Resource.Id.userContact);
            _passwd        = FindViewById <EditText>(Resource.Id.userpswd);
            _confirmpasswd = FindViewById <EditText>(Resource.Id.userConfirmPswd);
            SubmitBtn      = FindViewById <Button>(Resource.Id.usersubmit);

            //disable email
            _email.Enabled = false;
            mypid.Enabled  = false;
            p_cursor       = myDB.SelectProfile(valueFromLoginUser);
            p_cursor.MoveToFirst();
            mypid.Text     = p_cursor.GetString(p_cursor.GetColumnIndexOrThrow("id"));
            _username.Text = p_cursor.GetString(p_cursor.GetColumnIndexOrThrow("names"));
            _email.Text    = valueFromLoginUser;
            _contact.Text  = p_cursor.GetString(p_cursor.GetColumnIndexOrThrow("contact"));
            _passwd.Text   = p_cursor.GetString(p_cursor.GetColumnIndexOrThrow("password"));

            _confirmpasswd.TextChanged += check_password;

            SubmitBtn.Click += delegate
            {
                string value  = _username.Text;
                string value1 = _contact.Text;
                string value2 = _passwd.Text;
                string value3 = _confirmpasswd.Text;



                System.Console.WriteLine("Text Value ---- > " + value);
                //check for empty value
                if (value.Trim().Equals("") || value.Length < 0 || value1.Trim().Equals("") || value1.Length < 0 ||
                    value2.Trim().Equals("") || value2.Length < 0 || value3.Trim().Equals("") || value3.Length < 0)
                {
                    alert.SetTitle("Error");
                    alert.SetMessage("Please Enter Valid Data");
                    alert.SetPositiveButton("OK", alertOKButton);
                    alert.SetNegativeButton("Cancel", alertOKButton);
                    Dialog myDialog = alert.Create();
                    myDialog.Show();
                }
                else
                {
                    myDB.SelectMyProfileToUpdate(mypid.Text, _username.Text, _contact.Text, _passwd.Text);
                }
            };
        }
Beispiel #53
0
 public GenericTextWatcher(EditText et, Activity ac)
 {
     et_ = et;
     ac_ = ac;
 }
        private void InitComponent()
        {
            try
            {
                TxtSave = FindViewById <TextView>(Resource.Id.toolbar_title);

                IconName     = FindViewById <TextView>(Resource.Id.IconName);
                TxtName      = FindViewById <EditText>(Resource.Id.NameEditText);
                IconLocation = FindViewById <TextView>(Resource.Id.IconLocation);
                TxtLocation  = FindViewById <EditText>(Resource.Id.LocationEditText);
                IconPhone    = FindViewById <TextView>(Resource.Id.IconPhone);
                TxtPhone     = FindViewById <EditText>(Resource.Id.PhoneEditText);
                IconEmail    = FindViewById <TextView>(Resource.Id.IconEmail);
                TxtEmail     = FindViewById <EditText>(Resource.Id.EmailEditText);

                IconPosition = FindViewById <TextView>(Resource.Id.IconPosition);
                TxtPosition  = FindViewById <EditText>(Resource.Id.PositionEditText);

                IconWork = FindViewById <TextView>(Resource.Id.IconWorkStatus);
                TxtWork  = FindViewById <EditText>(Resource.Id.WorkStatusEditText);

                IconDescription = FindViewById <TextView>(Resource.Id.IconDescription);
                TxtDescription  = FindViewById <EditText>(Resource.Id.DescriptionEditText);

                IconDate    = FindViewById <TextView>(Resource.Id.IconDate);
                TxtFromDate = FindViewById <EditText>(Resource.Id.FromDateEditText);
                TxtToDate   = FindViewById <EditText>(Resource.Id.ToDateEditText);

                ChkCurrentlyWork = FindViewById <CheckBox>(Resource.Id.iCurrentlyWorkCheckBox);

                QuestionOneLayout   = FindViewById <ViewStub>(Resource.Id.viewStubQuestionOne);
                QuestionTwoLayout   = FindViewById <ViewStub>(Resource.Id.viewStubQuestionTwo);
                QuestionThreeLayout = FindViewById <ViewStub>(Resource.Id.viewStubQuestionThree);

                //free_text_question,yes_no_question,multiple_choice_question
                SetQuestion();

                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, IconName, FontAwesomeIcon.User);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, IconLocation, FontAwesomeIcon.MapMarkedAlt);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, IconPhone, FontAwesomeIcon.Phone);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, IconWork, FontAwesomeIcon.Briefcase);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, IconEmail, FontAwesomeIcon.PaperPlane);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, IconPosition, FontAwesomeIcon.MapPin);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, IconDescription, FontAwesomeIcon.Paragraph);
                FontUtils.SetTextViewIcon(FontsIconFrameWork.FontAwesomeLight, IconDate, FontAwesomeIcon.Calendar);

                Methods.SetColorEditText(TxtName, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                Methods.SetColorEditText(TxtLocation, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                Methods.SetColorEditText(TxtPhone, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                Methods.SetColorEditText(TxtEmail, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                Methods.SetColorEditText(TxtPosition, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                Methods.SetColorEditText(TxtWork, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                Methods.SetColorEditText(TxtDescription, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                Methods.SetColorEditText(TxtFromDate, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
                Methods.SetColorEditText(TxtToDate, AppSettings.SetTabDarkTheme ? Color.White : Color.Black);

                Methods.SetFocusable(TxtFromDate);
                Methods.SetFocusable(TxtToDate);
                Methods.SetFocusable(TxtPosition);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Beispiel #55
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            if (savedInstanceState != null)
            {
                _instanceData = ActivityCommon.GetInstanceState(savedInstanceState, _instanceData) as InstanceData;
            }

            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowCustomEnabled(true);
            SetContentView(Resource.Layout.can_adapter_config);

            _imm         = (InputMethodManager)GetSystemService(InputMethodService);
            _contentView = FindViewById <View>(Android.Resource.Id.Content);

            _barView = LayoutInflater.Inflate(Resource.Layout.bar_can_adapter, null);
            ActionBar.LayoutParams barLayoutParams = new ActionBar.LayoutParams(
                ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.WrapContent);
            barLayoutParams.Gravity = barLayoutParams.Gravity &
                                      (int)(~(GravityFlags.HorizontalGravityMask | GravityFlags.VerticalGravityMask)) |
                                      (int)(GravityFlags.Left | GravityFlags.CenterVertical);
            SupportActionBar.SetCustomView(_barView, barLayoutParams);

            SetResult(Android.App.Result.Canceled);

            _deviceAddress = Intent.GetStringExtra(ExtraDeviceAddress);
            ActivityCommon.InterfaceType interfaceType = (ActivityCommon.InterfaceType)Intent.GetIntExtra(ExtraInterfaceType,
                                                                                                          (int)ActivityCommon.InterfaceType.Bluetooth);
            ViewStates visibility   = IsCustomAdapter(interfaceType) ? ViewStates.Visible : ViewStates.Gone;
            ViewStates visibilityBt = IsCustomBtAdapter(interfaceType) ? ViewStates.Visible : ViewStates.Gone;

            _buttonRead = _barView.FindViewById <Button>(Resource.Id.buttonAdapterRead);
            _buttonRead.SetOnTouchListener(this);
            _buttonRead.Click += (sender, args) =>
            {
                PerformRead();
            };
            _buttonRead.Visibility = visibility;

            _buttonWrite = _barView.FindViewById <Button>(Resource.Id.buttonAdapterWrite);
            _buttonWrite.SetOnTouchListener(this);
            _buttonWrite.Click += (sender, args) =>
            {
                PerformWrite();
            };

            _layoutCanAdapter = FindViewById <LinearLayout>(Resource.Id.layoutCanAdapter);
            _layoutCanAdapter.SetOnTouchListener(this);

            _spinnerCanAdapterMode = FindViewById <Spinner>(Resource.Id.spinnerCanAdapterMode);
            _spinnerCanAdapterMode.SetOnTouchListener(this);
            _spinnerCanAdapterModeAdapter  = new StringObjAdapter(this);
            _spinnerCanAdapterMode.Adapter = _spinnerCanAdapterModeAdapter;
            _spinnerCanAdapterModeAdapter.Items.Add(new StringObjType(GetString(Resource.String.button_can_adapter_can_500), AdapterMode.Can500));
            _spinnerCanAdapterModeAdapter.Items.Add(new StringObjType(GetString(Resource.String.button_can_adapter_can_100), AdapterMode.Can100));
            _spinnerCanAdapterModeAdapter.Items.Add(new StringObjType(GetString(Resource.String.button_can_adapter_can_off), AdapterMode.CanOff));
            _spinnerCanAdapterModeAdapter.NotifyDataSetChanged();

            _textViewCanAdapterSepTimeTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterSepTimeTitle);
            _textViewCanAdapterSepTimeTitle.Visibility = visibility;

            _spinnerCanAdapterSepTime = FindViewById <Spinner>(Resource.Id.spinnerCanAdapterSepTime);
            _spinnerCanAdapterSepTime.SetOnTouchListener(this);
            _spinnerCanAdapterSepTimeAdapter  = new StringAdapter(this);
            _spinnerCanAdapterSepTime.Adapter = _spinnerCanAdapterSepTimeAdapter;
            _spinnerCanAdapterSepTimeAdapter.Items.Add(GetString(Resource.String.can_adapter_text_off));
            for (int i = 1; i <= 2; i++)
            {
                _spinnerCanAdapterSepTimeAdapter.Items.Add(i.ToString());
            }
            _spinnerCanAdapterSepTimeAdapter.NotifyDataSetChanged();
            _spinnerCanAdapterSepTime.Visibility = visibility;

            _textViewCanAdapterBlockSizeTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterBlockSizeTitle);
            _textViewCanAdapterBlockSizeTitle.Visibility = visibility;

            _spinnerCanAdapterBlockSize = FindViewById <Spinner>(Resource.Id.spinnerCanAdapterBlockSize);
            _spinnerCanAdapterBlockSize.SetOnTouchListener(this);
            _spinnerCanAdapterBlockSizeAdapter  = new StringAdapter(this);
            _spinnerCanAdapterBlockSize.Adapter = _spinnerCanAdapterBlockSizeAdapter;
            _spinnerCanAdapterBlockSizeAdapter.Items.Add(GetString(Resource.String.can_adapter_text_off));
            for (int i = 0; i <= 15; i++)
            {
                _spinnerCanAdapterBlockSizeAdapter.Items.Add(i.ToString());
            }
            _spinnerCanAdapterBlockSizeAdapter.NotifyDataSetChanged();
            _spinnerCanAdapterBlockSize.Visibility = visibility;

            _textViewBtPinTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterBtPinTitle);
            _textViewBtPinTitle.Visibility = visibilityBt;

            _editTextBtPin            = FindViewById <EditText>(Resource.Id.editTextBtPin);
            _editTextBtPin.Visibility = visibilityBt;

            _textViewBtNameTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterBtNameTitle);
            _textViewBtNameTitle.Visibility = visibilityBt;

            _editTextBtName            = FindViewById <EditText>(Resource.Id.editTextBtName);
            _editTextBtName.Visibility = visibilityBt;

            _textViewCanAdapterIgnitionStateTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterIgnitionStateTitle);
            _textViewCanAdapterIgnitionStateTitle.Visibility = visibility;

            _textViewIgnitionState            = FindViewById <TextView>(Resource.Id.textViewCanAdapterIgnitionState);
            _textViewIgnitionState.Visibility = visibility;

            _textViewBatteryVoltageTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterBatVoltageTitle);
            _textViewBatteryVoltageTitle.Visibility = visibility;

            _textViewBatteryVoltage            = FindViewById <TextView>(Resource.Id.textViewCanAdapterBatVoltage);
            _textViewBatteryVoltage.Visibility = visibility;

            _textViewFwVersionTitle            = FindViewById <TextView>(Resource.Id.textViewCanAdapterFwVersionTitle);
            _textViewFwVersionTitle.Visibility = visibility;

            _textViewFwVersion            = FindViewById <TextView>(Resource.Id.textViewCanAdapterFwVersion);
            _textViewFwVersion.Visibility = visibility;

            _textViewSerNumTitle = FindViewById <TextView>(Resource.Id.textViewCanAdapterSerNumTitle);
            _textViewSerNum      = FindViewById <TextView>(Resource.Id.textViewCanAdapterSerNum);
#if DEBUG
            _textViewSerNumTitle.Visibility = visibility;
            _textViewSerNum.Visibility      = visibility;
#else
            _textViewSerNumTitle.Visibility = ViewStates.Gone;
            _textViewSerNum.Visibility      = ViewStates.Gone;
#endif
            _buttonFwUpdate            = FindViewById <Button>(Resource.Id.buttonCanAdapterFwUpdate);
            _buttonFwUpdate.Visibility = visibility;
            _buttonFwUpdate.Click     += (sender, args) =>
            {
                PerformUpdateMessage();
            };
            _checkBoxExpert            = FindViewById <CheckBox>(Resource.Id.checkBoxCanAdapterExpert);
            _checkBoxExpert.Visibility = visibility;
            _checkBoxExpert.Click     += (sender, args) =>
            {
                UpdateDisplay();
            };

            _activityCommon = new ActivityCommon(this, () =>
            {
            }, BroadcastReceived)
            {
                SelectedInterface = interfaceType
            };

            UpdateDisplay();
            PerformRead();
        }
Beispiel #56
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            // Get our UI controls from the loaded layout:
            EditText phoneNumberText   = FindViewById <EditText>(Resource.Id.PhoneNumberText);
            Button   translateButton   = FindViewById <Button>(Resource.Id.TranslateButton);
            Button   callButton        = FindViewById <Button>(Resource.Id.CallButton);
            Button   callHistoryButton = FindViewById <Button>(Resource.Id.CallHistoryButton);

            // Disable the "Call" button
            callButton.Enabled = false;

            // Add code to translate number
            string translatedNumber = string.Empty;

            translateButton.Click += (object sender, EventArgs e) =>
            {
                // Translate user's alphanumeric phone number to numeric
                translatedNumber = Core.PhonewordTranslator.ToNumber(phoneNumberText.Text);
                if (String.IsNullOrWhiteSpace(translatedNumber))
                {
                    callButton.Text    = "Call";
                    callButton.Enabled = false;
                }
                else
                {
                    callButton.Text    = "Call " + translatedNumber;
                    callButton.Enabled = true;
                }
            };

            callButton.Click += (object sender, EventArgs e) =>
            {
                // On "Call" button click, try to dial phone number.
                var callDialog = new AlertDialog.Builder(this);
                callDialog.SetMessage("Call " + translatedNumber + "?");
                callDialog.SetNeutralButton("Call", delegate {
                    // add dialed number to list of called numbers.
                    phoneNumbers.Add(translatedNumber);
                    // enable the Call History button
                    callHistoryButton.Enabled = true;
                    // Create intent to dial phone
                    var callIntent = new Intent(Intent.ActionCall);
                    callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber));
                    StartActivity(callIntent);
                });
                callDialog.SetNegativeButton("Cancel", delegate { });

                // Show the alert dialog to the user and wait for response.
                callDialog.Show();
            };

            callHistoryButton.Click += (sender, e) =>
            {
                var intent = new Intent(this, typeof(CallHistoryActivity));
                intent.PutStringArrayListExtra("phone_numbers", phoneNumbers);
                StartActivity(intent);
            };
        }
Beispiel #57
0
        public void button_init()
        {
            msgText   = FindViewById <TextView>(Resource.Id.msgText);
            debugText = FindViewById <TextView>(Resource.Id.debugText);

            DNSeditText = FindViewById <EditText>(Resource.Id.DNSeditText);
            IPeditText  = FindViewById <EditText>(Resource.Id.IPeditText);

            Button alarmviewButton = FindViewById <Button>(Resource.Id.alarmviewButton);

            alarmviewButton.Click += delegate
            {
                Publish("get", "gpio/alarm/time_get");
                StartActivity(typeof(alarm));
            };
            Button settingsviewButton = FindViewById <Button>(Resource.Id.settingsviewButton);

            settingsviewButton.Click += delegate { };//StartActivity(typeof(alarm)); };

            Button button1_0 = FindViewById <Button>(Resource.Id.button1_0);

            button1_0.Click += delegate { button1_0_click(); };
            Button button1_1 = FindViewById <Button>(Resource.Id.button1_1);

            button1_1.Click += delegate { button1_1_click(); };
            Button button2_0 = FindViewById <Button>(Resource.Id.button2_0);

            button2_0.Click += delegate { button2_0_click(); };
            Button button2_1 = FindViewById <Button>(Resource.Id.button2_1);

            button2_1.Click += delegate { button2_1_click(); };

            Button button1 = FindViewById <Button>(Resource.Id.button1);

            button1.Click += delegate { button1_click(); };
            Button button2 = FindViewById <Button>(Resource.Id.button2);

            button2.Click += delegate { button2_click(); };
            Button button3 = FindViewById <Button>(Resource.Id.button3);

            button3.Click += delegate { button3_click(); };
            Button button4 = FindViewById <Button>(Resource.Id.button4);

            button4.Click += delegate { button4_click(); };
            Button button5 = FindViewById <Button>(Resource.Id.button5);

            button5.Click += delegate { button5_click(); };
            Button button6 = FindViewById <Button>(Resource.Id.button6);

            button6.Click += delegate { button6_click(); };

            Button button_resolve = FindViewById <Button>(Resource.Id.button_resolve);

            button_resolve.Click += delegate { button_resolve_click(); };

            button_connect        = FindViewById <Button>(Resource.Id.button_connect);
            button_connect.Click += delegate { button_connect_click(); };

            seekBar1 = FindViewById <SeekBar>(Resource.Id.seekBar1);
            seekBar1.ProgressChanged += delegate { seekbar1_changed(); };
        }
Beispiel #58
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var middleOfScreen = new Vector3(UIComponent.Resolution.X, UIComponent.Resolution.Y, 0) / 2;

            edit1 = new EditText()
            {
                Name         = "TestEdit1",
                Font         = Content.Load <SpriteFont>("HanSans13"),
                MinimumWidth = 100,
                Text         = "Sample Text1",
                MaxLength    = 35,
                TextSize     = 20,
                SynchronousCharacterGeneration = true
            };
            ApplyEditTextDefaultStyle(edit1);
            edit1.DependencyProperties.Set(Canvas.PinOriginPropertyKey, 0.5f * Vector3.One);
            edit1.DependencyProperties.Set(Canvas.AbsolutePositionPropertyKey, new Vector3(middleOfScreen.X, 100, 0));
            edit1.TextChanged += Edit1OnTextChanged;

            edit2 = new EditText()
            {
                Name                           = "TestEdit2",
                Font                           = Content.Load <SpriteFont>("MicrosoftSansSerif15"),
                MinimumWidth                   = 100,
                Text                           = "Sample2 Text2",
                MaxLength                      = 10,
                CharacterFilterPredicate       = IsLetter,
                SynchronousCharacterGeneration = true
            };
            ApplyEditTextDefaultStyle(edit2);
            edit2.DependencyProperties.Set(Canvas.PinOriginPropertyKey, 0.5f * Vector3.One);
            edit2.DependencyProperties.Set(Canvas.AbsolutePositionPropertyKey, new Vector3(middleOfScreen.X, 200, 0));
            edit2.TextChanged += Edit2OnTextChanged;

            edit3 = new EditText()
            {
                Name         = "TestEdit3",
                Font         = Content.Load <SpriteFont>("HanSans13"),
                MinimumWidth = 100,
                Text         = "secret",
                MaxLength    = 15,
                TextSize     = 24,
                InputType    = EditText.InputTypeFlags.Password,
                SynchronousCharacterGeneration = true
            };
            ApplyEditTextDefaultStyle(edit3);
            edit3.DependencyProperties.Set(Canvas.PinOriginPropertyKey, 0.5f * Vector3.One);
            edit3.DependencyProperties.Set(Canvas.AbsolutePositionPropertyKey, new Vector3(middleOfScreen.X, 300, 0));

            edit4 = new EditText()
            {
                Name         = "TestEdit4",
                Font         = Content.Load <SpriteFont>("MicrosoftSansSerif15"),
                MinimumWidth = 200,
                Text         = "aligned text",
                TextSize     = 24,
                SynchronousCharacterGeneration = true
            };
            ApplyEditTextDefaultStyle(edit4);
            edit4.DependencyProperties.Set(Canvas.PinOriginPropertyKey, 0.5f * Vector3.One);
            edit4.DependencyProperties.Set(Canvas.AbsolutePositionPropertyKey, new Vector3(middleOfScreen.X, 400, 0));

            var canvas = new Canvas();

            canvas.Children.Add(edit1);
            canvas.Children.Add(edit2);
            canvas.Children.Add(edit3);
            canvas.Children.Add(edit4);

            canvas.UIElementServices = new UIElementServices {
                Services = this.Services
            };

            UIComponent.Page = new Engine.UIPage {
                RootElement = canvas
            };
        }
Beispiel #59
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.AddTask);

            EditText   name         = FindViewById <EditText>(Resource.Id.taskNameField);
            DatePicker datepicker   = FindViewById <DatePicker>(Resource.Id.dueDate);
            Button     addButton    = FindViewById <Button>(Resource.Id.addButton);
            Button     complete     = FindViewById <Button>(Resource.Id.button1);
            Button     cancelButton = FindViewById <Button>(Resource.Id.cancelButton);

            //Get and assign name and date data passed from planner page
            IList <string> temp = Intent.Extras.GetStringArrayList("taskData") ?? new List <string>()
            {
                "", DateTime.Now.ToString()
            };
            string   taskName    = temp[0];
            DateTime taskDueDate = DateTime.Parse(temp[1]);

            name.Text = taskName;

            //Set add button text depending on whether task is new or being edited
            addButton.Text = (taskName == "") ? "Add" : "Update";

            //If this task is not being added for the first time, enable option to mark as done
            if (taskName != "")
            {
                complete.Visibility = ViewStates.Visible;
            }

            //If marked as completed, remove from stored tasks
            complete.Click += (object sender, EventArgs e) =>
            {
                ISharedPreferencesEditor edit = Planner.editTasks();

                edit.Remove(taskName);
                edit.Commit();

                //Switch back to planner
                var intent = new Intent(this, typeof(Planner));
                StartActivity(intent);
            };

            //datepicker.MinDate = Java.Lang.JavaSystem.CurrentTimeMillis() - 100000;
            datepicker.DateTime = taskDueDate;

            addButton.Click += (object sender, EventArgs e) =>
            {
                ISharedPreferences file = Application.Context.GetSharedPreferences("tasks", FileCreationMode.Private);

                //Check to make sure there is not already an assignment with the name entered
                if (taskName != name.Text && file.Contains(name.Text))
                {
                    //If there is, display an error
                    AlertDialog.Builder error = new AlertDialog.Builder(this);
                    error.SetTitle("Oops!");
                    error.SetMessage("You already have an task with that name.");
                    error.SetPositiveButton("OK", (senderAlert, args) => { });

                    Dialog dialog = error.Create();
                    dialog.Show();
                }
                else
                {
                    //Otherwise, save the new data
                    ISharedPreferencesEditor edit = file.Edit();

                    //If the name is being changed, remove the old name
                    if (taskName != "")
                    {
                        edit.Remove(taskName);
                    }

                    edit.PutString(name.Text, datepicker.DateTime.ToString());
                    edit.Commit();

                    //Switch back to planner
                    var intent = new Intent(this, typeof(Planner));
                    StartActivity(intent);
                }
            };
        }
Beispiel #60
0
        public static void Backspace(EditText editText)
        {
            var keyEvent = new KeyEvent(0, 0, 0, Keycode.Del, 0, 0, 0, 0, KeyEventFlags.Canceled);

            editText.DispatchKeyEvent(keyEvent);
        }