// Sample code for building a localized ApplicationBar //private void BuildLocalizedApplicationBar() //{ // // Set the page's ApplicationBar to a new instance of ApplicationBar. // ApplicationBar = new ApplicationBar(); // // Create a new button and set the text value to the localized string from AppResources. // ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative)); // appBarButton.Text = AppResources.AppBarButtonText; // ApplicationBar.Buttons.Add(appBarButton); // // Create a new menu item with the localized string from AppResources. // ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText); // ApplicationBar.MenuItems.Add(appBarMenuItem); //} private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { var converter = new RomanNumeralConverter(); if (!String.IsNullOrEmpty(ArabicNumberText.Text)) { RomanNumberResult.Text = converter.NumberToRoman(Convert.ToInt32(ArabicNumberText.Text)); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); //var layout = new LinearLayout(this); //layout.Orientation = Orientation.Vertical; //var aLabel = new TextView(this); //aLabel.Text = "Please Enter an Arabic to Convert:"; //var arabicNumber = new EditText(this); //arabicNumber.SetHeight(50); //var romanResult = new TextView(this); //romanResult.SetHeight(50); //romanResult.SetTextSize(new ComplexUnitType(), 50); //var nrButton = new Button(this); //nrButton.Text = "Convert To Roman"; //layout.AddView(aLabel); //layout.AddView(arabicNumber); //layout.AddView(nrButton); //layout.AddView(romanResult); //SetContentView(layout); SetContentView(Resource.Layout.Main); var convertButton = FindViewById<Button>(Resource.Id.ConvertButton); var romanResult = FindViewById<TextView>(Resource.Id.romanResult); var arabicNumber = FindViewById<EditText>(Resource.Id.arabicNumber); convertButton.Click += (sender, e) => { var converter = new RomanNumeralConverter(); romanResult.Text = converter.NumberToRoman(Convert.ToInt32(arabicNumber.Text)); }; }