本文整理汇总了C#中NSAutoreleasePool.BeginInvokeOnMainThread方法的典型用法代码示例。如果您正苦于以下问题:C# NSAutoreleasePool.BeginInvokeOnMainThread方法的具体用法?C# NSAutoreleasePool.BeginInvokeOnMainThread怎么用?C# NSAutoreleasePool.BeginInvokeOnMainThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NSAutoreleasePool
的用法示例。
在下文中一共展示了NSAutoreleasePool.BeginInvokeOnMainThread方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HideSearchingView
public void HideSearchingView()
{
using(var pool = new NSAutoreleasePool()) {
pool.BeginInvokeOnMainThread(() => {
IsSearching = false;
_SearchingView.Hidden = true;
});
}
}
示例2: Handle_RetreivedResultAction
void Handle_RetreivedResultAction(bool result)
{
if(result)
{
feeds = new FeedsController();
using(var pool = new NSAutoreleasePool())
{
pool.BeginInvokeOnMainThread(()=>{
PushViewController(feeds, true);
});
}
}
}
示例3: PresentFromRect
public static void PresentFromRect(RectangleF rect, UIView inView, UIPopoverArrowDirection arrowDirection)
{
if(_Popover.ShouldDismiss == null) {
_Popover.ShouldDismiss += (controller) => { return true; };
}
if(_Popover.DidDismiss == null) {
_Popover.DidDismiss += (controller) => { Console.WriteLine("Popover Did Dismiss"); };
}
using(var pool = new NSAutoreleasePool()) {
pool.BeginInvokeOnMainThread(()=> {
_Popover.PresentPopover(rect, inView, arrowDirection, true);
});
}
}
示例4: SetResultElementValue
public void SetResultElementValue(string @value)
{
using(var pool = new NSAutoreleasePool()) {
pool.BeginInvokeOnMainThread(() => {
var e = Root[2][0] as StringElement;
if(e != null) {
e.Caption = value;
this.TableView.ReloadData();
}
});
}
}
示例5: Handle_CustomViewViewWasTouched
private void Handle_CustomViewViewWasTouched (object sender, EventArgs e)
{
var customView = sender as XMCustomView;
if(customView == null) {
return;
}
// Remember, the block of this method is called on a Background Thread...
// In order to push a notification to the view we need to call within the scope of the main thread.
using(var pool = new NSAutoreleasePool()) {
pool.BeginInvokeOnMainThread(() => {
using(var alert = new UIAlertView("View Was Touched", "Our bound XMCustomView was Touched!", null, "OK, Cool!", null)) {
alert.Show();
}
});
}
}
示例6: UpdateMap
private void UpdateMap(PlaceMark from, PlaceMark to)
{
using(var pool = new NSAutoreleasePool())
{
pool.BeginInvokeOnMainThread(()=>
{
_MapView.AddAnnotation(new MKAnnotation[] { from, to });
_MapView.SetRegion(new MKCoordinateRegion(from.Coordinate, new MKCoordinateSpan(0.2, 0.2)), true);
UpdateRouteView();
CenterMap();
});
}
}
示例7: UpdateResultElement
private void UpdateResultElement(string result)
{
ResultElement.Value = result;
using(var pool = new NSAutoreleasePool()) {
pool.BeginInvokeOnMainThread(()=>{
this.ReloadData();
});
}
}
示例8: Handle_SubmitButtonClicked
void Handle_SubmitButtonClicked()
{
if(_WebView.IsLoading)
return;
using(var pool = new NSAutoreleasePool())
{
pool.BeginInvokeOnMainThread(()=>{
_SubmitElement.Caption = "Processing...";
Root[0].Add(new ActivityElement());
this.TableView.ReloadData();
});
}
_WebView.LoadHtmlString(Response.Content, new NSUrl(@"https://signin.crm.dynamics.com"));
}
示例9: RefreshCustomers
public void RefreshCustomers()
{
this.Root.Clear();
this.Root.Add(new Section("") {
new StringElement("Refresh", RefreshCustomers)
});
var json = NSUserDefaults.StandardUserDefaults.StringForKey("customers");
if(string.IsNullOrWhiteSpace(json) == false) {
Customers = JsonSerializer.DeserializeFromString<IEnumerable<Customer>>(json).ToList();
}
if(Customers.Any()) {
var section = new Section("Customers");
foreach(var customer in Customers) {
var desc = string.Format("Customer Name: {0} -- Address: {1}", customer.Name, customer.Address);
section.Add(new StringElement(desc));
}
this.Root.Add(section);
}
using (var pool = new NSAutoreleasePool()) {
pool.BeginInvokeOnMainThread(()=>{
this.ReloadData();
});
}
}
示例10: FinishedGettingDrugConcept
private void FinishedGettingDrugConcept(RxTerm term)
{
var section = new Section();
section.Add(new StringElement("Brand Name: ", term.BrandName));
section.Add(new StringElement("Display Name: ", term.DisplayName));
section.Add(new StringElement("Synonym: ", term.Synonym));
section.Add(new StringElement("Full Name: ", term.FullName));
section.Add(new StringElement("Full Generic Name: ", term.FullGenericName));
section.Add(new StringElement("View Image!", () => { PushDrugImageView(term); }));
using(var pool = new NSAutoreleasePool()) {
pool.BeginInvokeOnMainThread(()=>{
this.Root.Clear();
this.Root.Add(section);
this.TableView.ReloadData();
});
}
}
示例11: LoadView
public override void LoadView()
{
base.LoadView();
this.View.BackgroundColor = UIColor.White;
_ResponseLabel = new UILabel();
_ResponseLabel.Text = "Click to send Request";
_ResponseLabel.Frame = new System.Drawing.RectangleF(25, 300, View.Frame.Width - 50, 55);
_ResponseLabel.TextColor = UIColor.Black;
this.View.AddSubview(_ResponseLabel);
var button = UIButton.FromType(UIButtonType.RoundedRect);
button.Frame = new System.Drawing.RectangleF(25, 150, View.Frame.Width - 50, 55);
button.SetTitle("Add Customer!", UIControlState.Normal);
button.TouchUpInside += delegate {
try {
var req = new RestRequest("", Method.PUT);
req.Timeout = (int)TimeSpan.FromSeconds(5).TotalMilliseconds;
var customer = new Customer {
Id = _Random.Next(1, 100),
Name = Names[_Random.Next(0, 8)],
Address = string.Format(@"{0} FARFLUFFLE on {1} STREET", _Random.Next(1, 1000), _Random.Next(1, 100)),
};
var body = JsonSerializer.SerializeToString<Customer>(customer);
Console.WriteLine(body);
req.AddParameter("body", body, ParameterType.RequestBody);
var response = _Client.Execute(req);
Console.WriteLine("Response -- Code: {0} -- Content: {1} -- Error: {2}", response.StatusCode, response.Content, response.ErrorMessage);
using(var pool = new NSAutoreleasePool()) {
pool.BeginInvokeOnMainThread(()=>{
_ResponseLabel.Text = response.StatusCode == System.Net.HttpStatusCode.OK ? response.Content : "No Response from Server...";
});
}
} catch (Exception ex) {
Console.WriteLine(ex);
}
};
this.View.AddSubview(button);
}
示例12: FinishedDownloadingImage
private void FinishedDownloadingImage(string path)
{
if(File.Exists(path)){
using(var pool = new NSAutoreleasePool()) {
pool.BeginInvokeOnMainThread(() => {
var drugImageView = new UIImageView(UIImage.FromFile(path));
drugImageView.Frame = new RectangleF(0, 0, 448, 320);
_DrugScrollView.AddSubview(drugImageView);
});
}
}
else {
using(var pool = new NSAutoreleasePool()) {
pool.BeginInvokeOnMainThread(() => {
var alert = new UIAlertView ("", "No Image Found", null, "OK");
alert.AlertViewStyle = UIAlertViewStyle.Default;
alert.Dismissed += delegate {
// do something, go back maybe.
};
alert.Show();
});
}
}
}