本文整理汇总了C#中Button.PerformClick方法的典型用法代码示例。如果您正苦于以下问题:C# Button.PerformClick方法的具体用法?C# Button.PerformClick怎么用?C# Button.PerformClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Button
的用法示例。
在下文中一共展示了Button.PerformClick方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowDialog
public static string ShowDialog(string baseSite,string text, string caption)
{
Form prompt = new Form();
string resultURL="";
prompt.Width = 600;
prompt.Height = 420;
prompt.Text = caption;
Label textLabel = new Label() { Left = 10, Top=10, Width=580, Text=text };
ListBox lbCounty = new ListBox() { Left = 10, Top=40, Width=250, Height = 340, DisplayMember = "Label" };
Button confirmation = new Button() { Text = "Ok", Left=370, Width=100, Top=350 };
Button cancel = new Button() { Text = "Cancel", Left=480, Width=100, Top=350 };
confirmation.Click += (sender, e) => {
if(lbCounty.SelectedItem!=null) {resultURL=lbCounty.SelectedItem.ToString();}
prompt.Close();
};
lbCounty.DoubleClick += (sender, e) => { confirmation.PerformClick();};
cancel.Click += (sender, e) => { resultURL = "";prompt.Close(); };
prompt.Controls.Add(confirmation);
prompt.Controls.Add(cancel);
prompt.Controls.Add(textLabel);
prompt.Controls.Add(lbCounty);
FillLbCounty(lbCounty,baseSite);
prompt.ShowDialog();
return resultURL;
}
示例2: SetCommand_OnButtonNoValueNoEventName_ClickEventShouldBeUsed
public void SetCommand_OnButtonNoValueNoEventName_ClickEventShouldBeUsed()
{
var value = DateTime.Now.Ticks.ToString();
var vmTarget = new TestViewModel();
vmTarget.Configure(value);
var button = new Button(Application.Context);
button.SetCommand(vmTarget.SetPropertyWithoutValueCommand);
Assert.IsNull(vmTarget.TargetProperty);
button.PerformClick();
Assert.AreEqual(value, vmTarget.TargetProperty);
}
示例3: OnCreateView
public override View OnCreateView(LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState)
{
base.OnCreateView (inflater, container, savedInstanceState);
var view = inflater.Inflate (Resource.Layout.GameSearchTabLayout, container, false);
var searchEditText = view.FindViewById<EditText> (Resource.Id.GameTabSearchEditText);
_searchButton = view.FindViewById<Button>(Resource.Id.GameTabSearchButton);
_listView = view.FindViewById <ListView>(Resource.Id.GameTabSearchListView);
_searchButton.Click += (sender, e) =>
{
_gamesList = new GamesDBService().GetGameList(searchEditText.Text);
_listView.Adapter = new SearchAdapter(Activity, _gamesList);
};
_listView.ItemClick += (sender, e) =>
{
if(!string.IsNullOrEmpty(_gamesList[e.Position].GameId))
{
var gameIntent = new Intent(Activity, typeof(GameActivity));
gameIntent.PutExtra("GameId", _gamesList[e.Position].GameId);
StartActivity(gameIntent);
}
};
searchEditText.KeyPress += (object sender, View.KeyEventArgs e) =>
{
if(e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter)
{
_searchButton.PerformClick();
}
else
{
e.Handled = false;
}
};
return view;
}
示例4: SetCommand_OnButtonWithBinding_ParameterShouldUpdate
public void SetCommand_OnButtonWithBinding_ParameterShouldUpdate()
{
var value = DateTime.Now.Ticks.ToString();
var vmSource = new TestViewModel
{
Model = new TestModel
{
MyProperty = value
}
};
var vmTarget = new TestViewModel();
var button = new Button(Application.Context);
var binding = new Binding<string, string>(
vmSource,
() => vmSource.Model.MyProperty);
button.SetCommand(
"Click",
vmTarget.SetPropertyCommand,
binding);
Assert.IsNull(vmTarget.TargetProperty);
button.PerformClick();
Assert.AreEqual(value, vmTarget.TargetProperty);
value += "Test";
vmSource.Model.MyProperty = value;
button.PerformClick();
Assert.AreEqual(value, vmTarget.TargetProperty);
}
示例5: SetCommand_WithICommandOnButtonNoValueNoEventName_ClickEventShouldBeUsed
public void SetCommand_WithICommandOnButtonNoValueNoEventName_ClickEventShouldBeUsed()
{
var vmTarget = new TestViewModel();
var button = new Button(Application.Context);
button.SetCommand(vmTarget.TestCommandImpl);
var castedCommand = (CommandImpl)vmTarget.TestCommandImpl;
Assert.IsNull(castedCommand.Parameter);
button.PerformClick();
Assert.AreEqual(TestViewModel.ValueForCommand, castedCommand.Parameter);
}
示例6: SetCommand_OnButtonWithSimpleValue_NoError
public void SetCommand_OnButtonWithSimpleValue_NoError()
{
var value = DateTime.Now.Ticks.ToString();
var vmTarget = new TestViewModel();
var button = new Button(Application.Context);
button.SetCommand(
"Click",
vmTarget.SetPropertyCommand,
value);
Assert.IsNull(vmTarget.TargetProperty);
button.PerformClick();
Assert.AreEqual(value, vmTarget.TargetProperty);
}
示例7: OnCreateView
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
Log.Debug (tag, "Iniciamos");
este = new MainActivity ();
View view = inflater.Inflate (Resource.Layout.Fragment1, container, false);
getimg = view.FindViewById<Button> (Resource.Id.getimgsciudades);
mazatlan = view.FindViewById<ImageView> (Resource.Id.mazatlan_img);
torreon = view.FindViewById<ImageView> (Resource.Id.torreon_img);
zacatecas = view.FindViewById<ImageView> (Resource.Id.zacatecas_img);
durango = view.FindViewById<ImageView> (Resource.Id.durango_img);
//var webClient = new WebClient ();
regs [0] = mazatlan;
regs [1] = torreon;
regs [2] = zacatecas;
regs [3] = durango;
Log.Debug (tag, "Asignamos");
getimg.Click += async (sender, e) => {
Log.Debug(tag,"GET IMG CLICK!!!!");
try{
Log.Debug(tag,"GET IMG CLICK EN EL TRY!!!");
imagenes_array = await FetchWeatherAsync("http://plif.mx/mobile/get_img_index");
objeto =imagenes_array["respuesta"];
foreach(JsonObject data in objeto){
Log.Debug (tag, "LA RUTA: "+data["data"]["ruta"]);
Koush.UrlImageViewHelper.SetUrlDrawable (regs[counter], extra+data["data"]["ruta"], Resource.Drawable.bolaplace);
counter++;
}
}catch(Exception ex){
Log.Debug (tag, "ERROR FETCHING IMAGE: "+ex);
Toast.MakeText (Application.Context, "Ocurrió un error al recuperar las imágenes del inicio", ToastLength.Long).Show ();
counter++;
}
counter=0;
};
getimg.PerformClick ();
Log.Debug (tag, "Perform Click");
durango.Click += delegate {
var myActivity = (MainActivity) this.Activity;
myActivity.BusquedaRegion("9");
};
torreon.Click += delegate {
Toast.MakeText (Application.Context, "Próximamente...", ToastLength.Long).Show ();
};
zacatecas.Click += delegate {
Toast.MakeText (Application.Context, "Próximamente...", ToastLength.Long).Show ();
};
torreon.Click += delegate {
Toast.MakeText (Application.Context, "Próximamente...", ToastLength.Long).Show ();
};
Log.Debug (tag, "Terminamos y RETURN VIEW");
return view;
}
示例8: ToggleDropDown
protected virtual void ToggleDropDown()
{
var button = new Button(finder.Child(AutomationSearchCondition.ByControlType(ControlType.Button)), actionListener);
button.PerformClick();
}
示例9: OnCreate
//.........这里部分代码省略.........
califspan.Text="3.0";
calificacion=3;
e1.SetImageResource(Resource.Drawable.estrellafull);
e2.SetImageResource(Resource.Drawable.estrellafull);
e3.SetImageResource(Resource.Drawable.estrellafull);
e4.SetImageResource(Resource.Drawable.estrellaempty);
e5.SetImageResource(Resource.Drawable.estrellaempty);
};
e4.Click += delegate(object sender, EventArgs e) {
califspan.StartAnimation(flip);
califspan.Text="4.0";
calificacion=4;
e1.SetImageResource(Resource.Drawable.estrellafull);
e2.SetImageResource(Resource.Drawable.estrellafull);
e3.SetImageResource(Resource.Drawable.estrellafull);
e4.SetImageResource(Resource.Drawable.estrellafull);
e5.SetImageResource(Resource.Drawable.estrellaempty);
};
e5.Click += delegate(object sender, EventArgs e) {
califspan.StartAnimation(flip);
califspan.Text="5.0";
calificacion=5;
e1.SetImageResource(Resource.Drawable.estrellafull);
e2.SetImageResource(Resource.Drawable.estrellafull);
e3.SetImageResource(Resource.Drawable.estrellafull);
e4.SetImageResource(Resource.Drawable.estrellafull);
e5.SetImageResource(Resource.Drawable.estrellafull);
};
e5.PerformClick ();
//nenenenenenene
addimg.Click += async (object sender, EventArgs e) => {
layoutdejaimagenes.Visibility=ViewStates.Visible;
};
deleteimgrev.Click += async (sender, e) => {
GridLayout imgcomprev = FindViewById<GridLayout> (Resource.Id.imgcomprev);
LinearLayout imgcontainercomprev = FindViewById<LinearLayout> (Resource.Id.imgcontainercomprev);
Log.Debug("DELETEBUTTON","Inician las layouts");
if(imgcomprev.ChildCount>0){
imgcomprev.RemoveAllViews();
}
Log.Debug("DELETEBUTTON","vistas removidas");
if(imagencomentario!=null){
imagencomentario.Recycle();
imagencomentario=null;
}
Log.Debug("DELETEBUTTON","reciclado");
//deleteimgrev.Visibility=ViewStates.Gone;
Log.Debug("DELETEBUTTON","se oculta boton borrar (deprecated)");
imgcontainercomprev.Visibility=ViewStates.Gone;
Log.Debug("DELETEBUTTON","se oculta el contenedor de subir imagenes");
imagenrev = FindViewById<Button> (Resource.Id.imagenrev);
imagenrev.Visibility=ViewStates.Visible;
Log.Debug("DELETEBUTTON","se muestra el boton añadir");