protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); try { button = FindViewById<Button>(Resource.Id.Submit); button.Click += new EventHandler(button_Click); States = FindViewById<Spinner>(Resource.Id.State); var fAdapter = ArrayAdapter.CreateFromResource(this, Resource.Array.states, Android.Resource.Layout.SimpleSpinnerDropDownItem); int spinner_dd_item = Android.Resource. Layout.SimpleSpinnerDropDownItem; fAdapter.SetDropDownViewResource(spinner_dd_item); States.Adapter = fAdapter; etAddress = FindViewById<EditText>(Resource.Id.Address); etCity = FindViewById<EditText>(Resource.Id.City); etZipCode = FindViewById<EditText>(Resource.Id.Zip); } catch (System.Exception sysExc) { Toast.MakeText(this, sysExc.Message, ToastLength.Short).Show(); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.ShareLocation); customDate = DateTime.Now; boxProgress = FindViewById<LinearLayout> (Resource.Id.boxProgress); boxProgress.Visibility = ViewStates.Gone; textDate = FindViewById<TextView> (Resource.Id.textDate); textDate.Visibility = ViewStates.Gone; spinnerTime = FindViewById<Spinner> (Resource.Id.spinnerTime); spinnerTime.ItemSelected += HandleItemSelected; arrayAdapter = ArrayAdapter.CreateFromResource (this, Resource.Array.expiration_time_array, Android.Resource.Layout.SimpleSpinnerItem); arrayAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerTime.Adapter = arrayAdapter; spinnerTime.SetSelection (defaultTimeIndex); selectedTime = timeValues [defaultTimeIndex]; shareButton = FindViewById<Button> (Resource.Id.buttonShare); shareButton.Click += HandleShareClick; textDate.Click += delegate { ShowDialog (0); }; }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.AddExpensePopUpLayout); SetCancelable (true); var save = (Button)FindViewById (Resource.Id.addExpenseSave); save.Enabled = !Assignment.IsHistory; save.SetOnClickListener (this); deleteExpense = (Button)FindViewById (Resource.Id.addExpenseDelete); deleteExpense.Enabled = !Assignment.IsHistory; deleteExpense.SetOnClickListener (this); var cancel = (Button)FindViewById (Resource.Id.addExpenseCancel); cancel.SetOnClickListener (this); expenseType = (Spinner)FindViewById (Resource.Id.addExpenseType); expenseDescription = (EditText)FindViewById (Resource.Id.addExpenseDescription); expenseDescription.Enabled = !Assignment.IsHistory; expenseAmount = (TextView)FindViewById (Resource.Id.addExpenseAmount); expenseAmount.Enabled = !Assignment.IsHistory; expensePhoto = (ImageView)FindViewById (Resource.Id.addExpenseImage); expenseAddPhoto = (Button)FindViewById (Resource.Id.addExpenseAddPhoto); expenseAddPhoto.Enabled = !Assignment.IsHistory; expenseAddPhoto.SetOnClickListener (this); var adapter = new SpinnerAdapter<ExpenseCategory> (expenseTypes, Context, Resource.Layout.SimpleSpinnerItem); adapter.TextColor = Color.Black; adapter.Background = Color.White; expenseType.Adapter = adapter; expenseType.Enabled = !Assignment.IsHistory; expenseType.OnItemSelectedListener = this; }
public override bool OnCreateOptionsMenu (Android.Views.IMenu menu) { MenuInflater.Inflate (Resource.Menu.main_screen, menu); _addAlarmMenuButton = menu.FindItem (Resource.Id.add_alarm); _acceptMenuButton = menu.FindItem (Resource.Id.accept); _alarmNameMenuItem = menu.FindItem (Resource.Id.alarm_name); _deleteAlarmMenuItem = menu.FindItem (Resource.Id.delete); _disableAlarmMenuItem = menu.FindItem (Resource.Id.switch_button); _alarmRadiusMenuItem = menu.FindItem (Resource.Id.alarm_radius); _settingsMenuItem = menu.FindItem (Resource.Id.action_settings); _alarmNameEditText = MenuItemCompat.GetActionView (_alarmNameMenuItem) as EditText; _alarmNameEditText.Hint = Resources.GetString (Resource.String.alarm_name); _alarmNameEditText.SetWidth (Resources.GetDimensionPixelSize (Resource.Dimension.abc_search_view_preferred_width)); _enableAlarmToggleButton = MenuItemCompat.GetActionView (_disableAlarmMenuItem) as ToggleButton; _enableAlarmToggleButton.CheckedChange += AlarmEnabledChange; _alarmRadiusSpinner = MenuItemCompat.GetActionView (_alarmRadiusMenuItem) as Spinner; var adapter = new ArrayAdapter (this, Resource.Layout.support_simple_spinner_dropdown_item, Android.Resource.Id.Text1, Constants.AlarmRadiusValues.Select (r => string.Format ("{0} m", r)).ToList ()); adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); _alarmRadiusSpinner.Adapter = adapter; _alarmRadiusSpinner.ItemSelected += (s, e) => RedrawAddCircle (); ManageMenuItemsVisibilityForMode (); _addAlarmMenuButton.SetVisible (_isGooglePlayServicesAvailable == ConnectionResult.Success); return base.OnCreateOptionsMenu (menu); }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); mHandler = new Handler (); // Inflate our UI from its XML layout description. SetContentView (Resource.Layout.voice_recognition); // Get display items for later interaction Button speakButton = FindViewById <Button> (Resource.Id.btn_speak); mList = FindViewById <ListView> (Resource.Id.list); mSupportedLanguageView = FindViewById <Spinner> (Resource.Id.supported_languages); // Check to see if a recognition activity is present PackageManager pm = PackageManager; IList<ResolveInfo> activities = pm.QueryIntentActivities (new Intent (RecognizerIntent.ActionRecognizeSpeech), 0); if (activities.Count != 0) speakButton.Click += speakButton_Click; else { speakButton.Enabled = false; speakButton.Text = "Recognizer not present"; } // Most of the applications do not have to handle the voice settings. If the application // does not require a recognition in a specific language (i.e., different from the system // locale), the application does not need to read the voice settings. RefreshVoiceSettings(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetContentView (Resource.Layout.CreateInvoice); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE; branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE; EventManagerFacade.Instance.GetEventManager().AddListener(this); // Create your application here _date = DateTime.Today; spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Spinner spinnerType = FindViewById<Spinner> (Resource.Id.newinv_type); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); Button butNew = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butNew.Click += butCancelClick; TextView invno = FindViewById<TextView> (Resource.Id.newinv_no); invno.Text = "AUTO"; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); trxdate.Text = _date.ToString ("dd-MM-yyyy"); trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog (0); }; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; ccType = FindViewById<EditText> (Resource.Id.newinv_cctype); ccNo = FindViewById<EditText> (Resource.Id.newinv_ccno); ccNo.AfterTextChanged+= CcNo_AfterTextChanged; ccNo.RequestFocus (); apara = DataHelper.GetAdPara (pathToDatabase,compCode,branchCode); //SqliteConnection.CreateFile(pathToDatabase); LoadTrader (); List<string> icodes = new List<string> (); foreach (Trader item in items) { icodes.Add (item.CustCode+" | "+item.CustName); } dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes); dataAdapter2 =ArrayAdapter.CreateFromResource ( this, Resource.Array.trxtype, Resource.Layout.spinner_item); // Drop down layout style - list view with radio button dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // attaching data adapter to spinner spinner.Adapter =dataAdapter; spinnerType.Adapter =dataAdapter2; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView(Resource.Layout.SettingsScreen); themeSpinner = FindViewById<Spinner> (Resource.Id.ThemeSpinner); fontSizeSpinner = FindViewById<Spinner> (Resource.Id.FontSizeSpinner); selectedTheme = Convert.ToInt32 (prefs.GetString (ThemeKey, "0")); selectedFontSize = Convert.ToInt32 (prefs.GetString (FontSizeKey, "0")); themeSpinner.ItemSelected += ThemeSpinner_ItemSelected; var adapter = ArrayAdapter.CreateFromResource ( this, Resource.Array.themes, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); themeSpinner.Adapter = adapter; fontSizeSpinner.ItemSelected += FontSizeSpinner_ItemSelected; adapter = ArrayAdapter.CreateFromResource ( this, Resource.Array.font_sizes, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); fontSizeSpinner.Adapter = adapter; themeSpinner.SetSelection (selectedTheme); fontSizeSpinner.SetSelection (selectedFontSize); }
protected async override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.view_expense); dialog = ServiceContainer.Resolve<IMessageDialog>(); var id = Intent.GetIntExtra("ID", -1); viewModel = ServiceContainer.Resolve<ExpenseViewModel>(); await viewModel.Init(id); this.ActionBar.Title = viewModel.Title; viewModel.IsBusyChanged = (busy) => { if (busy) AndHUD.Shared.Show(this, "Loading..."); else AndHUD.Shared.Dismiss(this); }; name = FindViewById<EditText>(Resource.Id.name); date = FindViewById<DatePicker>(Resource.Id.date); notes = FindViewById<EditText>(Resource.Id.notes); total = FindViewById<EditText>(Resource.Id.total); billable = FindViewById<CheckBox>(Resource.Id.billable); category = FindViewById<Spinner>(Resource.Id.category); category.Adapter = new ArrayAdapter<string>(this, global::Android.Resource.Layout.SimpleSpinnerDropDownItem, viewModel.Categories); category.SetSelection(viewModel.Categories.IndexOf(viewModel.Category)); name.Text = viewModel.Name; date.DateTime = viewModel.Due; notes.Text = viewModel.Notes; total.Text = viewModel.Total; billable.Checked = viewModel.Billable; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); base.OnCreateView (inflater, container, savedInstanceState); Dialog.SetCanceledOnTouchOutside (true); View view = inflater.Inflate (Resource.Layout.RoutDialog, container, false); tvSearchPhrase = view.FindViewById <TextView> (Resource.Id.rdSearchPhrase); tvSearchPhrase.TextChanged += SearchPhrase_TextChanged; tvDanger = view.FindViewById <TextView> (Resource.Id.rdDangerText); tvSuccess = view.FindViewById <TextView> (Resource.Id.rdSuccessText); btnPick = view.FindViewById <Button> (Resource.Id.rdPick); btnPick.Click += (object sender, EventArgs e) => { if (position != -1) { Arguments.PutInt(PHARMACY_ID, pharmacies[position].id); OnAfterPick(EventArgs.Empty); Dismiss(); } }; llDanger = view.FindViewById <LinearLayout> (Resource.Id.rdDangerLayout); llSuccess = view.FindViewById <LinearLayout> (Resource.Id.rdSuccessLayout); spnPharmacyPicker = view.FindViewById <Spinner> (Resource.Id.rdPharmacyPicker); spnPharmacyPicker.ItemSelected += PharmacyPicker_ItemSelected; return view; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.SpeedBetweenNodes); settingsFile = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); settingsFile = Path.Combine(settingsFile, "settings.txt"); settings = JsonConvert.DeserializeObject<SettingsRecord> (File.ReadLines (settingsFile).First()); speedSpinner = FindViewById<Spinner> (Resource.Id.speedSpinner); speedSpinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (speedSpinner_ItemSelected); var adapter = ArrayAdapter.CreateFromResource (this, Resource.Array.speed_array, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); speedSpinner.Adapter = adapter; speedSpinner_Initialize (); btnApply = FindViewById<Button>(Resource.Id.btnApply2); btnApply.Click += delegate { if (settingsChanged()){ using (TextWriter tw = new StreamWriter(settingsFile,false)){ tw.WriteLine (JsonConvert.SerializeObject (settings)); } if(isLoggerRunning()){ restartLogger(); } } Finish(); }; }
public override void OnViewCreated (View view, Bundle savedInstanceState) { base.OnViewCreated (view, savedInstanceState); productImage = View.FindViewById<ImageView> (Resource.Id.productImage); sizeSpinner = View.FindViewById<Spinner> (Resource.Id.productSize); colorSpinner = View.FindViewById<Spinner> (Resource.Id.productColor); var addToBasket = View.FindViewById<Button> (Resource.Id.addToBasket); addToBasket.Click += delegate { currentProduct.Size = currentProduct.Sizes [sizeSpinner.SelectedItemPosition]; currentProduct.Color = currentProduct.Colors [colorSpinner.SelectedItemPosition]; shouldAnimatePop = true; Activity.FragmentManager.PopBackStack(); AddToBasket (currentProduct); }; View.FindViewById<TextView> (Resource.Id.productTitle).Text = currentProduct.Name ?? string.Empty; View.FindViewById<TextView> (Resource.Id.productPrice).Text = currentProduct.PriceDescription ?? string.Empty; View.FindViewById<TextView> (Resource.Id.productDescription).Text = currentProduct.Description ?? string.Empty; ((SlidingLayout)View).InitialMainViewDelta = slidingDelta; LoadOptions (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetTitle (Resource.String.mainmenu_settings); SetContentView (Resource.Layout.AdPara); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; rights = Utility.GetAccessRights (pathToDatabase); spinPrType= FindViewById<Spinner> (Resource.Id.txtprintertype); spinner = FindViewById<Spinner> (Resource.Id.txtSize); spinBt= FindViewById<Spinner> (Resource.Id.txtprinters); Button butSave = FindViewById<Button> (Resource.Id.ad_bSave); Button butCancel = FindViewById<Button> (Resource.Id.ad_Cancel); FindControls (); butSave.Click += butSaveClick; butCancel.Click += butCancelClick; findBTPrinter (); //RunOnUiThread(()=>{ findBTPrinter ();}); adapterPT = ArrayAdapter.CreateFromResource (this, Resource.Array.printer_array, Android.Resource.Layout.SimpleSpinnerItem); adapterPT.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); adapter = ArrayAdapter.CreateFromResource (this, Resource.Array.papersize_array, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); spinPrType.Adapter = adapterPT; spinner.Adapter = adapter; spinner.ItemSelected+= Spinner_ItemSelected; spinBt.ItemSelected+= Spinner_ItemSelected; LoadData (); // Create your application here }
//AccessRights rights; protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetTitle (Resource.String.title_sonew); SetContentView (Resource.Layout.CreateSO); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; //rights = Utility.GetAccessRights (pathToDatabase); apara = DataHelper.GetAdPara (pathToDatabase); // Create your application here _date = DateTime.Today; spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); spinnerBill = FindViewById<Spinner> (Resource.Id.newinv_billto); TextView lbBillto = FindViewById<TextView> (Resource.Id.lbbillto); lbBillto.Text = "PAY FROM"; Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); Button butNew = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); Button butBillFind = FindViewById<Button> (Resource.Id.newinv_billfind); //spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); //spinnerBill.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butNew.Click += butCancelClick; TextView invno = FindViewById<TextView> (Resource.Id.newinv_no); invno.Text = "AUTO"; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); trxdate.Text = _date.ToString ("dd-MM-yyyy"); trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog (0); }; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; butBillFind.Click+= (object sender, EventArgs e) => { ShowBillToLookUp(); }; //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table<Trader> ().ToList<Trader> (); } var icodes = GetCustCode (IsValidCustTo); var icodes2 = GetCustCode (IsValidBillTo); dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter =dataAdapter; dataAdapter2 = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes2); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerBill.Adapter =dataAdapter2; }
/// <summary> /// Starts the current <c>Activity</c> /// </summary> /// <param name="bundle">Bundle.</param> protected override void OnCreate (Bundle bundle) { // Attempt to attach to the Google Play Service StartSetup (); // Do the base setup base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); // Attach to the GUI elements _produtctSpinner = FindViewById<Spinner> (Resource.Id.productSpinner); _buyButton = FindViewById<Button> (Resource.Id.buyButton); _lvPurchsedItems = FindViewById<ListView> (Resource.Id.purchasedItemsList); // Configure buy button _buyButton.Click += (sender, e) => { // Ask the open connection's billing handler to purchase the selected product if (_selectedProduct!=null) _serviceConnection.BillingHandler.BuyProduct(_selectedProduct); }; // Configure the purchased items list _lvPurchsedItems.OnItemClickListener = this; // Configure the available product spinner _produtctSpinner.Enabled = false; _produtctSpinner.OnItemSelectedListener = this; // Initialize the list of available items _products = new List<Product> (); }
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; }
public override View GetPropertyWindowLayout (Android.Content.Context context) { gridlayout = new GridLayout (context); gridlayout.RowCount = 2; gridlayout.ColumnCount = 2; conditionTextView = new TextView (context); conditionTextView.Text = "Select the Condition to filter"; columnTextView = new TextView (context); columnTextView.Text = "Select the Column to filter"; columnDropdown = new Spinner(context); var columnAdapter = ArrayAdapter.CreateFromResource (context, Resource.Array.column_array, Android.Resource.Layout.SimpleSpinnerItem); columnAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); columnDropdown.Adapter = columnAdapter; conditionDropdown = new Spinner (context); condtionAdapter = new ArrayAdapter (context, Android.Resource.Layout.SimpleSpinnerItem); condtionAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); conditionDropdown.Adapter = condtionAdapter; columnDropdown.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (OnColumnSelected); conditionDropdown.ItemSelected += OnConditionSelected; gridlayout.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); gridlayout.AddView (columnTextView); gridlayout.AddView (columnDropdown); gridlayout.AddView (conditionTextView); gridlayout.AddView (conditionDropdown); return gridlayout; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE; branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE; SetContentView (Resource.Layout.AdPara); spinner = FindViewById<Spinner> (Resource.Id.txtSize); spinBt= FindViewById<Spinner> (Resource.Id.txtprinters); Button butSave = FindViewById<Button> (Resource.Id.ad_bSave); Button butCancel = FindViewById<Button> (Resource.Id.ad_Cancel); butSave.Click += butSaveClick; butCancel.Click += butCancelClick; RunOnUiThread(()=>{ findBTPrinter ();}); adapter = ArrayAdapter.CreateFromResource (this, Resource.Array.papersize_array, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = adapter; spinner.ItemSelected+= Spinner_ItemSelected; spinBt.ItemSelected+= Spinner_ItemSelected; LoadData (); // Create your application here }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); dataProvider = new DataProvider(XDocument.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream("Lines.xml")), XDocument.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream("Stations.xml")), XDocument.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream("StationLines.xml"))); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); spinnerLine = FindViewById<Spinner>(Resource.Id.spinnerLine); spinnerStationFrom = FindViewById<Spinner>(Resource.Id.spinnerStationFrom); spinnerStationTo = FindViewById<Spinner>(Resource.Id.spinnerStationTo); Button buttonSwap = FindViewById<Button>(Resource.Id.buttonSwap); buttonSwap.Click += new EventHandler(swapDirection); Button buttonSave = FindViewById<Button>(Resource.Id.buttonSave); buttonSave.Click += new EventHandler(SaveSettings); Button buttonSearch = FindViewById<Button>(Resource.Id.buttonSearch); buttonSearch.Click += new EventHandler(lookup); SetUpLine(); SetUpStationFrom(); SetUpStationTo(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); button = FindViewById<Button> (Resource.Id.button); button.Click += (o, e) => { // use an array adapter to populate a spinner item from our string array ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleSpinnerItem, villains); // create the spinner and populate it with our items Spinner spinner = new Spinner(this); spinner.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); spinner.Adapter = adapter; // handle item selection spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (ItemSelected); // build the alert dialog AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetView(spinner); builder.SetNeutralButton("OK", delegate {}); builder.Show(); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); this.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait; // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // this.layout = FindViewById<LinearLayout> (Resource.Id.layout); this.buttonAdd = FindViewById<Button>(Resource.Id.buttonAdd); this.textLastText = FindViewById<TextView> (Resource.Id.textLastText); this.textLastCheck = FindViewById<TextView> (Resource.Id.textLastCheck); this.spinner = FindViewById<Spinner> (Resource.Id.spinnerView); this.listView = FindViewById<ListView> (Resource.Id.listView1); // this.listView = new EditableTextTable (this); // this.layout.AddView (this.listView); EditableTextViewModel.Instance.Items.SetCellProvider ( this.listView, new TableCellDelegate<EditableText> (this.GetView)); EditableTextViewModel.Instance.Items.SetProvider (this.spinner, new DropDownCellDelegate<EditableText> (this.GetView)); this.buttonAdd.Click += (sender, e) => EditableTextViewModel.Instance.AddItem (new EditableText ()); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.CreateEmployee); _supporttoolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.ToolBar); _drawer = FindViewById<DrawerLayout>(Resource.Id.DrawerLayout); _navigationview = FindViewById<NavigationView>(Resource.Id.nav_view); ToolbarCreator toolbarCreator = new ToolbarCreator(); toolbarCreator.setupToolbar(_supporttoolbar, _drawer, _navigationview, Resource.String.createemployee, this); BtnCreateEmployee = FindViewById<Button>(Resource.Id.ButtonCreateEmployee); EditTextFirstName = FindViewById<EditText>(Resource.Id.EditTextFirstName); EditTextLastName = FindViewById<EditText>(Resource.Id.EditTextLastName); EditTextEmployeeID = FindViewById<EditText>(Resource.Id.EditTextEmployeeID); EditTextEmail = FindViewById<EditText>(Resource.Id.EditTextEmail); SpinnerDepartment = FindViewById<Spinner>(Resource.Id.SpinnerDepartment); SpinnerPrivledge = FindViewById<Spinner>(Resource.Id.SpinnerPrivledgeLevel); Color color = new Color(ContextCompat.GetColor(this, Resource.Color.black)); SpinnerDepartment.Background.SetColorFilter(color,PorterDuff.Mode.SrcAtop); SpinnerPrivledge.Background.SetColorFilter(color, PorterDuff.Mode.SrcAtop); BtnCreateEmployee.Click += async delegate { BtnCreateEmployee.Enabled = false; await createEmployee(); BtnCreateEmployee.Enabled = true; }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetContentView (Resource.Layout.CreateDO); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE; branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE; DONO = Intent.GetStringExtra ("dono") ?? "AUTO"; doInfo =DataHelper.GetDelOrder (pathToDatabase, DONO, compCode, branchCode); if (doInfo == null) { base.OnBackPressed (); } // Create your application here _date = DateTime.Today; spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); Button butCancel = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); butSave.Text = "SAVE"; spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butCancel.Click += butCancelClick; TextView invno = FindViewById<TextView> (Resource.Id.newinv_no); invno.Enabled = false; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog (0); }; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; apara = DataHelper.GetAdPara (pathToDatabase,compCode,branchCode); //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table<Trader> ().Where(x=>x.CompCode==compCode&&x.BranchCode==branchCode).ToList<Trader> (); } List<string> icodes = new List<string> (); foreach (Trader item in items) { icodes.Add (item.CustCode+" | "+item.CustName); } dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes); dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); spinner.Adapter =dataAdapter; LoadData (); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // Currently in a layout without a container, so no reason to create our view. return null; } var scroller = new ScrollView(Activity); var llayout = new LinearLayout (Activity); llayout.Orientation = Orientation.Vertical; var text = new TextView(Activity); var padding = Convert.ToInt32(TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Activity.Resources.DisplayMetrics)); text.SetPadding(padding, padding, padding, padding); text.TextSize = 24; var doc = DoctorManager.GetDoctor (ShownPlayId); var hosp = HospitalManager.GetHospital (doc.HospitalID); text.Text = "Фамилия: " + doc.FirstName + "\n\n" + "Имя: " + doc.SecondName + "\n\n" + "Отчество: " + doc.ThirdName + "\n\n" + "Больница: " + hosp.Name + "\n\n" + "Адрес: " + hosp.Adress; //Shakespeare.Dialogue[ShownPlayId]; llayout.AddView(text); Spinner spn = new Spinner (Activity); var preses = Presentations.GetPresentations (); List<String> presentsTitle = new List<String>(); for (int i = 0; i < preses.Count; i++) { for (int j = 0; j < preses[i].parts.Count; j++) { presentsTitle.Add (preses [i].name + "." + preses [i].parts [j].name); } } spn.Adapter = new ArrayAdapter<String>(Activity, Android.Resource.Layout.SimpleListItemChecked, presentsTitle.ToArray()); llayout.AddView(spn); Button btnSlide = new Button (Activity); btnSlide.Text = "Начать показ!"; btnSlide.Click += (sender, e) => { var slides = new Intent ( Activity, typeof(PresentationView)); int presentationID = 0; int partID = spn.SelectedItemPosition; for (int i=0; (i <= preses.Count-1) && (partID > preses[i].parts.Count-1); i++){ presentationID = i+1; partID = partID - preses [i].parts.Count; } slides.PutExtra ("presentationID", presentationID); slides.PutExtra ("partID", partID); slides.PutExtra ("doctorID", ShownPlayId); StartActivity (slides); }; llayout.AddView (btnSlide); scroller.AddView (llayout); return scroller; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetContentView (Resource.Layout.CreateInvoice); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; INVOICENO = Intent.GetStringExtra ("invoiceno") ?? "AUTO"; invInfo =DataHelper.GetInvoice (pathToDatabase, INVOICENO); if (invInfo == null) { base.OnBackPressed (); } // Create your application here spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Spinner spinnerType = FindViewById<Spinner> (Resource.Id.newinv_type); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); butSave.Text = "SAVE"; Button butCancel = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butCancel.Click += butCancelClick; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog (0); }; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; apara = DataHelper.GetAdPara (pathToDatabase); LoadTrader (); List<string> icodes = new List<string> (); foreach (Trader item in custs) { icodes.Add (item.CustCode+" | "+item.CustName); } dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes); dataAdapter2 =ArrayAdapter.CreateFromResource ( this, Resource.Array.trxtype, Resource.Layout.spinner_item); //dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // attaching data adapter to spinner spinner.Adapter =dataAdapter; spinnerType.Adapter =dataAdapter2; LoadData (); }
static System.Threading.Thread LoadThread; //Поток, отвечающий за загрузку расписания protected override void OnCreate (Bundle bundle) { context = this; groups = Resources.GetTextArray (Resource.Array.group_codes); base.OnCreate (bundle); SetContentView (Resource.Layout.Main); //RequestWindowFeature (WindowFeatures.NoTitle); text = FindViewById<TextView> (Resource.Id.text); Button today = FindViewById<Button> (Resource.Id.today); Button tomorrow = FindViewById<Button> (Resource.Id.tomorrow); Button OnDate = FindViewById<Button> (Resource.Id.toDate); spinner = FindViewById<Spinner> (Resource.Id.spinner1); viewSwitcher = FindViewById<ViewSwitcher> (Resource.Id.viewSwitcher1); DateTime dateToday = DateTime.Today; DateTime dateTomorrow = DateTime.Today.AddDays (1); DatePicker datePicker = FindViewById<DatePicker> (Resource.Id.datePicker); ConnectivityManager cm = (ConnectivityManager)GetSystemService (Context.ConnectivityService); spinner.SetSelection (loadingGroup ()); //Обработчики нажатий кнопок today.Click += delegate { //На сегодня savingGroup (spinner.SelectedItemPosition); if (cm.ActiveNetworkInfo != null) { //Если присутствует соединение с интернетом - запустить функцию, StartLoadingThread (dateToday);// получающую расписание с сайта } else { text.Text = "Проверьте соединение с интернетом";//Иначе, выводит ошибку viewSwitcher.ShowNext (); } }; tomorrow.Click += delegate { //На завтра savingGroup (spinner.SelectedItemPosition); if (cm.ActiveNetworkInfo != null) { StartLoadingThread (dateTomorrow); } else { text.Text = "Проверьте соединение с интернетом"; viewSwitcher.ShowNext (); } }; OnDate.Click += delegate {//На дату savingGroup (spinner.SelectedItemPosition); if (cm.ActiveNetworkInfo != null) { StartLoadingThread (datePicker.DateTime); } else { text.Text = "Проверьте соединение с интернетом"; viewSwitcher.ShowNext (); } }; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = (View) inflater.Inflate(Resource.Layout.ShiPinChaGangSouSuo,container, false); mSpinnerSP = view.FindViewById<Spinner> (Resource.Id.spinnerShiPinChaGang); mbtnBeginDate = view.FindViewById<Button> (Resource.Id.ShiPinChaGangBeginDate); mbtnEndDate = view.FindViewById<Button> (Resource.Id.ShiPinChaGangEndDate); mSearchSP = view.FindViewById<Button> (Resource.Id.btnShiPinChaGangSouSuo); mSpinnerSP.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); var adapter = ArrayAdapter.CreateFromResource ( Activity, Resource.Array.ShiPinChaGangZhuangTai, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); mSpinnerSP.Adapter = adapter; mbtnBeginDate.Click += delegate { clickFlag=0; var dialogShow = new DatePickerDialogFragment(Activity, BeginDate,this); dialogShow.Show(Activity.FragmentManager.BeginTransaction(), null); }; mbtnEndDate.Click += delegate { clickFlag=1; var dialogShow = new DatePickerDialogFragment(Activity, BeginDate,this); dialogShow.Show(Activity.FragmentManager.BeginTransaction(), null); }; mSearchSP.Click += delegate { var ft1=this.FragmentManager.BeginTransaction (); ft1.SetCustomAnimations(Resource.Animation.card_flip_right_in, Resource.Animation.card_flip_right_out, Resource.Animation.card_flip_left_in, Resource.Animation.card_flip_left_out); var fragment =ShiPinChaGangSouSuoJieGuo.NewInstance(mSpinner,mBeginDate,mEndDate); mSpinner=""; mBeginDate=""; mEndDate=""; ft1.Hide (fragment); ft1.Replace (Resource.Id.content_frame, fragment,"ShiPinSouSuojieguo"); ft1.AddToBackStack (null); ft1.Show (fragment); ft1.Commit (); }; return view; }
private int GetSpinnerPosition(Spinner spinner, string key) { for (var i = 0; i < spinner.Count; i++) { var item = (string)spinner.GetItemAtPosition(i); if (key.Equals(item)) return i; } return -1; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetContentView (Resource.Layout.CreateCNote); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE; branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE; // Create your application here _date = DateTime.Today; spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); Button butNew = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); Button butFindInv = FindViewById<Button> (Resource.Id.newinv_bfindinv); spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butNew.Click += butCancelClick; TextView cnno = FindViewById<TextView> (Resource.Id.newinv_no); cnno.Text = "AUTO"; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); trxdate.Text = _date.ToString ("dd-MM-yyyy"); trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog (0); }; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; butFindInv.Click+= (object sender, EventArgs e) => { ShowInvLookUp(); }; apara = DataHelper.GetAdPara (pathToDatabase,compCode,branchCode); //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table<Trader> ().Where(x=>x.CompCode==compCode&&x.BranchCode==branchCode).ToList<Trader> (); } List<string> icodes = new List<string> (); foreach (Trader item in items) { icodes.Add (item.CustCode+" | "+item.CustName); } dataAdapter = new ArrayAdapter<String>(this,Resource.Layout.spinner_item, icodes); // Drop down layout style - list view with radio button dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // attaching data adapter to spinner spinner.Adapter =dataAdapter; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_custom); _progressBar = FindViewById<SmoothProgressBar>(Resource.Id.progressbar); _checkBoxMirror = FindViewById<CheckBox>(Resource.Id.checkbox_mirror); _checkBoxReversed = FindViewById<CheckBox>(Resource.Id.checkbox_reversed); _spinnerInterpolators = FindViewById<Spinner>(Resource.Id.spinner_interpolator); _seekBarSectionsCount = FindViewById<SeekBar>(Resource.Id.seekbar_sections_count); _seekBarStrokeWidth = FindViewById<SeekBar>(Resource.Id.seekbar_stroke_width); _seekBarSeparatorLength = FindViewById<SeekBar>(Resource.Id.seekbar_separator_length); _seekBarSpeed = FindViewById<SeekBar>(Resource.Id.seekbar_speed); _button = FindViewById<Button>(Resource.Id.button); _textViewSpeed = FindViewById<TextView>(Resource.Id.textview_speed); _textViewSectionsCount = FindViewById<TextView>(Resource.Id.textview_sections_count); _textViewSeparatorLength = FindViewById<TextView>(Resource.Id.textview_separator_length); _textViewStrokeWidth = FindViewById<TextView>(Resource.Id.textview_stroke_width); _seekBarSpeed.ProgressChanged += (s, e) => { _speed = ((float) e.Progress + 1) / 10; _textViewSpeed.Text = "Speed: " + _speed; }; _seekBarSectionsCount.ProgressChanged += (s, e) => { _sectionsCount = e.Progress + 1; _textViewSectionsCount.Text = "Sections count: " + _sectionsCount; }; _seekBarSeparatorLength.ProgressChanged += (s, e) => { _separatorLength = e.Progress; _textViewSeparatorLength.Text = string.Format("Separator length: {0}dp", _separatorLength); }; _seekBarStrokeWidth.ProgressChanged += (s, e) => { _strokeWidth = e.Progress; _textViewStrokeWidth.Text = string.Format("Stroke width: {0}dp", _strokeWidth); }; _seekBarSeparatorLength.Progress = 4; _seekBarSectionsCount.Progress = 4; _seekBarStrokeWidth.Progress = 4; _seekBarSpeed.Progress = 9; _spinnerInterpolators.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, Resources.GetStringArray(Resource.Array.interpolators)); _button.Click += (s, e) => SetValues(); }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.new_entry); BKM = BookKeeperManager.Instance; RadioButton incomeRb = FindViewById<RadioButton> (Resource.Id.income); RadioButton expenseRb = FindViewById<RadioButton> (Resource.Id.expense); typeSp = FindViewById<Spinner> (Resource.Id.type_spinner); incomeRb.Click += delegate { inOut="income"; ArrayAdapter typeAdapter = new ArrayAdapter (this,Android.Resource.Layout.SimpleSpinnerDropDownItem,BKM.IncomeAccounts); typeSp.Adapter = typeAdapter; }; expenseRb.Click += delegate { inOut="expense"; ArrayAdapter typeAdapter = new ArrayAdapter (this,Android.Resource.Layout.SimpleSpinnerDropDownItem,BKM.ExpenseAccounts); typeSp.Adapter = typeAdapter; }; typeSp.ItemSelected += delegate { type = typeSp.SelectedItem.ToString(); }; Spinner moneyAccountSp = FindViewById<Spinner> (Resource.Id.to_from_spinner); ArrayAdapter maAdapter = new ArrayAdapter (this,Android.Resource.Layout.SimpleSpinnerDropDownItem,BKM.MoneyAccounts); moneyAccountSp.Adapter = maAdapter; moneyAccountSp.ItemSelected += delegate { moneyAccount = moneyAccountSp.SelectedItem.ToString(); }; Spinner taxSp = FindViewById<Spinner> (Resource.Id.tax_spinner); ArrayAdapter taxAdapter = new ArrayAdapter (this,Android.Resource.Layout.SimpleSpinnerDropDownItem,BKM.TaxRates); taxSp.Adapter = taxAdapter; taxSp.ItemSelected += delegate { taxRate = taxSp.SelectedItem.ToString(); }; Button addButton = FindViewById<Button> (Resource.Id.add_button); addButton.Click += delegate { string date = FindViewById<EditText>(Resource.Id.date_input).Text; string description = FindViewById<EditText>(Resource.Id.description_input).Text; string totalAmount = FindViewById<EditText>(Resource.Id.total_amount_input).Text; //Adds to BKM Entry entry = new Entry(){ InOut=inOut, Date = date, Description=description,Type = type, MoneyAccount=moneyAccount, TotalAmount = totalAmount, TaxRate=taxRate}; BKM.addEntry(entry); }; }
public SimularOcorrencias(IConfiguration configuration, ILogger logger, Spinner spinner) { Configuration = configuration; _logger = logger; _spinner = spinner; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //OnCreate takes a Bundle parameter, which is a dictionary for storing and passing state information //and objects between activities If the bundle is not null, this indicates the activity is restarting //and it should restore its state from the previous instance. "https:/docs.microsoft.com/en-us/xamarin/android/app-fundamentals/activity-lifecycle/" base.OnCreateView(inflater, container, savedInstanceState); //Once on create has finished, android will call OnStart which will start the activity //sets the layout of the main menu to the AgencyUsagePage.axml file which is located in Resources/layout/ View view = inflater.Inflate(Resource.Layout.AgencyUsagePage, container, false); //setup lists for agency usage data dataItems = new List <AgencyUsageData>(); displayItems = new List <AgencyUsageData>(); //setup custom list adapter, more info found in AgencyUsageViewAdapter.cs dataList = view.FindViewById <ListView>(Resource.Id.DataList); adapter = new AgencyUsageViewAdapter(this.Context, dataItems); //Display the number of items at the bottom of the page NumItems = view.FindViewById <TextView>(Resource.Id.txtNumData); //setup buttons at the top of the page which are used to sort the list based on the button pushed Button DateBtn = view.FindViewById <Button>(Resource.Id.DateTextAgency); Button AmountBtn = view.FindViewById <Button>(Resource.Id.AmountTextAgency); //setup Spinner to sort facilities Spinner spinner = view.FindViewById <Spinner>(Resource.Id.FacilitySpinner); spinner.Clickable = false; spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner_ItemSelected); var SpinnerAdapter = ArrayAdapter.CreateFromResource(view.Context, Resource.Array.FacilityArray, Android.Resource.Layout.SimpleSpinnerItem);//array found in Resources/values/ SpinnerAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = SpinnerAdapter; //create new WebClient class object which can provide methods to push and recieve data from an online resource via a url client = new WebClient(); //set the url to push and pull data from, via the a Uri class object //the online resource is a php file hosted on heroku, these php files read write and pull database tables url = new Uri("https://capstonephpcode198.herokuapp.com/PullData.php"); //setup toast message which is pop up message which informs the user that data is being pulled toastMessage = Toast.MakeText(this.Context, "Fetching data", ToastLength.Long); //setup graph button Button GraphButton = view.FindViewById <Button>(Resource.Id.GraphButton); GraphButton.Enabled = false; //disabled untill data is pulled GraphButton.Click += delegate { if (facilityForGraph > 0) //only create graph if facility has been chosen { var transaction = ChildFragmentManager.BeginTransaction(); AgencyUsageGraph info = new AgencyUsageGraph(dataItems, facilityForGraph); info.Show(transaction, "dialog fragment"); } else { Toast FacilityIDMessage = Toast.MakeText(this.Context, "Please select a facility", ToastLength.Long); FacilityIDMessage.Show(); } }; //setup progress bar ProgressBar ClientProgress = view.FindViewById <ProgressBar>(Resource.Id.ClientProgress); //show progress percentage on the bar client.UploadProgressChanged += delegate(object sender, UploadProgressChangedEventArgs e) { ClientProgress.Progress += e.ProgressPercentage; }; //refresh button pulls data from database Button RefreshBtn = view.FindViewById <Button>(Resource.Id.RefreshButton); RefreshBtn.Click += delegate { RefreshBtn.SetBackgroundResource(Resource.Drawable.RefreshButtonIconClicked);//change refresh icon colour to lighter shade of green toastMessage.Show(); spinner.SetSelection(0); //clear lists, to make way for updated data dataItems.Clear(); displayItems.Clear(); spinner.Clickable = false; NameValueCollection values = new NameValueCollection(); values.Add("Type", "Agency"); //call php file and use UploadValuesAsync with the value of Type=Agency so the php file knows to pull agency usage data client.UploadValuesAsync(url, values); }; client.UploadValuesCompleted += delegate(object sender, UploadValuesCompletedEventArgs e) { Activity.RunOnUiThread(() => { string json = Encoding.UTF8.GetString(e.Result); dataItems = JsonConvert.DeserializeObject <List <AgencyUsageData> >(json); //use json to create a list of data objects from the output of the php file adapter = new AgencyUsageViewAdapter(this.Context, dataItems); //setup adapter foreach (AgencyUsageData item in dataItems) { displayItems.Add(item);//display items holds all of the data objects for safe keeping, for when dataItems objects get removed } NumItems.Text = dataItems.Count.ToString(); dataList.Adapter = adapter; RefreshBtn.SetBackgroundResource(Resource.Drawable.RefreshButtonIcon); spinner.Clickable = true; GraphButton.Enabled = true; toastMessage.Cancel(); adapter.NotifyDataSetChanged(); }); }; //sort items based on date DateBtn.Click += delegate { if (clickNumDate == 0) { dataItems.Sort(delegate(AgencyUsageData one, AgencyUsageData two) { return(DateTime.Compare(one.GetDate(), two.GetDate())); }); clickNumDate++; clickNumAmount = 0; //reverse list if clicked a second time in a row } else { dataItems.Reverse(); clickNumDate = 0; } adapter.NotifyDataSetChanged(); }; //sort items based on amount AmountBtn.Click += delegate { if (clickNumAmount == 0) { dataItems.Sort(delegate(AgencyUsageData one, AgencyUsageData two) { return(one.GetAgencyUsageAmount().CompareTo(two.GetAgencyUsageAmount())); }); clickNumAmount++; clickNumDate = 0; //reverse list if clicked a second time in a row } else { dataItems.Reverse(); clickNumAmount = 0; } adapter.NotifyDataSetChanged(); }; return(view); }
/* * TextToSpeech textToSpeech; * Context context; * private readonly int MyCheckCode = 101, NeedLang = 103; * Java.Util.Locale lang;*/ protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Speech); Recognizer = SpeechRecognizer.CreateSpeechRecognizer(this); Recognizer.SetRecognitionListener(this); SpeechIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech); SpeechIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm); SpeechIntent.PutExtra(RecognizerIntent.ExtraCallingPackage, PackageName); sliding_layout = FindViewById <SlidingUpPanelLayout>(Resource.Id.sliding_layout); list_of_message = FindViewById <ListView>(Resource.Id.list_of_message); //var button = FindViewById<Button>(Resource.Id.speakButton); //button.Click += ButtonClick; leftSpeakButton = FindViewById <Button>(Resource.Id.leftSpeakButton); leftSpeakButton.Click += LeftSpeakButtonClick; rightSpeakButton = FindViewById <Button>(Resource.Id.rightSpeakButton); rightSpeakButton.Click += RightSpeakButtonClick; leftButton = FindViewById <Button>(Resource.Id.leftButton); leftButton.Click += LeftButtonClick; rightButton = FindViewById <Button>(Resource.Id.rightButton); rightButton.Click += RightButtonClick; /*context = rightSpeakButton.Context; * textToSpeech = new TextToSpeech(context, this, "com.google.android.tts");*/ /*var langAvailable = new List<string> { "Default" }; * * // our spinner only wants to contain the languages supported by the tts and ignore the rest * var localesAvailable = Java.Util.Locale.GetAvailableLocales().ToList(); * foreach (var locale in localesAvailable) * { * LanguageAvailableResult res = textToSpeech.IsLanguageAvailable(locale); * switch (res) * { * case LanguageAvailableResult.Available: * langAvailable.Add(locale.DisplayLanguage); * break; * case LanguageAvailableResult.CountryAvailable: * langAvailable.Add(locale.DisplayLanguage); * break; * case LanguageAvailableResult.CountryVarAvailable: * langAvailable.Add(locale.DisplayLanguage); * break; * } * * } * langAvailable = langAvailable.OrderBy(t => t).Distinct().ToList();*/ // set up the speech to use the default langauge // if a language is not available, then the default language is used. /*lang = Java.Util.Locale.Us; * textToSpeech.SetLanguage(lang); * * // set the speed and pitch * textToSpeech.SetPitch(.5f); * textToSpeech.SetSpeechRate(.5f);*/ //Label = FindViewById<TextView>(Resource.Id.textV); spinner = FindViewById <Spinner>(Resource.Id.spinnerSpeech); languagesList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("English", "en-US"), new KeyValuePair <string, string>("Arabic", "ar-SA"), new KeyValuePair <string, string>("Greek", "el-GR"), new KeyValuePair <string, string>("Hebrew", "he-IL"), new KeyValuePair <string, string>("Spanish", "es-ES"), new KeyValuePair <string, string>("Chinese", "zh-CN"), new KeyValuePair <string, string>("Korean", "ko-KR"), new KeyValuePair <string, string>("German", "de-DE"), new KeyValuePair <string, string>("Persian", "fa-IR"), new KeyValuePair <string, string>("Russian", "ru-RU"), new KeyValuePair <string, string>("Turkish", "tr-TR"), new KeyValuePair <string, string>("Urdu", "ur-PK"), new KeyValuePair <string, string>("French", "fr-FR"), new KeyValuePair <string, string>("Hindi", "hi-IN"), new KeyValuePair <string, string>("Japanese", "ja-JP") }; List <string> languages = new List <string>(); foreach (var item in languagesList) { languages.Add(item.Key); } spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected); var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, languages); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemSingleChoice); spinner.Adapter = adapter; //lang = Java.Util.Locale.GetAvailableLocales().FirstOrDefault(t => t.DisplayLanguage == langAvailable[(int)e.Id]); // create intent to check the TTS has this language installed /*var checkTTSIntent = new Intent(); * checkTTSIntent.SetAction(TextToSpeech.Engine.ActionCheckTtsData); * StartActivityForResult(checkTTSIntent, NeedLang);*/ }
void KillViews() { bodyCondSpinner = foundAirSpinner = foundWaterSpinner = fromWaterSpinner = null; calculateButton = null; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.showCards); _noteBook = NoteBook.getInstance(); _questionShowing = true; _cardsToShow = new List <Card>(); _questionanswer = FindViewById <TextView>(Resource.Id.questionAnswer); _date = FindViewById <TextView>(Resource.Id.date); _editCard = FindViewById <Button>(Resource.Id.editCard); _removeCard = FindViewById <Button>(Resource.Id.removeCard); _nextBtn = FindViewById <Button>(Resource.Id.nextBtn); _prevBtn = FindViewById <Button>(Resource.Id.prevBtn); _addCard = FindViewById <Button>(Resource.Id.addCardBtn); _topicChooser = FindViewById <Spinner>(Resource.Id.topicChooser); _date.Text = string.Empty; _topicChooser.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected); spinnerAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, _noteBook.getTopicNames()); _topicChooser.Adapter = spinnerAdapter; if (_noteBook.getTopicCount() != 0) { _topicChooser.SetSelection(_noteBook.getCurrentTopicNum()); _previousTopicIndex = 0; _currentTopic = _noteBook.getTopic((string)_topicChooser.SelectedItem); _cardsToShow = _currentTopic.getAllCards(); _currentCard = _cardsToShow.Count - 1; } if (_currentTopic != null) { changeCards(); } _removeCard.Click += delegate { if (_cardsToShow.Count != 0) { _cardsToShow.RemoveAt(_currentCard); _currentCard = _currentCard - 1; if (_currentCard == -1) { _currentCard = 0; } } showQuestion(); }; _addCard.Click += delegate { Intent x = new Intent(this, typeof(AddCard)); x.PutExtra("TopicName", (string)_topicChooser.SelectedItem); StartActivity(x); }; _editCard.Click += delegate { if (_cardsToShow.Count != 0) { Intent x = new Intent(this, typeof(AddCard)); x.PutExtra("Edit Card", true); // Pass the index so it knows which question to set text to x.PutExtra("QuestionName", _currentCard); x.PutExtra("TopicName", (string)_topicChooser.SelectedItem); StartActivity(x); } }; _questionanswer.Click += delegate { if (_questionShowing) { _questionShowing = false; showAnswer(); } // Show question if showing answer else { _questionShowing = true; showQuestion(); } }; // Go to next card _nextBtn.Click += delegate { _editCard.Text = "Edit card"; if (_cardsToShow.Count != 0) { _currentCard = (_currentCard + 1) % _cardsToShow.Count; } showQuestion(); }; // Go to previous card _prevBtn.Click += delegate { if (_cardsToShow.Count != 0) { _currentCard = (_currentCard == 0) ? (_cardsToShow.Count - 1) : _currentCard - 1; } showQuestion(); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var consulta = LayoutInflater.Inflate(Resource.Layout.Consulta, null); SetContentView(consulta); BotonEnviar = FindViewById <Button>(Resource.Id.btnEnviar); Spinner spinner = FindViewById <Spinner>(Resource.Id.spinner); time_display = FindViewById <TextView>(Resource.Id.txtHora); timeFinal_display = FindViewById <TextView>(Resource.Id.txtHoraFin); pick_button = FindViewById <Button>(Resource.Id.btnFechaInicial); pickFinal_button = FindViewById <Button>(Resource.Id.btnFechaFinal); int IdEmpleado = Intent.GetIntExtra(GetString(Resource.String.ConsultaIntentKey), 0); time_display.Text = "llegue"; // setup the action bar SetSupportActionBar(FindViewById <Toolbar>(Resource.Id.toolbar)); // ensure that the system bar color gets drawn Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); Title = SupportActionBar.Title = "Consulta"; // Spinner o combo que muestra la lista de empleados disponibles ArrayAdapter <EmpleadoDTO> adapter = new ArrayAdapter <EmpleadoDTO>(this, Android.Resource.Layout.SimpleSpinnerItem, Perfil_Login.ListaEmpleadosAsignados); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = adapter; if (IdEmpleado != 0) { EmpleadoDTO empleado = HelperMethods.getUserById(IdEmpleado); int spinnerPosition = adapter.GetPosition(empleado); spinner.SetSelection(spinnerPosition); } #region Calendario y Horas // Invoca el fragmento que contiene el calendario de fecha final var fragFin = FragmentManager.BeginTransaction(); var fragFinal = new DatePickerFinFragment(); fragFin.Add(Resource.Id.fragment_Fecha_Final, fragFinal); fragFin.Commit(); // Invoca el fragmento que contiene el calendario de fecha inicial var fragTx = FragmentManager.BeginTransaction(); var frag = new DatePickerFragment(); fragTx.Add(Resource.Id.fragment_Fecha_Inicial, frag); fragTx.Commit(); // Get the current time horaInicial = DateTime.Now.Hour; horaFinal = DateTime.Now.Hour + 1; minutoInicial = DateTime.Now.Minute; minutoFinal = DateTime.Now.Minute; // Display the current date UpdateDisplay(time_display, TIME_DIALOG_ID); UpdateDisplay(timeFinal_display, TIME_DIALOG_ID_FIN); #endregion pick_button.Click += (o, e) => ShowDialog(TIME_DIALOG_ID); pickFinal_button.Click += (o, e) => ShowDialog(TIME_DIALOG_ID_FIN); BotonEnviar.Click += BotonEnviar_Click; spinner.ItemSelected += spinner_ItemSelected; Conexion_Web_Service._client.BajarCoordenadasEmpleadosCompleted += _client_Consulta_BajarCoordenadasEmpleadosCompleted; }
private void CreateLayout() { // View for the input/output wkid labels. LinearLayout wkidLabelsStackView = new LinearLayout(this) { Orientation = Orientation.Horizontal }; wkidLabelsStackView.SetPadding(10, 10, 0, 10); // Create a label for the input spatial reference. _inWkidLabel = new TextView(this) { Text = "In WKID = ", TextAlignment = TextAlignment.ViewStart }; // Create a label for the output spatial reference. _outWkidLabel = new TextView(this) { Text = "Out WKID = ", TextAlignment = TextAlignment.ViewStart }; // Create some horizontal space between the labels. Space space = new Space(this); space.SetMinimumWidth(30); // Add the Wkid labels to the stack view. wkidLabelsStackView.AddView(_inWkidLabel); wkidLabelsStackView.AddView(space); wkidLabelsStackView.AddView(_outWkidLabel); // Create the 'use extent' switch. _useExtentSwitch = new Switch(this) { Checked = false, Text = "Use extent" }; // Handle the checked change event for the switch. _useExtentSwitch.CheckedChange += UseExtentSwitch_CheckedChange; // Create a picker (Spinner) for datum transformations. _transformationsPicker = new Spinner(this); _transformationsPicker.SetPadding(5, 10, 0, 10); // Handle the selection event to work with the selected transformation. _transformationsPicker.ItemSelected += TransformationsPicker_ItemSelected; // Create a text view to show messages. _messagesTextView = new TextView(this); // Create a new vertical layout for the app UI. LinearLayout mainLayout = new LinearLayout(this) { Orientation = Orientation.Vertical }; // Create a layout for the app tools. LinearLayout toolsLayout = new LinearLayout(this) { Orientation = Orientation.Vertical }; toolsLayout.SetPadding(10, 0, 0, 0); toolsLayout.SetMinimumHeight(320); // Add the transformation UI controls to the tools layout. toolsLayout.AddView(wkidLabelsStackView); toolsLayout.AddView(_useExtentSwitch); toolsLayout.AddView(_transformationsPicker); toolsLayout.AddView(_messagesTextView); // Add the tools layout and map view to the main layout. mainLayout.AddView(toolsLayout); _myMapView = new MapView(this); mainLayout.AddView(_myMapView); // Show the layout in the app. SetContentView(mainLayout); }
public override View GetSampleContent(Context con) { LinearLayout linear = new LinearLayout(con); linear.SetBackgroundColor(Android.Graphics.Color.White); linear.Orientation = Orientation.Vertical; linear.SetPadding(10, 10, 10, 10); TextView space = new TextView(con); space.TextSize = 10; linear.AddView(space); TextView text2 = new TextView(con); text2.TextSize = 17; text2.TextAlignment = TextAlignment.Center; text2.Text = "This sample demonstrates various PDF conformance support in Essential PDF."; text2.SetTextColor(Android.Graphics.Color.ParseColor("#262626")); text2.SetPadding(5, 5, 5, 5); linear.AddView(text2); TextView text3 = new TextView(con); text3.TextSize = 19; text3.TextAlignment = TextAlignment.Center; text3.Text = "Please select the conformance"; text3.SetTextColor(Android.Graphics.Color.ParseColor("#262626")); text3.SetPadding(5, 100, 5, 5); linear.AddView(text3); advancedLinear1 = new LinearLayout(con); TextView space1 = new TextView(con); space1.TextSize = 10; linear.AddView(space1); string[] list1 = { "PDF/A-1a", "PDF/A-1b", "PDF/A-2a", "PDF/A-2b", "PDF/A-2u", "PDF/A-3a", "PDF/A-3b", "PDF/A-3u" }; ArrayAdapter <String> array1 = new ArrayAdapter <String>(con, Android.Resource.Layout.SimpleSpinnerItem, list1); m_conformance = new Spinner(con); m_conformance.Adapter = array1; m_conformance.SetSelection(0); advancedLinear1.AddView(m_conformance); advancedLinear1.SetPadding(320, 0, 5, 5); linear.AddView(advancedLinear1); m_context = con; TextView space2 = new TextView(con); space2.TextSize = 10; linear.AddView(space2); Button button1 = new Button(con); button1.Text = "Generate PDF"; button1.Click += OnButtonClicked; linear.AddView(button1); return(linear); }
public void Init(int width, int height) { string imgprefix = "DWSIM.UI.Desktop.Editors.Resources.Icons."; Icon = Eto.Drawing.Icon.FromResource(imgprefix + "DWSIM_ico.ico"); Maximizable = false; Minimizable = false; WindowStyle = Eto.Forms.WindowStyle.Default; var container = new TableLayout(); var topcontainer = new TableLayout(); topcontainer.BackgroundColor = s.DarkMode ? SystemColors.ControlBackground : Colors.White; if (HeaderTitle != "") { topcontainer.Rows.Add(new TableRow(new Label { Text = HeaderTitle, Font = SystemFonts.Bold() })); } if (HeaderDescription != "") { topcontainer.Rows.Add(new TableRow(new Label { Text = HeaderDescription })); } var middlecontainer = new DynamicLayout(); var footercontainer = new TableLayout(); footercontainer.BackgroundColor = s.DarkMode ? SystemColors.ControlBackground : Colors.White; topcontainer.Padding = new Padding(15); topcontainer.Spacing = new Size(10, 10); middlecontainer.Padding = new Padding(5); middlecontainer.Spacing = new Size(10, 10); var buttons = new List <Button>(); if (hasCancelButton) { btnCancel = new Button { Text = "Cancel" }; if (cancelAction != null) { btnCancel.Click += (sender, e) => cancelAction.Invoke(); } buttons.Add(btnCancel); } if (hasBackButton) { btnBack = new Button { Text = "Previous" }; if (backAction != null) { btnBack.Click += (sender, e) => backAction.Invoke(); } buttons.Add(btnBack); } if (hasNextButton) { btnNext = new Button { Text = "Next" }; if (nextAction != null) { btnNext.Click += (sender, e) => nextAction.Invoke(); } buttons.Add(btnNext); } if (hasFinishButton) { btnFinish = new Button { Text = "Finish" }; if (finishAction != null) { btnFinish.Click += (sender, e) => finishAction.Invoke(); } buttons.Add(btnFinish); } var tr = new TableRow(); footerSpinner = new Spinner { Visible = false, Size = new Size((int)(s.UIScalingFactor * 20), (int)(s.UIScalingFactor * 20)) }; tr.Cells.Add(footerSpinner); footerLabel = new Label { Text = FooterText, VerticalAlignment = VerticalAlignment.Center }; tr.Cells.Add(footerLabel); tr.Cells.Add(null); foreach (var btn in buttons) { if (Application.Instance.Platform.IsWinForms) { btn.Height = (int)(s.UIScalingFactor * 30); } tr.Cells.Add(btn); } footercontainer.Rows.Add(tr); footercontainer.Padding = new Padding(15); footercontainer.Spacing = new Size(10, 10); if (Application.Instance.Platform.IsWinForms) { footercontainer.Height = (int)(s.UIScalingFactor * 60); } container.Rows.Add(new TableRow(topcontainer)); container.Rows.Add(new TableRow(middlecontainer)); if (Application.Instance.Platform.IsWinForms) { container.Rows.Add(null); } container.Rows.Add(new TableRow(footercontainer)); if (Application.Instance.Platform.IsGtk) { container.Rows.Add(null); } container.Padding = new Padding(0); Content = container; ContentContainer = middlecontainer; var center = Screen.PrimaryScreen.WorkingArea.Center; center.X -= (int)(s.UIScalingFactor * width) / 2; center.Y -= ((int)(s.UIScalingFactor * height) + (int)(s.UIScalingFactor * 150)) / 2; Location = new Point(center); Topmost = true; Visible = true; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Create your application here SetContentView(Resource.Layout.Second); //RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait; //Initialize the elements var editTextAppVol = FindViewById <EditText> (Resource.Id.editTextAppVol); var editTextProdRate = FindViewById <EditText> (Resource.Id.editTextProdRate); var editTextAdjRate = FindViewById <EditText> (Resource.Id.editTextAdjRate); Spinner spinnerAppUnit = FindViewById <Spinner> (Resource.Id.spinnerAppUnit); Spinner spinnerProdUnit = FindViewById <Spinner> (Resource.Id.spinnerProdUnit); Spinner spinnerAdjUnit = FindViewById <Spinner> (Resource.Id.spinnerAdjUnit); Button buttonTankInfo = FindViewById <Button> (Resource.Id.buttonTankIfo); //Populate Spinner Element // 1. The Application Unit Spinner spinnerAppUnit.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); var adapter = ArrayAdapter.CreateFromResource( this, Resource.Array.appUnitArray, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerAppUnit.Adapter = adapter; // 2. The Application Unit Spinner spinnerProdUnit.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinnerProdUnit_ItemSelected); var adapterProdUnit = ArrayAdapter.CreateFromResource( this, Resource.Array.prodUnitArray, Android.Resource.Layout.SimpleSpinnerItem); adapterProdUnit.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerProdUnit.Adapter = adapterProdUnit; // 3. The Application Unit Spinner spinnerAdjUnit.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinnerAdjUnit_ItemSelected); var adapterAdjUnit = ArrayAdapter.CreateFromResource( this, Resource.Array.adjUnitArray, Android.Resource.Layout.SimpleSpinnerItem); adapterAdjUnit.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerAdjUnit.Adapter = adapterAdjUnit; //Assign the values from Text Field editTextAppVol.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => { AppVolText = e.Text.ToString(); }; editTextProdRate.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => { ProdRateText = e.Text.ToString(); }; editTextAdjRate.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => { AdjRateText = e.Text.ToString(); }; //When Button is clicked buttonTankInfo.Click += (sender, e) => { //receive values and pass to the third activity float a; float zero; //check empty fields if (String.IsNullOrEmpty(AppVolText) || String.IsNullOrEmpty(ProdRateText) || String.IsNullOrEmpty(AdjRateText) || String.IsNullOrEmpty(AppVolUnit) || String.IsNullOrEmpty(ProdRateUnit) || String.IsNullOrEmpty(AdjRateUnit)) { new AlertDialog.Builder(this) .SetPositiveButton("OK", (sender1, args) => { // User pressed yes }) .SetMessage("Missing inputs or units") .SetTitle("Error") .Show(); } //check text fields are numeric values else if (!float.TryParse(AppVolText, out a) || !float.TryParse(ProdRateText, out a) || !float.TryParse(AdjRateText, out a)) { new AlertDialog.Builder(this) .SetPositiveButton("OK", (sender1, args) => { // User pressed yes }) .SetMessage("numeric values only for \n App Vol, Prod Rate and Adj Rate") .SetTitle("Error") .Show(); } //Check the inputs are not zero. else if (float.TryParse(AppVolText, out zero) && zero == 0) { new AlertDialog.Builder(this) .SetPositiveButton("OK", (sender1, args) => { // User pressed yes }) .SetMessage("Application Volume cannot be zero") .SetTitle("Error") .Show(); } //when all conditions are met else { string[] allValues = { AppVolText, ProdRateText, AdjRateText, AppVolUnit, ProdRateUnit, AdjRateUnit }; var third = new Intent(this, typeof(ThirdActivity)); third.PutExtra("myValues", allValues); StartActivity(third); } }; }
private int companySelected = 0; //已选择的spinner公司编号 protected override void OnCreate(Bundle savedInstanceState) //oncreate函数 { base.OnCreate(savedInstanceState); //创建方法 SetContentView(Resource.Layout.Main); //设置内容界面 EditText parcelNumberText = FindViewById <EditText>(Resource.Id.ParcelNumberText); //定位快递单号控件 Button trackButton = FindViewById <Button>(Resource.Id.TrackButton); //定位追踪按钮控件 Button scanButton = FindViewById <Button>(Resource.Id.ScanButton); //定位扫描按钮控件 Button historyButton = FindViewById <Button>(Resource.Id.HistoryButton); //定位历史按钮控件 Spinner companySpinner = FindViewById <Spinner>(Resource.Id.CompanySpinner); //定位spinner控件 companySpinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(companySpinner_ItemSelected); //spinner选择事件 companies = new List <KeyValuePair <string, string> > //对快递公司代码键值对赋值 { new KeyValuePair <string, string>("顺丰", "shunfeng"), new KeyValuePair <string, string>("中通速递", "zhongtong"), new KeyValuePair <string, string>("申通", "shentong"), new KeyValuePair <string, string>("圆通速递", "yuantong"), new KeyValuePair <string, string>("韵达快递", "yunda"), new KeyValuePair <string, string>("天天快递", "tiantian"), new KeyValuePair <string, string>("百世汇通", "huitongkuaidi"), new KeyValuePair <string, string>("德邦物流", "debangwuliu"), new KeyValuePair <string, string>("EMS", "ems"), new KeyValuePair <string, string>("Fedex中国", "lianbangkuaidi"), new KeyValuePair <string, string>("快捷速递", "kuaijiesudi"), new KeyValuePair <string, string>("全一快递", "quanyikuaidi"), new KeyValuePair <string, string>("全峰快递", "quanfengkuaidi"), new KeyValuePair <string, string>("优速物流", "yousuwuliu"), new KeyValuePair <string, string>("UPS", "ups"), new KeyValuePair <string, string>("宅急送", "zhaijisong") }; List <string> companyNames = new List <string>(); //定义快递公司名List foreach (var item in companies) //赋值 { companyNames.Add(item.Key); } var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, companyNames); //定义Spinner的ArrayAdapter adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); //设置adapter的下拉界面方法 companySpinner.Adapter = adapter; //修改spinner的adapter方法 if (Stock.IsParcelExist()) //检查是否有快递存在 { CheckUpdate(); //若存在,检查快递物流信息更新 } scanButton.Click += (sender, e) => //扫描按钮点击 { StartActivityForResult(typeof(ScanActivity), 1); //开始扫描条形码activity }; historyButton.Click += (sender, e) => //记录按钮点击 { Intent intent = new Intent(this, typeof(HistoryActivity)); //定义意向 StartActivity(intent); //开始记录activity }; trackButton.Click += (sender, e) => //追踪按钮点击 { if (string.IsNullOrEmpty(parcelNumberText.Text)) //检查快递单号是否为空 { Toast.MakeText(this, "Please enter the Parcel Number", ToastLength.Long).Show(); //若为空,弹出提示 } else { Intent intent = new Intent(this, typeof(ParcelDetailActivity)); //定义意向 intent.PutExtra("parcelNumber", parcelNumberText.Text.Trim()); //传递快递单号 intent.PutExtra("parcelCompany", companies[companySelected].Value); //传递快递公司代码 StartActivity(intent); //开始追踪activity } }; }
public override View GetSampleContent(Context context) { chart = new SfChart(context); chart.Title.Text = "Average Sales Comparison"; chart.Title.TextSize = 15; chart.Legend.Visibility = Visibility.Visible; chart.Legend.IconHeight = 14; chart.Legend.IconWidth = 14; chart.Legend.DockPosition = ChartDock.Bottom; chart.Legend.ToggleSeriesVisibility = true; chart.ColorModel.ColorPalette = ChartColorPalette.Natural; chart.PrimaryAxis = new CategoryAxis(); secondaryAxis = new NumericalAxis(); secondaryAxis.LabelStyle.LabelFormat = "#'M'"; chart.SecondaryAxis = secondaryAxis; PolarSeries polarSeries1 = new PolarSeries(); polarSeries1.TooltipEnabled = true; polarSeries1.EnableAnimation = true; polarSeries1.Label = "Product A"; polarSeries1.Closed = true; polarSeries1.DrawType = PolarChartDrawType.Area; polarSeries1.Alpha = 0.5f; polarSeries1.ItemsSource = MainPage.GetPolarData1(); polarSeries1.XBindingPath = "XValue"; polarSeries1.YBindingPath = "YValue"; chart.Series.Add(polarSeries1); PolarSeries polarSeries2 = new PolarSeries(); polarSeries2.TooltipEnabled = true; polarSeries2.EnableAnimation = true; polarSeries2.Label = "Product B"; polarSeries2.Closed = true; polarSeries2.DrawType = PolarChartDrawType.Area; polarSeries2.Alpha = 0.5f; polarSeries2.ItemsSource = MainPage.GetPolarData2(); polarSeries2.XBindingPath = "XValue"; polarSeries2.YBindingPath = "YValue"; chart.Series.Add(polarSeries2); PolarSeries polarSeries3 = new PolarSeries(); polarSeries3.XBindingPath = "XValue"; polarSeries3.YBindingPath = "YValue"; polarSeries3.EnableAnimation = true; polarSeries3.TooltipEnabled = true; polarSeries3.Label = "Product C"; polarSeries3.Closed = true; polarSeries3.DrawType = PolarChartDrawType.Area; polarSeries3.Alpha = 0.5f; polarSeries3.ItemsSource = MainPage.GetPolarData3(); chart.Series.Add(polarSeries3); Spinner selectLabelMode = new Spinner(context, SpinnerMode.Dialog); polarAngleMode = new List <String>() { "Rotate 0", "Rotate 90", "Rotate 180", "Rotate 270" }; ArrayAdapter <String> dataAdapter = new ArrayAdapter <String> (context, Android.Resource.Layout.SimpleSpinnerItem, polarAngleMode); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line); selectLabelMode.Adapter = dataAdapter; selectLabelMode.ItemSelected += SelectLabelMode_ItemSelected; LinearLayout linearLayout = new LinearLayout(context); linearLayout.SetPadding(20, 0, 20, 30); linearLayout.SetBackgroundColor(Color.Rgb(236, 235, 242)); linearLayout.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent); linearLayout.Orientation = Orientation.Vertical; linearLayout.SetBackgroundColor(Android.Graphics.Color.White); linearLayout.AddView(selectLabelMode); linearLayout.AddView(chart); return(linearLayout); }
private void DoUnDo() { ReDrawAll(); Spinner.StopSpinning(); }