我有一个带有两个按钮的UIAlertView的是/否对话框.我希望在我的方法中实现类似于此的逻辑:
if(messagebox.Show() == DialogResult.OK)
Run Code Online (Sandbox Code Playgroud)
问题是,如果我调用UIAlertView.Show(),该过程将继续.但我需要等待用户交互的结果,并在单击第二个按钮时返回true或false depanding.MonoTouch有可能吗?
我正在尝试通读 ActiveMQ 消息并根据一些过滤器来处理其中一些消息或将其他消息留在队列中。我将 NMS API 与以下代码一起使用:
Uri connecturi = new Uri("activemq:tcp://model.net:61616");
IConnectionFactory factory = new NMSConnectionFactory(connecturi);
List<ModelBuilderBase> result = new List<ModelBuilderBase>();
using (IConnection connection = factory.CreateConnection())
using (ISession session = connection.CreateSession())
{
IDestination destination = SessionUtil.GetDestination(session, "queue://cidModelbuilderQ");
using (IMessageConsumer consumer = session.CreateConsumer(destination))
{
connection.Start();
ITextMessage message;
while ((message = consumer.ReceiveNoWait() as ITextMessage) != null)
{
if (message.Properties[MANDATOR] == null || message.Properties[REFCODE] == null)
continue;
var mandator = message.Properties[MANDATOR].ToString();
var refCode = message.Properties[REFCODE].ToString();
result.Add(ModelBuilderFactory.Instance.GetInstance(refCode, mandator));
}
}
Run Code Online (Sandbox Code Playgroud)
问题是收到消息后,消息被删除。我可以以某种方式更改此行为并仅在成功处理后手动删除消息吗?}
我有一个适用于iPad的MonoTouch应用程序(iOS 4.2).我有一个主窗口,显示一个按钮和一个导航栏.当我单击此按钮时,我想显示另一个控件从Web加载一些数据.我实例化UIAlertView并调用Show方法.比我为新控件调用数据加载,然后完成后我会显示新控件.我的问题是,在调用alert.Show()后,没有显示任何内容,只有背景按预期更改.在我呈现新控件后显示警报本身.我的代码:
public void EnterCloudControl(TagCloudItem item)
{
using(UIAlertView loadingDialog = new UIAlertView("title", "message", null, "ok", null))
{
loadingDialog.Show();
MyContentCloudController cc = new MyContentCloudController(ContentFrame, this);
NavigationController.PushViewController(cc, true);
cc.LoadData(item, DateTime.Now.AddDays(-30), null, string.Format("&Filter={0}{2};Equal;{1}", item.Field, item.Tag,
item.Field == "http://schemas.cid.biz/ps/nlp/entities" ? ",Label" : string.Empty), null);
cc.SetupNavigationBar();
loadingDialog.DismissWithClickedButtonIndex(0, true);
}
}
Run Code Online (Sandbox Code Playgroud)