public void trackin() { inputMethodManager.ToggleSoftInput(InputMethodManager.ShowForced, 0); string LotNo = txtLot.Text; int trackInQty = 0; if (LotNo == "" || LotNo == null) { RunOnUiThread(() => { linearMain.RequestFocus(); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Message"); alert.SetMessage("Please enter Lot Number"); alert.SetCancelable(true); alert.SetPositiveButton("Close", delegate { CloseContextMenu(); }); alert.Show(); loading.Visibility = ViewStates.Invisible; }); return; } try { trackInQty = Convert.ToInt32(txtQty.Text); } catch { RunOnUiThread(() => { linearMain.RequestFocus(); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Message"); alert.SetMessage("Please specify correct Track In Quantity"); alert.SetCancelable(true); alert.SetPositiveButton("Close", delegate { CloseContextMenu(); }); alert.Show(); loading.Visibility = ViewStates.Invisible; }); return; } string result = HttpHandler.trackIn(GlobalVariable.userID, LotNo, equipment, trackInQty, txtComment.Text); RunOnUiThread(() => { linearMain.RequestFocus(); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Message"); alert.SetMessage(result); alert.SetCancelable(true); alert.SetPositiveButton("Close", delegate { CloseContextMenu(); }); alert.Show(); loading.Visibility = ViewStates.Invisible; }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_Registrar); btnCriarNovoUsuario = FindViewById <Button>(Resource.Id.btnCriarNovoUsuario); txtCPFUsuario = FindViewById <EditText>(Resource.Id.txtCPFUsuario); txtNomeUsuario = FindViewById <EditText>(Resource.Id.txtNomeUsuario); txtSobreNomeUsuario = FindViewById <EditText>(Resource.Id.txtSobreNomeUsuario); txtCelularUsuario = FindViewById <EditText>(Resource.Id.txtCelularUsuario); txtSenhaUsuario = FindViewById <EditText>(Resource.Id.txtSenhaUsuario); txtEmailUsuario = FindViewById <EditText>(Resource.Id.txtEmailUsuario); LinearLayout root = FindViewById <LinearLayout>(Resource.Id.RegistrarLayout); root.RequestFocus(); TelephonyManager mTelephonyMgr; mTelephonyMgr = (TelephonyManager)this.GetSystemService(TelephonyService); numero = string.IsNullOrEmpty(mTelephonyMgr.Line1Number) ? null : mTelephonyMgr.Line1Number.ToString(); txtCelularUsuario.Text = numero; Conteudo conteudo = new Conteudo(); spinnerGenero = FindViewById <Spinner>(Resource.Id.spnGeneroUsuario); ArrayAdapter <String> spinnerArrayAdapterGenero = new ArrayAdapter <String>(this, Resource.Layout.spinner_item, conteudo.Genero()); spinnerArrayAdapterGenero.SetDropDownViewResource(Resource.Layout.spinner_item); spinnerGenero.Adapter = spinnerArrayAdapterGenero; spinnerGenero.ItemSelected += SpinnerGenero_ItemSelected; btnCriarNovoUsuario.Click += BtnCriarNovoUsuario_Click; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.Inflate(Resource.Layout.StudentProfileRecView, container, false); string dbPath_login = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "user.db3"); SQLiteConnection db_login = new SQLiteConnection(dbPath_login); StudentTable studentAttributes = db_login.Get <StudentTable>(student_id); TextView candidateName = view.FindViewById <TextView>(Resource.Id.candidateName); TextView candidateEmail = view.FindViewById <TextView>(Resource.Id.candidateEmail); TextView candidateSchool = view.FindViewById <TextView>(Resource.Id.schoolText); TextView candidateMajor = view.FindViewById <TextView>(Resource.Id.majorText); TextView candidateGT = view.FindViewById <TextView>(Resource.Id.gradtermText); TextView candidateGPA = view.FindViewById <TextView>(Resource.Id.gpaText); notes = view.FindViewById <EditText>(Resource.Id.notes); Button nextButton = view.FindViewById <Button>(Resource.Id.nextButton); star = view.FindViewById <ImageView>(Resource.Id.star); heart = view.FindViewById <ImageView>(Resource.Id.heart); ImageView backButton = view.FindViewById <ImageView>(Resource.Id.backButton); Button hideKeyboard = view.FindViewById <Button>(Resource.Id.hideKeyboard); LinearLayout rootLayout = view.FindViewById <LinearLayout>(Resource.Id.rootLayout); hideKeyboard.Visibility = ViewStates.Invisible; hideKeyboard.Click += (sender, e) => { InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(notes.WindowToken, 0); rootLayout.RequestFocus(); hideKeyboard.Visibility = ViewStates.Invisible; }; notes.FocusChange += (sender, e) => { hideKeyboard.Visibility = ViewStates.Visible; }; backButton.Click += (sender, e) => { Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction(); trans.Replace(Resource.Id.qs_root_frame, new QsFragment()); trans.Commit(); }; candidateName.Text = studentAttributes.name; candidateEmail.Text = studentAttributes.email; candidateSchool.Text = studentAttributes.school; candidateMajor.Text = studentAttributes.major; candidateGT.Text = studentAttributes.gradterm; candidateGPA.Text = studentAttributes.gpa; nextButton.Click += NextButton_Click; star.Click += Star_Click; heart.Click += Heart_Click; return(view); }
private void OnDateClick(object sender, EventArgs e) { _form.RequestFocus(); Calendar calendar = Calendar.GetInstance(Java.Util.TimeZone.Default); dialog = new DatePickerDialog(CrossCurrentActivity.Current.Activity, DateSet, calendar.Get(CalendarField.Year), calendar.Get(CalendarField.Month), calendar.Get(CalendarField.DayOfMonth)); dialog.Show(); }
private static BitmapDrawable GetCircleForProgress() { var conf = Bitmap.Config.Argb4444; if (_progressImage == null) { _progressImage = Bitmap.CreateBitmap(_windowSize.Width, _windowSize.Height, conf); } var canvas = new Canvas(_progressImage); var paint = new Paint(); paint.SetStyle(Paint.Style.Stroke); paint.StrokeWidth = 3; paint.AntiAlias = true; paint.Color = _colorToUse; canvas.DrawPaint(new Paint() { Color = Android.Graphics.Color.White }); if (Progress > 20) { _activity.RunOnUiThread(() => { var ll = _layoutCenter.LayoutParameters; if (ll.Height != _windowSize.Height) { ll.Height = _windowSize.Height; _layoutCenter.LayoutParameters = ll; _layoutCenter.RequestFocus(); } }); canvas.DrawBitmap(_car, _zoneCircle.CenterX() - _car.Width / 2f, _zoneCircle.CenterY() - _car.Height / 2f, null); var startAngle = -90f; var sweepingAngle = ((Progress - 20f) / 80f) * 360f; canvas.DrawArc(_zoneCircle, startAngle, sweepingAngle, false, paint); } else { _activity.RunOnUiThread(() => { var ll = _layoutCenter.LayoutParameters; ll.Height = (int)(((float)Progress / 20f) * _windowSize.Height); _layoutCenter.LayoutParameters = ll; _layoutCenter.RequestLayout(); }); } _layoutCenter.RequestLayout(); return(new BitmapDrawable(_progressImage)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_Solicitacao); txtConteudo = FindViewById <EditText>(Resource.Id.txtConteudo); txtLocal = FindViewById <EditText>(Resource.Id.txtLocal); txtCEP = FindViewById <EditText>(Resource.Id.txtCEP); btnEnviarSolicitacao = FindViewById <Button>(Resource.Id.btnEnviarSolicitacao); LinearLayout root = FindViewById <LinearLayout>(Resource.Id.SolicitacaoLayout); root.RequestFocus(); Conteudo conteudo = new Conteudo(); spinnerServico = FindViewById <Spinner>(Resource.Id.spnServico); ArrayAdapter <String> spinnerArrayAdapterServico = new ArrayAdapter <String>(this, Resource.Layout.spinner_item, conteudo.Servicos()); spinnerArrayAdapterServico.SetDropDownViewResource(Resource.Layout.spinner_item); spinnerServico.Adapter = spinnerArrayAdapterServico; spinnerServico.ItemSelected += SpinnerServico_ItemSelected; spinnerAssunto = FindViewById <Spinner>(Resource.Id.spnAssunto); ArrayAdapter <String> spinnerArrayAdapterAssunto = new ArrayAdapter <String>(this, Resource.Layout.spinner_item, conteudo.Assuntos()); spinnerArrayAdapterAssunto.SetDropDownViewResource(Resource.Layout.spinner_item); spinnerAssunto.Adapter = spinnerArrayAdapterAssunto; spinnerAssunto.ItemSelected += SpinnerAssunto_ItemSelected; spinnerPrioridade = FindViewById <Spinner>(Resource.Id.spnPrioridade); ArrayAdapter <String> spinnerArrayAdapter = new ArrayAdapter <String>(this, Resource.Layout.spinner_item, conteudo.Prioridades()); spinnerArrayAdapter.SetDropDownViewResource(Resource.Layout.spinner_item); spinnerPrioridade.Adapter = spinnerArrayAdapter; spinnerPrioridade.ItemSelected += SpinnerPrioridade_ItemSelected; _imageView = FindViewById <ImageView>(Resource.Id.photoViewer); btnCEPButton = FindViewById <ImageButton>(Resource.Id.btnCEP); btnCEPButton.Click += BtnCEPButton_ClickAsync; btnPhotoButton = FindViewById <ImageButton>(Resource.Id.photoButton); btnPhotoButton.Click += BtnPhotoButton_Click; btnTirarPhotoButton = FindViewById <ImageButton>(Resource.Id.tirarPhotoButton); btnTirarPhotoButton.Click += BtnTirarPhotoButton_Click; btnVideoButton = FindViewById <ImageButton>(Resource.Id.videoButton); btnVideoButton.Click += BtnVideoButton_Click; btnEnviarSolicitacao.Click += BtnEnviarSolicitacao_Click; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.Inflate(Resource.Layout.StudentProfileRecView, container, false); stopwatch = new Stopwatch(); stopwatch.Start(); progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress); candidateName = view.FindViewById <TextView>(Resource.Id.candidateName); candidateEmail = view.FindViewById <TextView>(Resource.Id.candidateEmail); candidateSchool = view.FindViewById <TextView>(Resource.Id.schoolText); candidateMajor = view.FindViewById <TextView>(Resource.Id.majorText); candidateGT = view.FindViewById <TextView>(Resource.Id.gradtermText); candidateGPA = view.FindViewById <TextView>(Resource.Id.gpaText); notes = view.FindViewById <EditText>(Resource.Id.notes); Button nextButton = view.FindViewById <Button>(Resource.Id.nextButton); star = view.FindViewById <ImageView>(Resource.Id.star); heart = view.FindViewById <ImageView>(Resource.Id.heart); ImageView backButton = view.FindViewById <ImageView>(Resource.Id.backButton); Button hideKeyboard = view.FindViewById <Button>(Resource.Id.hideKeyboard); LinearLayout rootLayout = view.FindViewById <LinearLayout>(Resource.Id.rootLayout); LoadCandidateInfo(); hideKeyboard.Visibility = ViewStates.Invisible; hideKeyboard.Click += (sender, e) => { InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(notes.WindowToken, 0); rootLayout.RequestFocus(); hideKeyboard.Visibility = ViewStates.Invisible; }; notes.FocusChange += (sender, e) => { hideKeyboard.Visibility = ViewStates.Visible; }; backButton.Click += (sender, e) => { Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction(); trans.Replace(Resource.Id.qs_root_frame, new QsFragment()); trans.Commit(); }; nextButton.Click += NextButton_Click; star.Click += Star_Click; heart.Click += Heart_Click; return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var layout = new LinearLayout(Activity) { Orientation = Orientation.Vertical, }; var search = DroidFactory.GetNativeObject <SearchBox>(SearchBox, nameof(SearchBox)); AttachSearchView(search, layout); List = MXContainer.Resolve <ListView>(Activity) ?? new ListView(Activity); List.OnItemSelectedListener = this; List.OnItemClickListener = this; List.OnItemLongClickListener = this; List.DescendantFocusability = DescendantFocusability.BeforeDescendants; List.ScrollingCacheEnabled = false; List.Adapter = new CellAdapter(this); List.ScrollStateChanged += (o, e) => { if (e.ScrollState == ScrollState.Idle) { var cell = List.GetChildAt(0); _index = List.FirstVisiblePosition; _top = cell?.Top ?? 0; } List.DescendantFocusability = DescendantFocusability.BeforeDescendants; if (_touchScroll) { DroidFactory.HideKeyboard(true); } if (e.ScrollState == ScrollState.Idle) { _touchScroll = true; } RequestFocusHomeUp = false; }; List.SetRecyclerListener(this); SeparatorColor = _separatorColor; layout.AddView(List, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent)); if (search == null || search.FocusRequested) { layout.RequestFocus(); } else { List.RequestFocus(); } return(layout); }
protected void CheckFocus() { EditText loanInput = FindViewById <EditText>(Resource.Id.loanAddInput); if (loanInput.IsFocused) { LoadInputValue(loanInput); InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(loanInput.WindowToken, 0); LinearLayout loanAddLayout = FindViewById <LinearLayout>(Resource.Id.addLoanLayout); loanAddLayout.RequestFocus(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.signupScreen); // set view to sign up screen ActionBar.Hide(); // hide the action bar // Get UI Controls finishButton = FindViewById <Button>(Resource.Id.finish); facebookButton = FindViewById <Button>(Resource.Id.facebook); newName = FindViewById <EditText>(Resource.Id.FullName); newEmailAddress = FindViewById <EditText>(Resource.Id.NewEmail); newPassword = FindViewById <EditText>(Resource.Id.NewPassword); confirmNewPassword = FindViewById <EditText>(Resource.Id.ConfirmNewPassword); LinearLayout ll_main = FindViewById <LinearLayout>(Resource.Id.rootLayout); ll_main.RequestFocus(); // On Button Clicks finishButton.Click += FinishButton_Click; }
public async void SendMessage() { HideKeyboard(); Activity_Outer.RequestFocus(); string Content = et_Message.Text; et_Message.Text = ""; if (Content.Trim() == "") { Toast.MakeText(this, "請輸入內容", ToastLength.Short).Show(); return; } tv_RMessage.Text = Content; tv_RMessage.Visibility = ViewStates.Visible; iv_Frog.Visibility = ViewStates.Gone; tv_LMessage.Text = "辨識中..."; AllRequestResult result = null; await Task.Run(() => { result = CreateMessage(Content); }); if (result.IsSuccess) { string ResMessage = (string)result.Result; ResMessage = ResMessage.Replace("\\n", "\n"); tv_LMessage.Text = ResMessage; } else { tv_LMessage.Text = "辨識失敗"; WebExceptionHandler((WebException)result.Result); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { string dbPath_login = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "user.db3"); SQLiteConnection db_login = new SQLiteConnection(dbPath_login); string dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3"); SQLiteConnection db_attributes = new SQLiteConnection(dbPath_attributes); MyAttributes myAttributes = db_attributes.Get <MyAttributes>(1); string fileName_pastQs = "pastqs_" + myAttributes.attribute1 + ".db3"; string dbPath_pastQs = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), fileName_pastQs); SQLiteConnection db_pastQs = new SQLiteConnection(dbPath_pastQs); SQLite_Tables.PastQueue thisQueue = db_pastQs.Query <SQLite_Tables.PastQueue>("SELECT * FROM PastQueue WHERE studentid = ?", studentid).First(); StudentTable thisStudent = db_login.Get <StudentTable>(studentid); view = inflater.Inflate(Resource.Layout.StudentProfileRecView, container, false); TextView candidateName = view.FindViewById <TextView>(Resource.Id.candidateName); TextView candidateEmail = view.FindViewById <TextView>(Resource.Id.candidateEmail); TextView school = view.FindViewById <TextView>(Resource.Id.schoolText); TextView major = view.FindViewById <TextView>(Resource.Id.majorText); TextView gradterm = view.FindViewById <TextView>(Resource.Id.gradtermText); TextView gpa = view.FindViewById <TextView>(Resource.Id.gpaText); EditText notes = view.FindViewById <EditText>(Resource.Id.notes); ImageView star = view.FindViewById <ImageView>(Resource.Id.star); ImageView heart = view.FindViewById <ImageView>(Resource.Id.heart); Button nextButton = view.FindViewById <Button>(Resource.Id.nextButton); ImageView backButton = view.FindViewById <ImageView>(Resource.Id.backButton); Button hideKeyboard = view.FindViewById <Button>(Resource.Id.hideKeyboard); LinearLayout rootLayout = view.FindViewById <LinearLayout>(Resource.Id.rootLayout); hideKeyboard.Visibility = ViewStates.Invisible; hideKeyboard.Click += (sender, e) => { InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(notes.WindowToken, 0); rootLayout.RequestFocus(); hideKeyboard.Visibility = ViewStates.Invisible; }; notes.FocusChange += (sender, e) => { hideKeyboard.Visibility = ViewStates.Visible; }; candidateName.Text = thisStudent.name; candidateEmail.Text = thisStudent.email; school.Text = thisStudent.school; major.Text = thisStudent.major; gradterm.Text = thisStudent.gradterm; gpa.Text = thisStudent.gpa; notes.Text = thisQueue.notes; int newRating = thisQueue.rating; if (thisQueue.rating == 1) { star.SetImageResource(Resource.Drawable.starfilled); } else if (thisQueue.rating == 2) { heart.SetImageResource(Resource.Drawable.heartfilled); } nextButton.Visibility = ViewStates.Gone; heart.Click += (sender, e) => { if (newRating == 2) { heart.SetImageResource(Resource.Drawable.heartunfilled); newRating = 0; } else { heart.SetImageResource(Resource.Drawable.heartfilled); star.SetImageResource(Resource.Drawable.starunfilled); newRating = 2; } }; star.Click += (sender, e) => { if (newRating == 1) { star.SetImageResource(Resource.Drawable.starunfilled); newRating = 0; } else { star.SetImageResource(Resource.Drawable.starfilled); heart.SetImageResource(Resource.Drawable.heartunfilled); newRating = 1; } }; backButton.Click += (sender, e) => { SQLite_Tables.PastQueue newQueue = new SQLite_Tables.PastQueue(); newQueue.id = thisQueue.id; newQueue.studentid = thisQueue.studentid; newQueue.rating = newRating; newQueue.notes = notes.Text; db_pastQs.InsertOrReplace(newQueue); Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction(); if (source == "Profile") { trans.Replace(Resource.Id.profile_root_frame, new ProfileFragment()); } else if (source == "PastQs") { trans.Replace(Resource.Id.qs_root_frame, new PastQs()); } //trans.Replace(Resource.Id.qs_root_frame, new PastQs()); trans.Commit(); }; return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); id_sess = Intent.Extras.GetString("id_sess"); idp = Intent.Extras.GetString("idp"); riga_cart = Intent.Extras.GetInt("riga_cart"); SetContentView(Resource.Layout.scheda); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetActionBar(toolbar); var metrics = Resources.DisplayMetrics; var widthInDp = metrics.WidthPixels; var heightInDp = metrics.HeightPixels; String sizeImg = ""; if (widthInDp > heightInDp) { sizeImg = heightInDp.ToString(); } else { sizeImg = widthInDp.ToString(); } ImageView ivfoto = FindViewById <ImageView>(Resource.Id.schFoto); TextView tvCodice = FindViewById <TextView>(Resource.Id.tvCodice); TextView tvPrezzo = FindViewById <TextView>(Resource.Id.tvPrezzo); TextView tvDescr = FindViewById <TextView>(Resource.Id.tvDescr); EditText etQta = FindViewById <EditText>(Resource.Id.etQta); EditText etNote = FindViewById <EditText>(Resource.Id.etNote); Button btAggiungi = FindViewById <Button>(Resource.Id.btAggCarrello); Button btElimina = FindViewById <Button>(Resource.Id.btEliCarrello); clsCart objCart = new clsCart(Application.CacheDir.AbsolutePath, id_sess); if (riga_cart > 0) { Tuple <string, string, string, string> dati_cart = objCart.RigaCarrello(riga_cart); etQta.Text = dati_cart.Item3; etNote.Text = dati_cart.Item4; btAggiungi.Text = "Aggiorna"; btElimina.Visibility = ViewStates.Visible; } btAggiungi.Click += (object sender, EventArgs e) => { if (etQta.Text != "") { if (riga_cart == 0) { objCart.AggiungiCarrello(idp, nome, etQta.Text, etNote.Text); } else { objCart.AggiornaCarrello(riga_cart, etQta.Text, etNote.Text); } this.Finish(); } else { Android.Widget.Toast.MakeText(this, "Specificare la quantità", Android.Widget.ToastLength.Short).Show(); } }; btElimina.Click += (object sender, EventArgs e) => { if (riga_cart > 0) { objCart.EliminaCarrello(riga_cart); } this.Finish(); }; LinearLayout parentContainer = FindViewById <LinearLayout>(Resource.Id.parentContainer); parentContainer.RequestFocus(); ProgressDialog dialog = new ProgressDialog(this); // dialog.SetMessage("Accesso in corso"); dialog.SetCancelable(false); dialog.Show(); WebClient client = new WebClient(); client.DownloadStringAsync(new Uri("http://2.115.37.22/umbriaeq/rest/b2brest.php?op=schedart&session_id=" + id_sess + "&idp=" + idp + "&size=" + sizeImg)); client.DownloadStringCompleted += (object sender, DownloadStringCompletedEventArgs e2) => { //string reply_art = client.DownloadString("http://2.115.37.22/umbriaeq/rest/b2brest.php?op=schedart&session_id=" + id_sess + "&idp=" + idp + "&size=" + sizeImg); string reply_art = e2.Result; JSONObject jsobj = new JSONObject(reply_art); string cod = jsobj.GetString("codice"); string descr = jsobj.GetString("descrizione"); if (cod == "0") { JSONObject dati = jsobj.GetJSONObject("articolo"); String codice = dati.GetString("codice"); nome = dati.GetString("nome"); String descrizione = dati.GetString("descrizione"); String foto = dati.GetString("foto"); String Prezzo = dati.GetString("prezzo_lordo"); String Sconto = dati.GetString("sconto"); String Disponibile = dati.GetString("disponibile"); foto = foto.Replace("../", ""); ActionBar.Title = nome; tvCodice.Text = "Codice: " + codice; tvPrezzo.Text = "Prezzo: " + Prezzo + " (Sc. " + Sconto + "%)"; tvDescr.Text = descrizione; //string path_file = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath; string filename = System.IO.Path.Combine(Application.CacheDir.AbsolutePath, "b2bAppCacheF" + codice + "_" + sizeImg + ".jpg"); Bitmap imageBitmap = null; if (File.Exists(filename)) { var imageBytes = File.ReadAllBytes(filename); if (imageBytes != null && imageBytes.Length > 0) { imageBitmap = BitmapFactory.DecodeByteArray(imageBytes, 0, imageBytes.Length); } ivfoto.SetImageBitmap(imageBitmap); } try { client.DownloadDataAsync(new Uri("http://2.115.37.22/umbriaeq/" + foto)); client.DownloadDataCompleted += (object sender2, DownloadDataCompletedEventArgs e) => { var imageBytes = e.Result; if (imageBytes != null && imageBytes.Length > 0) { imageBitmap = BitmapFactory.DecodeByteArray(imageBytes, 0, imageBytes.Length); } ivfoto.SetImageBitmap(imageBitmap); File.WriteAllBytes(filename, imageBytes); }; } catch { // Imposto foto "No Image" imageBitmap = null; } dialog.Dismiss(); } }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.categorie); // loads the HomeScreen.axml as this activity's view ListView listView = FindViewById <ListView>(Resource.Id.List); // get reference to the ListView in the layout listView.ItemClick += OnListItemClick; // to be defined LinearLayout parentContainer = FindViewById <LinearLayout>(Resource.Id.parentContainer); id_sess = Intent.Extras.GetString("id_sess"); String cat_padre = Intent.Extras.GetString("cat_padre"); path = Intent.Extras.GetString("path"); this.Title = path; var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetActionBar(toolbar); ActionBar.Title = path; WebClient client = new WebClient(); EditText etCerca = FindViewById <EditText>(Resource.Id.etCerca); Button btCerca = FindViewById <Button>(Resource.Id.btCerca); btCerca.Click += (object sender, EventArgs e) => { if (etCerca.Text.Length == 0) { return; } categorie.Clear(); cat_id.Clear(); prodotti.Clear(); prod_id.Clear(); items.Clear(); string reply_art = client.DownloadString("http://2.115.37.22/umbriaeq/rest/b2brest.php?op=articoli/cat&session_id=" + id_sess + "&cat_id=" + cat_padre + "&keyword=" + etCerca.Text); JSONObject jsobj_art = new JSONObject(reply_art); string cod_art = jsobj_art.GetString("codice"); string descr_art = jsobj_art.GetString("descrizione"); if (cod_art == "0") { JSONArray artArray = jsobj_art.GetJSONArray("articoli"); for (int i = 0; i < artArray.Length(); i++) { JSONObject item = (JSONObject)artArray.Get(i); String idp = item.GetString("idp"); prod_id.Add(idp); String prodotto = item.GetString("nome"); prodotti.Add(prodotto); items.Add(new Tuple <string, int>(prodotto, Resource.Drawable.cart)); } } listView.Adapter = new ActivityListItem_Adapter(this, items); parentContainer.RequestFocus(); }; if (cat_padre != "0") { etCerca.Visibility = Android.Views.ViewStates.Invisible; btCerca.Visibility = Android.Views.ViewStates.Invisible; etCerca.SetHeight(0); btCerca.SetHeight(0); } else { parentContainer.RequestFocus(); } //string path_file = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath; // Android.OS.Environment.DownloadCacheDirectory.AbsolutePath; string filename = Path.Combine(Application.CacheDir.AbsolutePath, "b2bAppCacheC" + cat_padre + ".txt"); if (File.Exists(filename)) { var streamReader = new StreamReader(filename); while (!streamReader.EndOfStream) { String riga = streamReader.ReadLine(); String[] col = riga.Split(';'); cat_id.Add(col[0]); categorie.Add(col[1]); cats.Add(new Tuple <string, int>(col[1], Resource.Drawable.freccia)); } streamReader.Close(); } else { String reply_cat = client.DownloadString("http://2.115.37.22/umbriaeq/rest/b2brest.php?op=categorie&session_id=" + id_sess + "&cat_padre=" + cat_padre); var streamWriter = new StreamWriter(filename, false); JSONObject jsobj = new JSONObject(reply_cat); string cod = jsobj.GetString("codice"); string descr = jsobj.GetString("descrizione"); if (cod == "0") { JSONArray catArray = jsobj.GetJSONArray("categorie"); for (int i = 0; i < catArray.Length(); i++) { JSONObject item = (JSONObject)catArray.Get(i); String idc = item.GetString("category_id"); cat_id.Add(idc); String categ = item.GetString("categoria"); categorie.Add(categ); streamWriter.WriteLine(idc + ";" + categ); } } streamWriter.Close(); } //Articoli if (categorie.Count == 0) { string filenameA = Path.Combine(Application.CacheDir.AbsolutePath, "b2bAppCacheA" + cat_padre + ".txt"); if (File.Exists(filenameA)) { var streamReader = new StreamReader(filenameA); while (!streamReader.EndOfStream) { String riga = streamReader.ReadLine(); String[] col = riga.Split(';'); prod_id.Add(col[0]); prodotti.Add(col[1]); items.Add(new Tuple <string, int>(col[1], Resource.Drawable.cart)); } streamReader.Close(); } else { string reply_art = client.DownloadString("http://2.115.37.22/umbriaeq/rest/b2brest.php?op=articoli/cat&session_id=" + id_sess + "&cat_id=" + cat_padre); var streamWriter = new StreamWriter(filenameA, false); JSONObject jsobj_art = new JSONObject(reply_art); string cod_art = jsobj_art.GetString("codice"); string descr_art = jsobj_art.GetString("descrizione"); if (cod_art == "0") { JSONArray artArray = jsobj_art.GetJSONArray("articoli"); for (int i = 0; i < artArray.Length(); i++) { JSONObject item = (JSONObject)artArray.Get(i); String idp = item.GetString("idp"); prod_id.Add(idp); String prodotto = item.GetString("nome"); prodotti.Add(prodotto); items.Add(new Tuple <string, int>(prodotto, Resource.Drawable.cart)); streamWriter.WriteLine(idp + ";" + prodotto); } } streamWriter.Close(); } //this.ListAdapter = new ActivityListItem_Adapter(this, items); listView.Adapter = new ActivityListItem_Adapter(this, items); } else { //this.ListAdapter = new ActivityListItem_Adapter(this, cats); listView.Adapter = new ActivityListItem_Adapter(this, cats); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.layout_Scan); ///////////////////////////////////////////////////////////////////////// // Chck RFID Reader Connected ///////////////////////////////////////////////////////////////////////// // OpenRFIDConnection(); ///////////////////////////////////////////////////////////////////////// int mc = 0; mc++; empNo = Intent.GetStringExtra("empNo"); empName = Intent.GetStringExtra("empName"); storeName = Intent.GetStringExtra("storeName"); toFrom = Intent.GetStringExtra("toFrom"); destStoreCode = Intent.GetStringExtra("destStoreCode"); if (toFrom == "VERIFY") { scanType = "VERIFY"; } else { scanType = "INVENTORY"; } if ((toFrom == "FROM") || (toFrom == "TO")) { scanQTY = 1; } if (toFrom == "ONHAND") { scanQTY = 0; } LinearLayout lRoot = FindViewById <LinearLayout>(Resource.Id.layoutroot); //LinearLayout lTitle = FindViewById<LinearLayout>(Resource.Id.layoutScanTitle); LinearLayout lVFilter = FindViewById <LinearLayout>(Resource.Id.layoutVendorFilter); //LinearLayout lLoadBatch = FindViewById<LinearLayout>(Resource.Id.layoutLoadBatch); LinearLayout lNewConsol = FindViewById <LinearLayout>(Resource.Id.layoutNewConsol); TextView txtScanTitle = FindViewById <TextView>(Resource.Id.txtScanTitle); TextView txtGridHeader1 = FindViewById <TextView>(Resource.Id.txtGridHdr1); TextView txtGridHeader2 = FindViewById <TextView>(Resource.Id.txtGridHdr2); //TextView txtGridHeaderQty= FindViewById<TextView>(Resource.Id.txtGridHdrQty); TextView txtTagCT = FindViewById <TextView>(Resource.Id.txtTagCT); EditText txtVCode = FindViewById <EditText>(Resource.Id.txtVCode); TextView txtVName = FindViewById <TextView>(Resource.Id.txtVendorName); CheckBox chkVendorFilter = FindViewById <CheckBox>(Resource.Id.chkVendorFilter); RadioButton rdoNew = FindViewById <RadioButton>(Resource.Id.rdoScanNew); RadioButton rdoConsol = FindViewById <RadioButton>(Resource.Id.rdoScanConsol); Button btnBackScan = FindViewById <Button>(Resource.Id.btnBackScan); Button btnViewReports = FindViewById <Button>(Resource.Id.btnReports); Button btnFinishScan = FindViewById <Button>(Resource.Id.btnFinishScan); // Transfer Data rdoNew.Click += RdoNew_Click; rdoConsol.Click += RdoConsol_Click; if (scanType == "INVENTORY") { //lTitle.SetBackgroundColor(Android.Graphics.Color.ParseColor("#48C0FA")); txtTagCT.SetBackgroundColor(Android.Graphics.Color.ParseColor("#48C0FA")); lVFilter.Visibility = ViewStates.Visible; //lLoadBatch.Visibility = ViewStates.Gone; lNewConsol.Visibility = ViewStates.Visible; btnViewReports.Enabled = true; btnFinishScan.Enabled = true; rdoNew.Checked = true; if (toFrom != "ONHAND") { txtScanTitle.Text = toFrom + " " + storeName; } else { txtScanTitle.Text = "ON HAND"; } } //////////////////////////////////////////////////////////////////////// // Hide soft keyboard when user clicks on layout background lRoot.Click += delegate { DismissKeyboard(); }; lRoot.RequestFocus(); //////////////////////////////////////////////////////////////////////// chkVendorFilter.Checked = false; txtVCode.Visibility = ViewStates.Gone; txtVName.Visibility = ViewStates.Gone; //Moved to OnResume() //InitEPCArray(); // Initialize array that will hold EPCs (only) for the purpose of making sure duplicates //UpdateEPCArryFromDB(); // Add any stored <FoxProduct> records in db to EPC array and listFoxProducts chkVendorFilter.Click += delegate { if (chkVendorFilter.Checked) { txtVCode.Visibility = ViewStates.Visible; txtVName.Visibility = ViewStates.Visible; vcodeFilter = txtVCode.Text; txtVCode.RequestFocus(); } else { vcodeFilter = ""; txtVCode.Visibility = ViewStates.Gone; txtVName.Visibility = ViewStates.Gone; DismissKeyboard(); } }; dbError = ""; if (!db.createTable_FoxProduct(Constants.DBFilename, ref dbError)) { var builder = new AlertDialog.Builder(this); builder.SetTitle("Database Error!"); builder.SetIcon(Resource.Drawable.iconBang64); builder.SetMessage("A database error has occurred. <FoxProduct> not created. Please exit app and try again."); builder.SetPositiveButton("OK", (s, e2) => { /* Handle 'OK' click */ } ); builder.Create().Show(); } btnViewReports.Click += BtnViewReports_Click; btnFinishScan.Click += BtnFinishScan_Click; // transfer data btnBackScan.Click += BtnBackScan_Click; //timer.Interval = 1000; //timer.Elapsed += Timer_Elapsed; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { string dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3"); SQLiteConnection db_attributes = new SQLiteConnection(dbPath_attributes); myAttributes = db_attributes.Get <MyAttributes>(1); view = inflater.Inflate(Resource.Layout.StudentProfileRecView, container, false); candidateName = view.FindViewById <TextView>(Resource.Id.candidateName); candidateEmail = view.FindViewById <TextView>(Resource.Id.candidateEmail); school = view.FindViewById <TextView>(Resource.Id.schoolText); major = view.FindViewById <TextView>(Resource.Id.majorText); gradterm = view.FindViewById <TextView>(Resource.Id.gradtermText); gpa = view.FindViewById <TextView>(Resource.Id.gpaText); notes = view.FindViewById <EditText>(Resource.Id.notes); star = view.FindViewById <ImageView>(Resource.Id.star); heart = view.FindViewById <ImageView>(Resource.Id.heart); Button nextButton = view.FindViewById <Button>(Resource.Id.nextButton); ImageView backButton = view.FindViewById <ImageView>(Resource.Id.backButton); Button hideKeyboard = view.FindViewById <Button>(Resource.Id.hideKeyboard); LinearLayout rootLayout = view.FindViewById <LinearLayout>(Resource.Id.rootLayout); progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress); LoadStudentData(); hideKeyboard.Visibility = ViewStates.Invisible; hideKeyboard.Click += (sender, e) => { InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(notes.WindowToken, 0); rootLayout.RequestFocus(); hideKeyboard.Visibility = ViewStates.Invisible; }; notes.FocusChange += (sender, e) => { hideKeyboard.Visibility = ViewStates.Visible; }; nextButton.Text = "Save Changes"; nextButton.Click += NextButton_Click; heart.Click += (sender, e) => { if (newRating == 2) { heart.SetImageResource(Resource.Drawable.heartunfilled); newRating = 0; } else { heart.SetImageResource(Resource.Drawable.heartfilled); star.SetImageResource(Resource.Drawable.starunfilled); newRating = 2; } }; star.Click += (sender, e) => { if (newRating == 1) { star.SetImageResource(Resource.Drawable.starunfilled); newRating = 0; } else { star.SetImageResource(Resource.Drawable.starfilled); heart.SetImageResource(Resource.Drawable.heartunfilled); newRating = 1; } }; backButton.Click += (sender, e) => { Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction(); if (source == "Profile") { trans.Replace(Resource.Id.profile_root_frame, new ProfileFragment()); } else if (source == "PastQs") { trans.Replace(Resource.Id.qs_root_frame, new PastQs()); } trans.Commit(); }; return(view); }
void HideSoftInput() { inputMethodManager.HideSoftInputFromWindow(mainLayout.WindowToken, HideSoftInputFlags.NotAlways); mainLayout.RequestFocus(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //Load MobileOrder Settings in a global settings object for all activities Settings settings = CurrentSettings.GetSettings(); SetContentView(Resource.Layout.Settings); //SET SETTINGS OBJECT VALUES TO FIELDS //SALES Switch custflag = FindViewById <Switch>(Resource.Id.custflag); custflag.Checked = settings.Sales.Custflag; Switch discustedit = FindViewById <Switch>(Resource.Id.discustedit); discustedit.Checked = settings.Sales.Discustedit; Switch detailheader = FindViewById <Switch>(Resource.Id.detailheader); detailheader.Checked = settings.Sales.Detailheader; Switch nullq = FindViewById <Switch>(Resource.Id.nullq); nullq.Checked = settings.Sales.Nullq; Switch allpay = FindViewById <Switch>(Resource.Id.allpay); allpay.Checked = settings.Sales.Allpay; Switch enableprice = FindViewById <Switch>(Resource.Id.enableprice); enableprice.Checked = settings.Sales.Enableprice; Switch disabletran = FindViewById <Switch>(Resource.Id.disabletran); disabletran.Checked = settings.Sales.Disabletran; Switch payforinv = FindViewById <Switch>(Resource.Id.payforinv); payforinv.Checked = settings.Sales.Payforinv; Switch disabledownload = FindViewById <Switch>(Resource.Id.disabledownload); disabledownload.Checked = settings.Sales.Disabledownload; TextView tpid = FindViewById <TextView>(Resource.Id.tpid); tpid.Text = settings.Sales.TpId; TextView tp = FindViewById <TextView>(Resource.Id.tp); tp.Text = settings.Sales.Tp; TextView Decimaldigit = FindViewById <TextView>(Resource.Id.Decimaldigit); Decimaldigit.Text = settings.Sales.Decimaldigit.ToString(); TextView paydays = FindViewById <TextView>(Resource.Id.paydays); paydays.Text = settings.Sales.Paydays.ToString(); //SYNCHRONIZATION Switch servicefiletransfer = FindViewById <Switch>(Resource.Id.servicefiletransfer); servicefiletransfer.Checked = settings.Synchronization.Servicefiletransfer; TextView tp_id = FindViewById <TextView>(Resource.Id.tp_id); tp_id.Text = settings.Synchronization.TpId; TextView user = FindViewById <TextView>(Resource.Id.user); user.Text = settings.Synchronization.User; TextView psw = FindViewById <TextView>(Resource.Id.psw); psw.Text = settings.Synchronization.Psw; TextView msellurl = FindViewById <TextView>(Resource.Id.msellurl); msellurl.Text = settings.Synchronization.Msellurl; TextView msellurl2 = FindViewById <TextView>(Resource.Id.msellurl2); msellurl2.Text = settings.Synchronization.Msellurl2; TextView server = FindViewById <TextView>(Resource.Id.server); server.Text = settings.Synchronization.Server; TextView server2 = FindViewById <TextView>(Resource.Id.server2); server2.Text = settings.Synchronization.Server2; TextView updir = FindViewById <TextView>(Resource.Id.updir); updir.Text = settings.Synchronization.Updir; TextView getdir = FindViewById <TextView>(Resource.Id.getdir); getdir.Text = settings.Synchronization.Getdir; Switch autoftp = FindViewById <Switch>(Resource.Id.autoftp); autoftp.Checked = settings.Synchronization.Autoftp; TextView adminpass = FindViewById <TextView>(Resource.Id.adminpass); adminpass.Text = settings.Synchronization.Adminpass; //PRINTING Switch fpprinter = FindViewById <Switch>(Resource.Id.fpprinter); fpprinter.Checked = settings.Printing.Fpprinter; TextView printer = FindViewById <TextView>(Resource.Id.printer); printer.Text = settings.Printing.Printer; Spinner printertype = FindViewById <Spinner>(Resource.Id.printertype); int i = (int)settings.Printing.PrinterType; printertype.SetSelection(i); Switch fpasnonfp = FindViewById <Switch>(Resource.Id.fpasnonfp); fpasnonfp.Checked = settings.Printing.Fpasnonfp; Switch secondinvoicecopy = FindViewById <Switch>(Resource.Id.secondinvoicecopy); secondinvoicecopy.Checked = settings.Printing.Secondinvoicecopy; Switch wm = FindViewById <Switch>(Resource.Id.wm); wm.Checked = settings.Printing.Wm; TextView nonfpprinter = FindViewById <TextView>(Resource.Id.nonfpprinter); nonfpprinter.Text = settings.Printing.Nonfpprinter; //Save button clicked Button btnSave = FindViewById <Button>(Resource.Id.btnSave); btnSave.Click += delegate { //Remove keybord LinearLayout parentLayout = FindViewById <LinearLayout>(Resource.Id.parentLayout); parentLayout.RequestFocus(); InputMethodManager inputManager = (InputMethodManager)GetSystemService(Context.InputMethodService); inputManager.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways); //Set field values to settings object values //sales settings.Sales.Custflag = custflag.Checked; settings.Sales.Discustedit = discustedit.Checked; settings.Sales.Detailheader = detailheader.Checked; settings.Sales.Nullq = nullq.Checked; settings.Sales.Allpay = allpay.Checked; settings.Sales.Enableprice = enableprice.Checked; settings.Sales.Disabletran = disabletran.Checked; settings.Sales.Payforinv = payforinv.Checked; settings.Sales.Disabledownload = disabledownload.Checked; settings.Sales.TpId = tpid.Text; settings.Sales.Tp = tp.Text = settings.Sales.Tp; settings.Sales.Decimaldigit = Convert.ToInt32(Decimaldigit.Text); settings.Sales.Paydays = Convert.ToInt32(paydays.Text); //synchronization settings.Synchronization.Servicefiletransfer = servicefiletransfer.Checked; settings.Synchronization.TpId = tp_id.Text; settings.Synchronization.User = user.Text; settings.Synchronization.Psw = psw.Text; settings.Synchronization.Msellurl = msellurl.Text; settings.Synchronization.Msellurl2 = msellurl2.Text; settings.Synchronization.Server = server.Text; settings.Synchronization.Server2 = server2.Text; settings.Synchronization.Updir = updir.Text; settings.Synchronization.Getdir = getdir.Text; settings.Synchronization.Autoftp = autoftp.Checked; settings.Synchronization.Adminpass = adminpass.Text; //printing settings.Printing.Fpprinter = fpprinter.Checked; settings.Printing.Printer = printer.Text; settings.Printing.PrinterType = (PrinterType)printertype.SelectedItemPosition; settings.Printing.Secondinvoicecopy = secondinvoicecopy.Checked; settings.Printing.Wm = wm.Checked; settings.Printing.Nonfpprinter = nonfpprinter.Text; //Save settings object data into the xml file string xmlFilePath = Android.OS.Environment.ExternalStorageDirectory.ToString() + "/Settings4/settings4.xml"; XmlSerializer serializer = new XmlSerializer(typeof(Settings)); TextWriter textWriter = new StreamWriter(xmlFilePath); serializer.Serialize(textWriter, settings); textWriter.Close(); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ActionBar.Hide(); // hides the action bar // Create your application here SetContentView(Resource.Layout.LoginSignup); // sets the view to LoginSignup axml file loginButton = FindViewById <Button>(Resource.Id.LoginButton); // gets login button from view signupButton = FindViewById <Button>(Resource.Id.SignupButton); tfEmail = FindViewById <EditText>(Resource.Id.TFemail); tfPassword = FindViewById <EditText>(Resource.Id.TFpassword); forgotPassword = FindViewById <TextView>(Resource.Id.forgotpassword); Button devTools = FindViewById <Button>(Resource.Id.devTools); // initializes and gets button from view LinearLayout ll_main = FindViewById <LinearLayout>(Resource.Id.rootLayout); rememberMe = FindViewById <ImageView>(Resource.Id.rememberMe); TextView rememberMeText = FindViewById <TextView>(Resource.Id.rememberMeText); shouldRemember = false; ll_main.RequestFocus(); //InputMethodManager imm = (InputMethodManager)this.GetSystemService(Context.InputMethodService); //imm.HideSoftInputFromInputMethod(tfEmail.WindowToken, 0); rememberMe.Click += (sender, e) => { if (shouldRemember == false) { shouldRemember = true; rememberMe.SetImageResource(Resource.Drawable.radio_checked); } else if (shouldRemember == true) { shouldRemember = false; rememberMe.SetImageResource(Resource.Drawable.radio_unchecked); } }; rememberMeText.Click += (sender, e) => { if (shouldRemember == false) { shouldRemember = true; rememberMe.SetImageResource(Resource.Drawable.radio_checked); } else if (shouldRemember == true) { shouldRemember = false; rememberMe.SetImageResource(Resource.Drawable.radio_unchecked); } }; // Disable login button until username and password are entered loginButton.Enabled = false; // disables login button tfEmail.TextChanged += (sender, e) => // when you change the text of email text field { string username = tfEmail.Text; // new string called username is what is in the email text field string password = tfPassword.Text; // new string called password is what is in the password text field if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password)) // if either field is blank { loginButton.Enabled = false; // disable login button } else // otherwise { loginButton.Enabled = true; // enable login button } }; tfPassword.TextChanged += (sender, e) => // when you change the text of password text field { string username = tfEmail.Text; string password = tfPassword.Text; if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password)) { loginButton.Enabled = false; } else { loginButton.Enabled = true; } }; // Define what happens on "login" click loginButton.Click += LoginButton_Click; // calls login button click event // Define what happens on "forgot password" click forgotPassword.Click += (s, e) => // anonymous function { var forgotPasswordIntent = new Intent(this, typeof(passwordRecover)); // create new intent of type password recover StartActivity(forgotPasswordIntent); // start activity using intent }; // Define what happens on "sign up" click signupButton.Click += SignupButton_Click; // call sign up button click event devTools.Visibility = Android.Views.ViewStates.Invisible; devTools.Click += (s, e) => // anonymous function { var devToolsIntent = new Intent(this, typeof(devTools)); // create an intent of type devTools StartActivity(devToolsIntent); // start activity using intent }; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mContainer = container; string dbPath_attributes = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3"); var db_attributes = new SQLiteConnection(dbPath_attributes); myAttributes = db_attributes.Get <MyAttributes>(1); int myCFID = myAttributes.cfid; if (myCFID == 0) // If not registered for a career fair { View view = inflater.Inflate(Resource.Layout.GoToRegister, container, false); return(view); } else { if (myAttributes.type == "Student") { // Inflate View View view = inflater.Inflate(Resource.Layout.HomeTab, container, false); // Call UI Elements mListView = view.FindViewById <ListView>(Resource.Id.listView1); cfName = view.FindViewById <TextView>(Resource.Id.cfName); progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress); magGlass = view.FindViewById <ImageView>(Resource.Id.magGlass); mSearchField = view.FindViewById <EditText>(Resource.Id.searchCompanies); rootLayout = view.FindViewById <LinearLayout>(Resource.Id.rootLayout); swipeContainer = view.FindViewById <SwipeRefreshLayout>(Resource.Id.swipeLayout); magGlass.Enabled = false; mItems = new List <string>(); #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed LoadCF(true); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed bool searchFieldVisible = false; magGlass.Click += (sender, e) => { if (searchFieldVisible == false) { mSearchField.Visibility = ViewStates.Visible; cfName.Visibility = ViewStates.Invisible; searchFieldVisible = true; rootLayout.ClearFocus(); mSearchField.RequestFocus(); InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService); imm.ShowSoftInput(mSearchField, 0); } else if (searchFieldVisible == true) { InputMethodManager imm = (InputMethodManager)this.Activity.GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(mSearchField.WindowToken, 0); rootLayout.RequestFocus(); mSearchField.Visibility = ViewStates.Invisible; mSearchField.RequestFocus(); cfName.Visibility = ViewStates.Visible; searchFieldVisible = false; mAdapter = new CompaniesListViewAdapter(mContainer.Context, mItems, mFavList, mWaitTimes, mNumStudents, mCompanyIds); mListView.Adapter = mAdapter; } }; mSearchField.TextChanged += MSearchField_TextChanged; swipeContainer.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloRedLight); swipeContainer.Refresh += RefreshOnSwipe; return(view); } else if (myAttributes.type == "Recruiter") { View view = inflater.Inflate(Resource.Layout.RecruiterHomeTab, container, false); progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress); HMAllRadio = view.FindViewById <Button>(Resource.Id.HMAllRadio); HGTAllRadio = view.FindViewById <Button>(Resource.Id.HGTAllRadio); HGPANoneRadio = view.FindViewById <Button>(Resource.Id.HGPANoneRadio); plus_major = view.FindViewById <Button>(Resource.Id.plus_majors); hmspinner1 = view.FindViewById <Spinner>(Resource.Id.hmspinner1); hmspinner2 = view.FindViewById <Spinner>(Resource.Id.hmspinner2); hmspinner3 = view.FindViewById <Spinner>(Resource.Id.hmspinner3); hmspinner4 = view.FindViewById <Spinner>(Resource.Id.hmspinner4); hmspinner5 = view.FindViewById <Spinner>(Resource.Id.hmspinner5); minus_major = view.FindViewById <Button>(Resource.Id.minus_majors); hgtspinner1 = view.FindViewById <Spinner>(Resource.Id.hgtspinner1); hgtspinner2 = view.FindViewById <Spinner>(Resource.Id.hgtspinner2); hgtspinner3 = view.FindViewById <Spinner>(Resource.Id.hgtspinner3); plus_gt = view.FindViewById <Button>(Resource.Id.plus_gt); minus_gt = view.FindViewById <Button>(Resource.Id.minus_gradterms); minGPAspinner = view.FindViewById <Spinner>(Resource.Id.minGPAspinner); Button saveChanges = view.FindViewById <Button>(Resource.Id.saveChangesButton); cfName = view.FindViewById <TextView>(Resource.Id.cfName); TextView HMAllText = view.FindViewById <TextView>(Resource.Id.HMAllText); TextView HGTAllText = view.FindViewById <TextView>(Resource.Id.HGTAllText); TextView MinGPANoneText = view.FindViewById <TextView>(Resource.Id.MinGPANoneText); Android.Widget.Space plus1extender = view.FindViewById <Android.Widget.Space>(Resource.Id.plusspace1); Android.Widget.Space plus2extender = view.FindViewById <Android.Widget.Space>(Resource.Id.plusspace2); // Change name to my CF name PopulateName(); // Click methods HMAllRadio.Click += HMAllRadio_Click; HMAllText.Click += HMAllRadio_Click; HGTAllRadio.Click += HGTAllRadio_Click; HGTAllText.Click += HGTAllRadio_Click; HGPANoneRadio.Click += HGPANoneRadio_Click; MinGPANoneText.Click += HGPANoneRadio_Click; saveChanges.Click += SaveChanges_Click; // connect to firebase preferences database PopulatePreferences(); // On plus major click plus_major.Click += Plus_major_Click; plus1extender.Click += Plus_major_Click; // On plus gt click plus_gt.Click += Plus_gt_Click; plus2extender.Click += Plus_gt_Click; // on minus major click minus_major.Click += (sender, e) => { numMPs = numMPs - 1; if (numMPs == 1) { hmspinner2.Visibility = ViewStates.Gone; minus_major.Visibility = ViewStates.Gone; } else if (numMPs == 2) { hmspinner3.Visibility = ViewStates.Gone; } else if (numMPs == 3) { hmspinner4.Visibility = ViewStates.Gone; } else if (numMPs == 4) { hmspinner5.Visibility = ViewStates.Gone; } }; // on minus grad term click minus_gt.Click += (sender, e) => { numGTPs = numGTPs - 1; if (numGTPs == 1) { hgtspinner2.Visibility = ViewStates.Gone; minus_gt.Visibility = ViewStates.Gone; } else if (numGTPs == 2) { hgtspinner3.Visibility = ViewStates.Gone; } }; return(view); } else { throw new NotImplementedException(); } } }