我在Global.asax.cs中声明了一个委托:
val dialogBuilder = AlertDialog.Builder(activity)
val inflater = activity?.layoutInflater
val dialogView = inflater?.inflate(R.layout.newly_dialog, null)
dialogBuilder.setView(dialogView)
val tvPopText = dialogView?.findViewById<View>(R.id.tvPopText) as TextView
val dBuilder = dialogBuilder.create()
//-----> Issue :(
var viewGroup = dBuilder.window.decorView
viewGroup.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.slide_down))
//-----> Issue
dBuilder.show()
在application_start中:
Delegate List<NewData> DelegateNewData();
public class Global : System.Web.HttpApplication
{
DelegateNewData delNewData;
}
步骤:
protected void Application_Start(object sender, EventArgs e)
{
delNewData = new DelegateNewData(GetList.GetNewData);
}
但使用private void getData()
{
//i need to invoke the delegate here like
this.invoke(delNewData,new object[]{});
}
无效,因为它只使用控件和表单。
我的问题是:
如何在this
程序中调用委托;?
有可能吗?
感谢。
答案 0 :(得分:1)
您可以像调用函数一样调用它:
private void getData() {
delNewData();
}