本文整理汇总了C#中Button.RequestFocus方法的典型用法代码示例。如果您正苦于以下问题:C# Button.RequestFocus方法的具体用法?C# Button.RequestFocus怎么用?C# Button.RequestFocus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Button
的用法示例。
在下文中一共展示了Button.RequestFocus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
// Initialize IoT Hub client
Device = new MyClass();
// If you are developing and want to avoid having to enter the full connection string on the device,
// you can temporarily hard code it here. Comment this when done!
//Device.DisplayName = "[DisplayName]";
//Device.ConnectionString = "[ConnectionString]";
// Prepare UI elements
buttonConnect = FindViewById<Button>(Resource.Id.buttonConnect);
buttonConnect.Enabled = false;
buttonConnect.Click += ButtonConnect_Click;
buttonSend = FindViewById<Button>(Resource.Id.buttonSend);
buttonSend.Enabled = false;
buttonSend.Click += ButtonSend_Click;
textDeviceName = FindViewById<TextView>(Resource.Id.textDeviceName);
textDeviceName.TextChanged += TextDeviceName_TextChanged;
textDeviceName.Text = Device.DisplayName;
textConnectionString = FindViewById<TextView>(Resource.Id.textConnectionString);
textConnectionString.TextChanged += TextConnectionString_TextChanged;
textConnectionString.Text = Device.ConnectionString;
lblTemperature = FindViewById<TextView>(Resource.Id.lblTemperature);
SeekBar seekTemperature = FindViewById<SeekBar>(Resource.Id.seekBarTemperature);
seekTemperature.ProgressChanged += SeekTemperature_ProgressChanged;
seekTemperature.Progress = 50;
lblHumidity = FindViewById<TextView>(Resource.Id.lblHumidity);
SeekBar seekHumidity = FindViewById<SeekBar>(Resource.Id.seekBarHumidity);
seekHumidity.ProgressChanged += SeekHumidity_ProgressChanged;
seekHumidity.Progress = 50;
// Set focus to the connect button
buttonConnect.RequestFocus();
}
示例2: OnCreate
// async void example(){
// ParseObject gameScore = new ParseObject("GameScore");
// gameScore["score"] = 1337;
// gameScore["playerName"] = "Sean Plott";
// await gameScore.SaveAsync();
// }
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// ParseClient.Initialize("LNAuxom26NKczyL2hfU3deDyFvxkR9vAEVt3NYom",
// "pTK01DCWyIlw3DQJludWbtnBgvpe2PqNFKa8aDmm");
//example ();
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
string Dominio_webservice = "http://alertapp-jovel.rhcloud.com/index.php/Mobile";
WebServices = new Dictionary<string, System.Uri> {
{"getDenuncias",new System.Uri(Dominio_webservice+"/getDenuncias")},
{"setDenuncia",new System.Uri(Dominio_webservice+"/setDenuncia")},
{"getDenunciaPicture",new System.Uri(Dominio_webservice+"/getDenunciaPicture")}
};
//este diccionario dejo de usarse pero puede resultar util luego
ColorTipoDenuncia = new Dictionary<int, float>{
{1, BitmapDescriptorFactory.HueRed},
{2, BitmapDescriptorFactory.HueAzure},
{3, BitmapDescriptorFactory.HueGreen},
{4, BitmapDescriptorFactory.HueYellow},
};
MarkerTipoDenuncia = new Dictionary<int, int>{
{1, Resource.Drawable.corte_marker},
{2, Resource.Drawable.fuga_marker},
{3, Resource.Drawable.damage_marker},
{4, Resource.Drawable.otros_marker}
};
btnNormal = FindViewById<Button>(Resource.Id.btnNormal);
btnSatellite = FindViewById<Button>(Resource.Id.btnSatellite);
ibtnReload = FindViewById<ImageButton>(Resource.Id.ibtnReload);
ibtnGps = FindViewById<ImageButton>(Resource.Id.ibtnGps);
ibtnSearch = FindViewById<ImageButton>(Resource.Id.ibtnSearch);
txtBuscar = FindViewById<EditText>(Resource.Id.txtBuscar);
txtBuscar.ClearFocus();
btnNormal.RequestFocus();
btnNormal.Click +=btnNormal_Click;
btnSatellite.Click +=btnSatellite_Click;
txtBuscar.EditorAction += txtBuscar_EditorAction;
ibtnReload.Click += ibtnReload_Click;
ibtnGps.Click += ibtnGps_Click;
ibtnSearch.Click += ibtnSearch_Click;
toolBar = FindViewById<SupportToolbar>(Resource.Id.toolbar);
toolBar.SetTitleTextColor(Color.White);
mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawe_layout);
mLeftDrawer = FindViewById<ListView>(Resource.Id.left_drawer);
SetSupportActionBar(toolBar);
mLeftDataSet = new List<string>();
mLeftDataSet.Add("Bienvenido Luis Jovel");
mLeftDataSet.Add("Listado de Denuncias");
mLeftDataSet.Add("Filtrar Resultados");
mLeftDataSet.Add(" Ver Todos");
mLeftDataSet.Add(" Corte de servicio");
mLeftDataSet.Add(" Fuga de Agua");
mLeftDataSet.Add(" Daño a Infraestructura");
mLeftDataSet.Add(" Otros");
mLeftDataSet.Add("Cerrar Sesion");
mLeftAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, mLeftDataSet);
mLeftDrawer.ItemClick += mLeftDrawer_ItemClick;
mLeftDrawer.Adapter = mLeftAdapter;
mDrawerToggle = new MyActionBarDrawerToggle(
this,
mDrawerLayout,
Resource.String.openDrawer,
Resource.String.closeDrawer
);
mDrawerLayout.SetDrawerListener(mDrawerToggle);
SupportActionBar.SetHomeButtonEnabled(true);
SupportActionBar.SetDisplayShowTitleEnabled(true);
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
mDrawerToggle.SyncState();
//GPS NUEVO
setupGPS();
SetUpMap();
//GPS OBSOLETO
// InitializeLocationManager();
cliente = new WebClient();
//llamar a web service
cliente.DownloadDataAsync(WebServices["getDenuncias"]);
cliente.DownloadDataCompleted += cliente_DownloadDataCompleted;
//alertdialog
builder = new Android.App.AlertDialog.Builder(this);
alert = builder.Create();
}
示例3: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState)
{
base.OnCreateView (inflater, container, savedInstanceState);
var view = inflater.Inflate (Resource.Layout.LogInDialog, container, false);
mTxtUserName = view.FindViewById<EditText> (Resource.Id.txtUserName);
mTxtPassword = view.FindViewById<EditText> (Resource.Id.txtPassword);
mCheckbox = view.FindViewById<CheckBox> (Resource.Id.LoginCheckBox);
try{
var CheckPrefs = Application.Context.GetSharedPreferences("MyCheckState", FileCreationMode.Private);
checkState = CheckPrefs.GetString("CheckState", null);
}catch{
}
switch (checkState)
{
case "False":
mCheckbox.Checked = false;
break;
case "True":
mCheckbox.Checked = true;
try{
var UsernamePrefs = Application.Context.GetSharedPreferences("username", FileCreationMode.Private);
mTxtUserName.Text = UsernamePrefs.GetString("username", null);
}catch{
}
try{
var PasswordPrefs = Application.Context.GetSharedPreferences("password", FileCreationMode.Private);
mTxtPassword.Text = PasswordPrefs.GetString("password", null);
}catch{
}
break;
default:
mCheckbox.Checked = true;
break;
}
mBtnSignUp = view.FindViewById<Button> (Resource.Id.btnLogInDialog);
mErrorText = view.FindViewById<TextView> (Resource.Id.txtError);
mProgressBar = view.FindViewById<ProgressBar> (Resource.Id.progressBar);
mProgressBar.Visibility = ViewStates.Invisible;
mBtnSignUp.Click += (object sender, EventArgs e) => {
mProgressBar.Visibility = ViewStates.Visible;
mTxtUserName.ClearFocus();
mErrorText.ClearFocus();
mBtnSignUp.RequestFocus();
mErrorText.Text=string.Format("登录中...");
//关键盘
InputMethodManager inputManager = (InputMethodManager)Activity.GetSystemService(Context.InputMethodService);
inputManager.HideSoftInputFromWindow(mTxtPassword.WindowToken, HideSoftInputFlags.None);
inputManager.HideSoftInputFromWindow(mTxtUserName.WindowToken, HideSoftInputFlags.None);
mWorker=new BackgroundWorker();
mWorker.WorkerSupportsCancellation = true;
mWorker.DoWork+= delegate(object sender1, DoWorkEventArgs e1) {
BackgroundWorker mworker = sender1 as BackgroundWorker;
if (mworker.CancellationPending == true) {
e1.Cancel = true;
} else {
checkPassword();
}
};
mWorker.RunWorkerCompleted+=delegate(object sender1, RunWorkerCompletedEventArgs e1) {
if (e1.Cancelled == true) {
} else if (!(e1.Error == null)) {
} else {
worker_RunWorkerCompleted();
}
};
if (mWorker.IsBusy != true) {
mWorker.RunWorkerAsync ();
}
//.........这里部分代码省略.........