当前位置: 首页>>代码示例>>C#>>正文


C# NSAutoreleasePool.BeginInvokeOnMainThread方法代码示例

本文整理汇总了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;
         });
     }
 }
开发者ID:ZAD-Man,项目名称:Zadify,代码行数:9,代码来源:DrugSearchViewController.cs

示例2: Handle_RetreivedResultAction

		void Handle_RetreivedResultAction(bool result)
		{
			if(result)
			{
				feeds = new FeedsController();
				using(var pool = new NSAutoreleasePool())
				{
					pool.BeginInvokeOnMainThread(()=>{
						PushViewController(feeds, true);
					});
				}
				
				
			}
		}
开发者ID:anujb,项目名称:CrmDynamicsOnline.Sample,代码行数:15,代码来源:MainNavController.cs

示例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);
				});
			}
		}
开发者ID:ahsan-rana,项目名称:Devnos.Popover,代码行数:16,代码来源:SamplePopover.cs

示例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();
					}
				});
			}
		}
开发者ID:Rajneesh360Logica,项目名称:monotouch-samples,代码行数:12,代码来源:UtilitiesViewController.cs

示例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();
					}
				});
			}
		}
开发者ID:anujb,项目名称:Xamarin.BindingSample,代码行数:19,代码来源:CustomViewController.cs

示例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();
                });
            }
        }
开发者ID:anujb,项目名称:MapWithRoutes,代码行数:15,代码来源:MapView.cs

示例7: UpdateResultElement

        private void UpdateResultElement(string result)
        {
            ResultElement.Value = result;

            using(var pool = new NSAutoreleasePool()) {
                pool.BeginInvokeOnMainThread(()=>{
                    this.ReloadData();
                });
            }
        }
开发者ID:Clancey,项目名称:Bitly-sharp,代码行数:10,代码来源:BitlyViewController.cs

示例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"));
		}
开发者ID:anujb,项目名称:CrmDynamicsOnline.Sample,代码行数:17,代码来源:LoginViewController.cs

示例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();
                });
            }
        }
开发者ID:anujb,项目名称:MultitaskingHttp,代码行数:30,代码来源:CustomerViewController.cs

示例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();
				});
			}
		}
开发者ID:CodeSensei,项目名称:mobile-samples,代码行数:20,代码来源:DrugViewController.cs

示例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);
        }
开发者ID:anujb,项目名称:MultitaskingHttp,代码行数:48,代码来源:RootViewController.cs

示例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();
                    });
                }
            }
        }
开发者ID:ReinerHA,项目名称:mobile-samples,代码行数:26,代码来源:DrugImageViewController.cs


注:本文中的NSAutoreleasePool.BeginInvokeOnMainThread方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。