/// Method Name : SetEditModeViewSwitcherClick /// Author : Sanket Prajapati /// Creation Date : 2 Dec 2017 /// Purpose : Use for ViewSwitcher switch layout /// Revision : /// </summary> private void SetEditModeViewSwitcherClick() { tvUpdates.Click += delegate { if (ViewSwitcher.CurrentView == relativeLayoutDisplay) { ViewSwitcher.ShowNext(); tvback.Text = "Cancel"; tvNext.Text = "Next Step"; txtWMM.Text = tvWMMtitle.Text; } }; tvSubmitChanges.Click += delegate { if (ViewSwitcher.CurrentView == relativeLayoutEdit) { string strValidation = ValidationWMM(); if (string.IsNullOrEmpty(strValidation)) { ViewSwitcher.ShowPrevious(); tvback.Text = "Back"; tvNext.Text = "Yes, Captured Correctly"; tvWMMtitle.Text = txtWMM.Text; EditData(); } else { AlertMessage(strValidation); } } }; }
private void ImageViewNameEdit_Click(object sender, EventArgs e) { if (viewSwitcherName.CurrentView == linearLayoutDisplayName) { if (IsAdmin) { btnAudited.Visibility = ViewStates.Gone; viewSwitcherName.ShowNext(); viewSwitcherInfo.ShowNext(); } else { viewSwitcherName.ShowNext(); } } else { if (IsAdmin) { btnAudited.Visibility = ViewStates.Visible; viewSwitcherName.ShowPrevious(); viewSwitcherInfo.ShowPrevious(); } else { viewSwitcherName.ShowPrevious(); } } }
/// Method Name : SetEditModeViewSwitcherClick /// Author : Sanket Prajapati /// Creation Date : 2 Dec 2017 /// Purpose : Use for ViewSwitcher switch layout /// Revision : /// </summary> private void SetEditModeViewSwitcherClick() { tvUpdatedneedes.Click += delegate { if (viewSwitcher.CurrentView == linearLayoutDisplay) { viewSwitcher.ShowNext(); txtDeclaredvalue.Text = UtilityPCL.RemoveCurrencyFormat(tvDisplayDeclaredvalue.Text); var list = UtilityPCL.ValuationDeductibleList(); valuationDeductible = new ValuationDeductibleModel(); valuationDeductible = list.FirstOrDefault(rc => rc.DeductibleName == tvDisplayCoverage.Text); if (valuationDeductible != null) { spinnerCoverage.SetSelection(valuationDeductible.Index); } else { spinnerCoverage.SetSelection(1); } txtCost.Text = UtilityPCL.RemoveCurrencyFormat(tvDisplayCost.Text); tvBack.Text = StringResource.wizBtnCancel; tvNext.Text = StringResource.wizBtnNextStep; } }; tvSubmitChanges.Click += delegate { if (viewSwitcher.CurrentView == linearLayoutEdit && Validation()) { viewSwitcher.ShowPrevious(); tvDisplayDeclaredvalue.Text = UtilityPCL.CurrencyFormat(txtDeclaredvalue.Text); if (valuationDeductible != null) { tvDisplayCoverage.Text = valuationDeductible.DeductibleName; } else { var list = UtilityPCL.ValuationDeductibleList(); valuationDeductible = new ValuationDeductibleModel(); valuationDeductible = list.FirstOrDefault(rc => rc.DeductibleName == tvDisplayCoverage.Text); tvDisplayCoverage.Text = valuationDeductible.DeductibleName; } tvDisplayCost.Text = UtilityPCL.CurrencyFormat(txtCost.Text); EditData(); tvBack.Text = StringResource.wizBtnBack; tvNext.Text = StringResource.wizYesCapturedCorrectly; } }; }
private void SetNextFragmentClick() { tvNext.Click += delegate { string strValidation = ValidationAddress(); if (string.IsNullOrEmpty(strValidation)) { if (viewSwitcher.CurrentView == linearLayoutEdit) { viewSwitcher.ShowPrevious(); } ((ActivityEstimateViewPager)Activity).FragmentNext(); } else { AlertMessage(strValidation); } }; }
/// Method Name : SetEditModeViewSwitcherClick /// Author : Sanket Prajapati /// Creation Date : 2 Dec 2017 /// Purpose : Use for ViewSwitcher switch layout /// Revision : /// </summary> private void SetEditModeViewSwitcherClick() { tvChangeDates.Click += delegate { if (viewSwitcher.CurrentView == linearLayoutDisplay) { viewSwitcher.ShowNext(); tvDateEditPack.Text = tvDisplayPack.Text; tvDateEditLoad.Text = tvDisplayLoad.Text; tvDateEditMove.Text = tvDisplayMove.Text; tvback.Text = "Cancel"; tvNext.Text = "Next Step"; } }; tvSubmitChanges.Click += delegate { if (viewSwitcher.CurrentView == linearLayoutEdit) { string strValidate = ValidEditDate(false); if (string.IsNullOrEmpty(strValidate)) { viewSwitcher.ShowPrevious(); tvback.Text = "Back"; tvNext.Text = "Dates Are Accurate"; tvDisplayPack.Text = tvDateEditPack.Text; tvDisplayLoad.Text = tvDateEditLoad.Text; tvDisplayMove.Text = tvDateEditMove.Text; EditData(); } else { AlertMessage(strValidate); } } }; }
private async void GetData() { IPeopleRepository repository = PeopleRepository.Instance; try { IVoting glosowanie = await repository.GetSejmVoting(id); tvTytul.Text = glosowanie.Tytul; tvCzas.Text = glosowanie.Czas; if (glosowanie.Wynik == 2) { tvWynik.Text = "Ustawa Odrzucona"; tvWynik.SetTextColor(Android.Graphics.Color.ParseColor("#E00909")); } var glosy = glosowanie.Glosy; var glosyZa = glosy.Where(item => item.Glos == 1).ToList(); var glosyPrzeciw = glosy.Where(item => item.Glos == 2).ToList(); var glosyWstrzymalSie = glosy.Where(item => item.Glos == 3).ToList(); var glosyNieobecny = glosy.Where(item => item.Glos == 4).ToList(); fragmentsTabs.Add("Za (" + glosyZa.Count + ")", new VotingPeopleListFragment(glosyZa)); fragmentsTabs.Add("Przeciw (" + glosyPrzeciw.Count + ")", new VotingPeopleListFragment(glosyPrzeciw)); fragmentsTabs.Add("Wstrzymał się (" + glosyWstrzymalSie.Count + ")", new VotingPeopleListFragment(glosyWstrzymalSie)); fragmentsTabs.Add("Nieobecny (" + glosyNieobecny.Count + ")", new VotingPeopleListFragment(glosyNieobecny)); var tabs = Activity.FindViewById <com.refractored.PagerSlidingTabStrip> (Resource.Id.tabs); var pager = Activity.FindViewById <ViewPager> (Resource.Id.pager); tabs.ShouldExpand = false; pager.Adapter = new UniversalFragmentPagerAdapter(FragmentManager, fragmentsTabs); tabs.SetViewPager(pager); if (viewSwitcher.CurrentView != contentLayout) { viewSwitcher.ShowPrevious(); } } catch (ApiRequestException ex) { (Activity as BaseActivity).ShowErrorDialog(ex.Message); } catch (Exception exc) { //raportowanie błędów przy ładowaniu danych Xamarin.Insights.Report(exc); } }
private void ImageViewInfoEdit_Click(object sender, EventArgs e) { if (viewSwitcherInfo.CurrentView == linearLayoutDisplayInfo) { viewSwitcherInfo.ShowNext(); } else { viewSwitcherInfo.ShowPrevious(); } }
private async void GetData() { IBillsRepository repository = BillsRepository.Instance; try { var list = await repository.GetProjektyAktowPrawnychList(); newestList.Adapter = new ProjektyAktowPrawnychAdapter(this, list); if (viewSwitcher.CurrentView != newestList) { viewSwitcher.ShowPrevious(); } } catch (ApiRequestException ex) { this.ShowErrorDialog(ex.Message); } }
private async void GetSpeechData() { IPeopleRepository repository = PeopleRepository.Instance; try { speech = await repository.GetPoselSpeech(id); textView.TextFormatted = Html.FromHtml(speech.Tresc); if (viewSwitcher.CurrentView != contentLayout) { viewSwitcher.ShowPrevious(); } } catch (ApiRequestException ex) { (Activity as BaseActivity).ShowErrorDialog(ex.Message); } }
public override bool OnKeyUp(Keycode keyCode, KeyEvent e) { //При нажатии физической кнопки назад, возвращает на главный экран if (keyCode == Keycode.Back) { ViewSwitcher viewSwitcher = FindViewById <ViewSwitcher> (Resource.Id.viewSwitcher1); if (viewSwitcher.CurrentView != viewSwitcher.GetChildAt(0)) { viewSwitcher.ShowPrevious(); } return(true); } else { return(base.OnKeyUp(keyCode, e)); } }
private async void GetData() { IPeopleRepository repository = PeopleRepository.Instance; try { interpellation = await repository.GetPoselInterpellation(id); string text = interpellation.Teksty.First(); if (text != null) { text = "Brak tekstu interpelacji"; } textView.TextFormatted = Html.FromHtml(text); if (viewSwitcher.CurrentView != contentLayout) { viewSwitcher.ShowPrevious(); } } catch (ApiRequestException ex) { (Activity as BaseActivity).ShowErrorDialog(ex.Message); } }
private async void GetPoselData() { IPeopleRepository repository = PeopleRepository.Instance; try { posel = await repository.GetPosel(id); tvImie.Text = posel.Imie; tvNazwisko.Text = posel.Nazwisko; tvDataZawod.Text = String.Concat(posel.DataUrodzenia, ". ", posel.Zawod); tvPartiaOkreg.Text = String.Concat(posel.SejmKlubyNazwa, ". Okręg nr: ", posel.OkregWyborczyNumer); tvUstawy.Text = posel.LiczbaProjektowUstaw.ToString(); tvUchwaly.Text = posel.LiczbaProjektowUchwal.ToString(); tvFrekwencja.Text = String.Concat(posel.Frekwencja.ToString(), "%"); tvZamieszkanie.Text = posel.MiejsceZamieszkania; string imgUrl = posel.GetWebURL(); AQuery aq = new AQuery(Activity); Bitmap imgLoading = aq.GetCachedImage(Android.Resource.Drawable.IcMenuGallery); ((AQuery)aq.Id(Resource.Id.miniature)).Image(imgUrl, true, true, 0, 0, imgLoading, 0, 1f); //loadImage (ivMiniature, ); BiuroPoselskie biuroGlowne = posel.Biura.Where(item => item.Podstawowe.Equals("1")).FirstOrDefault(); if (biuroGlowne != null) { String phone = ""; try { String[] phones = biuroGlowne.Telefon.Split('f'); String[] phone1 = phones[0].Split(' '); String firstpart = phones[1].Split('(')[1].Split(')')[0]; phone = String.Concat(firstpart, " ", phone1[2].Replace('-', ' ')); }catch (Exception e) { Log.Error("PhoneParse", e.Message); phone = biuroGlowne.Telefon; } tvTelefon.Text = phone; tvTelefon.Click += delegate { var uri = Android.Net.Uri.Parse("tel:" + phone.Replace(" ", string.Empty)); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); }; tvEmail.Text = biuroGlowne.Email; } if (viewSwitcher.CurrentView != contentLayout) { viewSwitcher.ShowPrevious(); } } catch (ApiRequestException ex) { personDetailsActivity.ShowErrorDialog(ex.Message); } catch (Exception exc) { //raportowanie błędów przy ładowaniu danych Xamarin.Insights.Report(exc); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText(Resources.GetString(Resource.String.calcTab)); tab.TabSelected += (sender, args) => { // Do something when tab is selected }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText(Resources.GetString(Resource.String.convertTab)); tab.TabSelected += (sender, args) => { // Do something when tab is selected }; ActionBar.AddTab(tab); Button button0 = FindViewById <Button>(Resource.Id.Button0); Button button1 = FindViewById <Button>(Resource.Id.Button1); Button button2 = FindViewById <Button>(Resource.Id.Button2); Button button3 = FindViewById <Button>(Resource.Id.Button3); Button button4 = FindViewById <Button>(Resource.Id.Button4); Button button5 = FindViewById <Button>(Resource.Id.Button5); Button button6 = FindViewById <Button>(Resource.Id.Button6); Button button7 = FindViewById <Button>(Resource.Id.Button7); Button button8 = FindViewById <Button>(Resource.Id.Button8); Button button9 = FindViewById <Button>(Resource.Id.Button9); Button buttonAddition = FindViewById <Button>(Resource.Id.ButtonAdd); Button buttonDivision = FindViewById <Button>(Resource.Id.ButtonDiv); Button buttonFraction = FindViewById <Button>(Resource.Id.ButtonFraction); Button buttonMultiplication = FindViewById <Button>(Resource.Id.ButtonMulti); Button buttonNegation = FindViewById <Button>(Resource.Id.ButtonNegate); Button buttonSqrt = FindViewById <Button>(Resource.Id.ButtonSqrt); Button buttonSubstraction = FindViewById <Button>(Resource.Id.ButtonSub); Button buttonEqual = FindViewById <Button>(Resource.Id.ButtonEqual); Button buttonBackspace = FindViewById <Button>(Resource.Id.ButtonBackspace); Button buttonComma = FindViewById <Button>(Resource.Id.ButtonComma); Button buttonC = FindViewById <Button>(Resource.Id.ButtonC); TextView resultField = FindViewById <TextView>(Resource.Id.textView1); TextView txt = FindViewById <TextView>(Resource.Id.TextView); Button sin = FindViewById <Button>(Resource.Id.sin); Button asin = FindViewById <Button>(Resource.Id.asin); Button cos = FindViewById <Button>(Resource.Id.cos); Button acos = FindViewById <Button>(Resource.Id.acos); Button tan = FindViewById <Button>(Resource.Id.tan); Button atan = FindViewById <Button>(Resource.Id.atan); Button ctg = FindViewById <Button>(Resource.Id.ctg); Button actg = FindViewById <Button>(Resource.Id.actg); Button ln = FindViewById <Button>(Resource.Id.ln); // e Button log = FindViewById <Button>(Resource.Id.log); // 10 Button pi = FindViewById <Button>(Resource.Id.pi); Button exp = FindViewById <Button>(Resource.Id.exp); Button pov = FindViewById <Button>(Resource.Id.pov); Button rand = FindViewById <Button>(Resource.Id.rand); Button mod = FindViewById <Button>(Resource.Id.mod); Button div = FindViewById <Button>(Resource.Id.div); #region button[0-9] handlers button0.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Operator) { resultField.Text = ""; } resultField.Text += 0; _lastKeyInput = Keys.Digit; }; button1.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Operator) { resultField.Text = ""; } resultField.Text += 1; _lastKeyInput = Keys.Digit; }; button2.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Operator) { resultField.Text = ""; } resultField.Text += 2; _lastKeyInput = Keys.Digit; }; button3.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Operator) { resultField.Text = ""; } resultField.Text += 3; _lastKeyInput = Keys.Digit; }; button4.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Operator) { resultField.Text = ""; } resultField.Text += 4; _lastKeyInput = Keys.Digit; }; button5.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Operator) { resultField.Text = ""; } resultField.Text += 5; _lastKeyInput = Keys.Digit; }; button6.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Operator) { resultField.Text = ""; } resultField.Text += 6; _lastKeyInput = Keys.Digit; }; button7.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Operator) { resultField.Text = ""; } resultField.Text += 7; _lastKeyInput = Keys.Digit; }; button8.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Operator) { resultField.Text = ""; } resultField.Text += 8; _lastKeyInput = Keys.Digit; }; button9.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Operator) { resultField.Text = ""; } resultField.Text += 9; _lastKeyInput = Keys.Digit; }; #endregion buttonAddition.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Digit || _lastKeyInput == Keys.Sign) { parameters.Add(resultField.Text); txt.Text += resultField.Text + "+"; resultField.Text = ""; if (parameters.Count == 2) { double[] p = this.Parse(parameters); double r = op.Calculate(p); resultField.Text = r.ToString(); parameters.Clear(); parameters.Add(r.ToString()); } if (op == null || op.GetType() != typeof(Addition)) { op = new Addition(); } _lastKeyInput = Keys.Operator; return; } if (_lastKeyInput == Keys.Operator) { if (op == null || op.GetType() != typeof(Addition)) { op = new Addition(); txt.Text = ReplaceLastChar(txt.Text, '+'); } _lastKeyInput = Keys.Operator; } }; buttonSubstraction.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Digit || _lastKeyInput == Keys.Sign) { parameters.Add(resultField.Text); txt.Text += resultField.Text + "-"; resultField.Text = ""; if (parameters.Count == 2) { double[] p = this.Parse(parameters); double r = op.Calculate(p); resultField.Text = r.ToString(); parameters.Clear(); parameters.Add(r.ToString()); } if (op == null || op.GetType() != typeof(Subtraction)) { op = new Subtraction(); } _lastKeyInput = Keys.Operator; return; } if (_lastKeyInput == Keys.Operator) { if (op == null || op.GetType() != typeof(Subtraction)) { op = new Subtraction(); txt.Text = ReplaceLastChar(txt.Text, '-'); } _lastKeyInput = Keys.Operator; } }; buttonMultiplication.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Digit || _lastKeyInput == Keys.Sign) { parameters.Add(resultField.Text); txt.Text += resultField.Text + "*"; resultField.Text = ""; if (parameters.Count == 2) { double[] p = this.Parse(parameters); double r = op.Calculate(p); resultField.Text = r.ToString(); parameters.Clear(); parameters.Add(r.ToString()); } if (op == null || op.GetType() != typeof(Multiplication)) { op = new Multiplication(); } _lastKeyInput = Keys.Operator; return; } if (_lastKeyInput == Keys.Operator) { if (op == null || op.GetType() != typeof(Multiplication)) { op = new Multiplication(); txt.Text = ReplaceLastChar(txt.Text, '*'); } _lastKeyInput = Keys.Operator; } }; buttonDivision.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Digit || _lastKeyInput == Keys.Sign) { parameters.Add(resultField.Text); txt.Text += resultField.Text + "/"; resultField.Text = ""; if (parameters.Count == 2) { double[] p = this.Parse(parameters); double r = op.Calculate(p); resultField.Text = r.ToString(); parameters.Clear(); parameters.Add(r.ToString()); } if (op == null || op.GetType() != typeof(Division)) { op = new Division(); } _lastKeyInput = Keys.Operator; return; } if (_lastKeyInput == Keys.Operator) { if (op == null || op.GetType() != typeof(Division)) { op = new Division(); txt.Text = ReplaceLastChar(txt.Text, '/'); } _lastKeyInput = Keys.Operator; } }; buttonEqual.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Digit || _lastKeyInput == Keys.Sign) { parameters.Add(resultField.Text); txt.Text = string.Empty; if (parameters.Count == 2) { double r = op.Calculate(this.Parse(parameters)); resultField.Text = r.ToString(); } _lastKeyInput = Keys.Equal; return; } if (_lastKeyInput == Keys.Operator) { txt.Text = ""; resultField.Text = op.Calculate(double.Parse(parameters[0]), double.Parse(resultField.Text)).ToString(); parameters.Clear(); _lastKeyInput = Keys.Equal; return; } if (_lastKeyInput == Keys.Equal && op != null) { resultField.Text = op.Calculate(double.Parse(resultField.Text), double.Parse(resultField.Text)).ToString(); _lastKeyInput = Keys.Equal; } }; buttonNegation.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Digit || _lastKeyInput == Keys.Sign || _lastKeyInput == Keys.Equal) { //if (op == null || op.GetType() != typeof(Negation)) // op = new Negation(); resultField.Text = new Negation().Calculate(double.Parse(resultField.Text)).ToString(); //resultField.Text = op.Calculate(double.Parse(resultField.Text)).ToString(); _lastKeyInput = Keys.Sign; } }; buttonSqrt.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Digit || _lastKeyInput == Keys.Sign || _lastKeyInput == Keys.Equal) { resultField.Text = new Sqrt().Calculate(double.Parse(resultField.Text)).ToString(); } }; buttonFraction.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Digit || _lastKeyInput == Keys.Sign || _lastKeyInput == Keys.Equal) { resultField.Text = new Fraction().Calculate(double.Parse(resultField.Text)).ToString(); } }; buttonBackspace.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Digit || _lastKeyInput == Keys.Equal) { if (!(string.IsNullOrEmpty(resultField.Text))) { resultField.Text = resultField.Text.Substring(0, resultField.Text.Length - 1); } } }; buttonComma.Click += (object sender, EventArgs e) => { if (_lastKeyInput == Keys.Digit || _lastKeyInput == Keys.Sign || _lastKeyInput == Keys.Equal) { if (!(string.IsNullOrEmpty(resultField.Text))) { resultField.Text += '.'; _lastKeyInput = Keys.DecimalPoint; } else { resultField.Text += "0."; } } _lastKeyInput = Keys.DecimalPoint; }; buttonC.Click += (object sender, EventArgs e) => { op = null; resultField.Text = string.Empty; txt.Text = string.Empty; parameters.Clear(); }; ViewSwitcher viewSwitcher = FindViewById <ViewSwitcher>(Resource.Id.viewSwitcher); LinearLayout calcView1 = FindViewById <LinearLayout>(Resource.Id.calcView1); LinearLayout calcView2 = FindViewById <LinearLayout>(Resource.Id.calcView2); Button functions = FindViewById <Button>(Resource.Id.functions); Button standart = FindViewById <Button>(Resource.Id.standart); functions.Click += (object sender, EventArgs e) => { if (viewSwitcher.CurrentView != calcView2) { viewSwitcher.ShowNext(); } }; standart.Click += (object sender, EventArgs e) => { if (viewSwitcher.CurrentView == calcView2) { viewSwitcher.ShowPrevious(); } }; }