• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# NSAutoreleasePool类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NSAutoreleasePool的典型用法代码示例。如果您正苦于以下问题:C# NSAutoreleasePool类的具体用法?C# NSAutoreleasePool怎么用?C# NSAutoreleasePool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NSAutoreleasePool类属于命名空间,在下文中一共展示了NSAutoreleasePool类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: 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


示例2: backgroundWorker_RunWorkerCompleted

        // This event handler deals with the results of the
        // background operation.
        private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            NSAutoreleasePool pool = new NSAutoreleasePool();

            // First, handle the case where an exception was thrown.
            if (e.Error != null)
            {
                // TODO
            }
            else if (e.Cancelled)
            {
                this.labelResult.StringValue = "Canceled";
            }
            else
            {
                this.labelResult.StringValue = "Fibonacci result for " + this.numberToCompute + " iterations is " + e.Result;
            }

            this.progressIndicator.DoubleValue = 0.0d;

            this.buttonStart.IsEnabled = true;
            this.buttonStop.IsEnabled = false;

            pool.Release();
        }
开发者ID:Monobjc,项目名称:monobjc-samples,代码行数:27,代码来源:AppController.cs


示例3: FinishedLaunching

		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching(UIApplication app, NSDictionary options)
		{	
			//HttpDebug.Start (); 

			MonoMobileApplication.NavigationController = new NavigationController();
			MonoMobileApplication.Window = new UIWindow(UIScreen.MainScreen.Bounds);

			MonoMobileApplication.Window.AddSubview(MonoMobileApplication.NavigationController.View);
			MonoMobileApplication.Window.MakeKeyAndVisible();

			MonoMobileApplication.NavigationController.View.Alpha = 0.0f;
	
#if DEBUG
			var thread = new System.Threading.Thread(() =>
			{
				using (NSAutoreleasePool pool = new NSAutoreleasePool())
				{
					InvokeOnMainThread(()=> { Startup(); });
				}
			});
			
			thread.Start();
#else
			InvokeOnMainThread(()=> { Startup(); });
#endif
			return true;
		}
开发者ID:RobertKozak,项目名称:MonoMobile.Views,代码行数:28,代码来源:MonoMobileAppDelegate.cs


示例4: ShowProgressDialog

        public static void ShowProgressDialog(string title, string message, Action action, Action finalize) {
            UIAlertView dialog = new UIAlertView(title, message, null, null);

            dialog.Show();
			_indicatorViewLeftCorner.Hidden = false;

            ThreadPool.QueueUserWorkItem(delegate
            {
                // Run the given Async task
                action();

                // Run the completion handler on the UI thread and remove the spinner
                using (var pool = new NSAutoreleasePool())
                {
                    try
                    {
                        pool.InvokeOnMainThread(() =>
                        {
                            dialog.DismissWithClickedButtonIndex(0, true);

							_indicatorViewLeftCorner.Hidden = true;
                            finalize();
                      });
                    }
					catch (Exception ex){
						Insights.Report(ex);
                    }
                }
            });

        }
开发者ID:MBrekhof,项目名称:pleiobox-clients,代码行数:31,代码来源:DialogHelper.cs


示例5: Encode

        /// <summary>
        /// Encodes a frame.
        /// </summary>
        /// <param name="frame">The frame.</param>
        /// <returns></returns>
        public override byte[] Encode(AudioBuffer frame)
		{
			if (_Encoder == null)
			{
				_Encoder = new CocoaOpusEncoder(ClockRate, Channels, PacketTime);
                _Encoder.Quality = 1.0;
                _Encoder.Bitrate = 125;
			}

			using (var pool = new NSAutoreleasePool())
			{
				GCHandle dataHandle = GCHandle.Alloc(frame.Data, GCHandleType.Pinned);
				try
				{
					IntPtr dataPointer = dataHandle.AddrOfPinnedObject();

					using (var buffer = new CocoaOpusBuffer {
						Data = NSData.FromBytesNoCopy(dataPointer, (uint)frame.Data.Length, false),
						Index = frame.Index,
						Length = frame.Length
					})
					{
						using (var encodedFrameData = _Encoder.EncodeBuffer(buffer))
						{
							return encodedFrameData.ToArray();
						}
					}
				}
				finally
				{
					dataHandle.Free();
				}
			}
        }
开发者ID:QuickBlox,项目名称:quickblox-dotnet-sdk,代码行数:39,代码来源:OpusCodec.cs


示例6: Startup

		private void Startup()
		{
			using (var pool = new NSAutoreleasePool()) 
			{
				InvokeOnMainThread(delegate 
				{
					foreach(var view in MonoMobileApplication.Views)
					{	
						var title = MonoMobileApplication.Title;
						if (view is IView)
							title = ((IView)view).Caption;

						var binding = new BindingContext(view, title);
						MonoMobileApplication.DialogViewControllers.Add(new DialogViewController(UITableViewStyle.Grouped, binding, true) { Autorotate = true } );
					}

					_Navigation.ViewControllers = MonoMobileApplication.DialogViewControllers.ToArray();

					MonoMobileApplication.CurrentDialogViewController = _Navigation.ViewControllers.First() as DialogViewController;

					UIView.BeginAnimations("fadeIn");
					UIView.SetAnimationDuration(0.3f);
					_Navigation.View.Alpha = 1.0f;
					UIView.CommitAnimations();
				});
			}
		}
开发者ID:follesoe,项目名称:MonoMobile.MVVM,代码行数:27,代码来源:MonoMobileAppDelegate.cs


示例7: DidOutputSampleBuffer

		public override void DidOutputSampleBuffer (AVCaptureOutput captureOutput, CMSampleBuffer sampleBuffer, AVCaptureConnection connection)
		{
			try {
				connection.VideoOrientation = AVCaptureVideoOrientation.Portrait;

				using (var image = ImageFromSampleBuffer (sampleBuffer)){
					if(_CurrentState.didKnock){
						KnockCount++;

						if(KnockCount==1){
							_CurrentState.CountDown = 5;

							InvokeOnMainThread (delegate {  
								_CurrentState.TopLabel.Text = "Knock Again to Post!!";
								_CurrentState.BottomLabel.Text = "Knock to Post: 5 sec";
							});

						}else if(KnockCount==40){
							_CurrentState.CountDown = 4;
							InvokeOnMainThread (delegate {
								_CurrentState.BottomLabel.Text = "Knock to Post: 4 sec";
							});
						}else if(KnockCount==80){
							_CurrentState.CountDown = 3;
							InvokeOnMainThread (delegate {
								_CurrentState.BottomLabel.Text = "Knock to Post: 3 sec";
							});
						}else if(KnockCount==120){
							_CurrentState.CountDown = 2;
							InvokeOnMainThread (delegate {  
								_CurrentState.BottomLabel.Text = "Knock to Post: 2 sec";
							});
						}else if(KnockCount==160){
							_CurrentState.CountDown = 1;
							InvokeOnMainThread (delegate {  
								_CurrentState.BottomLabel.Text = "Knock to Post: 1 sec";
							});
						}else if(KnockCount>200){
							InvokeOnMainThread (delegate {  
								_CurrentState.TopLabel.Text = "Follow @JoesDoor on Twitter";
								_CurrentState.BottomLabel.Text = "Knock to take a photo";
							});
							KnockCount=0;
							_CurrentState.CountDown = 0;
							_CurrentState.didKnock=false;

						}
					}else{
						InvokeOnMainThread(delegate {
							using (var pool = new NSAutoreleasePool ()) {
								_CurrentState.DisplayImageView.Image = image;
							}
						});
					}
				}
				sampleBuffer.Dispose ();
			} catch (Exception e){
				Console.WriteLine (e);
			}
		}
开发者ID:JosephWetzel,项目名称:joesdoor,代码行数:60,代码来源:OutputRecorder.cs


示例8: Call

 public override ICallControl Call(string phoneNumber, CallType type)
 {
     if (CallType.Voice.Equals (type)) {
         using (var pool = new NSAutoreleasePool ()) {
             StringBuilder filteredPhoneNumber = new StringBuilder();
             if (phoneNumber!=null && phoneNumber.Length>0) {
                 foreach (char c in phoneNumber) {
                     if (Char.IsNumber(c) || c == '+' || c == '-' || c == '.') {
                         filteredPhoneNumber.Append(c);
                     }
                 }
             }
             String textURI = "tel:" + filteredPhoneNumber.ToString();
             var thread = new Thread (InitiateCall);
             thread.Start (textURI);
         }
         ;
     } else {
         INotification notificationService = (INotification)IPhoneServiceLocator.GetInstance ().GetService ("notify");
         if (notificationService != null) {
             notificationService.StartNotifyAlert ("Phone Alert", "The requested call type is not enabled or supported on this device.", "OK");
         }
     }
     return null;
 }
开发者ID:jioe,项目名称:appverse-mobile,代码行数:25,代码来源:IPhoneTelephony.cs


示例9: Game

        public Game(float width, float height)
            : base(width, height)
        {
            using (NSAutoreleasePool pool = new NSAutoreleasePool ())
            {
                AddChild (SPImage.ImageWithContentsOfFile ("Default.png"));

                mMainMenu = new SPSprite();
                AddChild (mMainMenu);

                mMainMenu.AddChild (SPImage.ImageWithContentsOfFile ("logo.png"));

                SPTexture sceneButtonTexture = SPTexture.TextureWithContentsOfFile ("button_big.png");

                atlasButton = SPButton.ButtonWithUpState (sceneButtonTexture, "Texture Atlas");
                atlasButton.AddEventListener (onAtlasButtonTriggered, SPEvents.ButtonTriggered);
                addSceneButton (atlasButton);

                SPTexture backButtonTexture = SPTexture.TextureWithContentsOfFile ("button_back.png");
                mBackButton = new SPButton (backButtonTexture, "back");
                mBackButton.Visible = false;
                mBackButton.X = (int)(Stage.Width - mBackButton.Width) / 2;
                mBackButton.Y = Stage.Height - mBackButton.Height + 1;
                mBackButton.AddEventListener (onBackButtonTriggered, SPEvents.ButtonTriggered);
                AddChild (mBackButton);

            //			SPJuggler jug = this.Stage.Juggler;
            //			jug.DelayInvocationAtTarget (this, 5.0).PerformSelector (new Selector ("onAtlasButtonTriggered:"), null, 0);
            }
        }
开发者ID:goosefx,项目名称:Sparrow,代码行数:30,代码来源:Game.cs


示例10: DoSomething

// Uncomment to demonstrate UIActiviyIndicatorView
//        void HandleShowActivityButtonTouchUpInside (object sender, EventArgs e)
//        {
//            _activityView = new UIActivityIndicatorView ();
//            
//            _activityView.Frame = new RectangleF (0, 0, 50, 50);
//            _activityView.Center = View.Center;
//            
//            _activityView.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;
//            View.AddSubview (_activityView);
//            _activityView.StartAnimating ();
//            
//            Thread t = new Thread (DoSomething);
//            t.Start ();
//        }

        void DoSomething ()
        {
            Thread.Sleep (3000);
            
            using (var pool = new NSAutoreleasePool ()) {
                this.InvokeOnMainThread (delegate { _activityView.StopAnimating (); });
            }
        }
开发者ID:enricos,项目名称:learning_monotouch_code,代码行数:24,代码来源:DemoController.xib.cs


示例11: Run

        private static void Run()
        {
            NSAutoreleasePool pool = new NSAutoreleasePool ();

            Console.WriteLine ("Hello World !!!");

            pool.Release ();
        }
开发者ID:Monobjc,项目名称:monobjc-samples,代码行数:8,代码来源:Program.cs


示例12: GetObjectData

		/// <summary>
		/// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo"/> with the data needed to serialize the target object.
		/// </summary>
		/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> to populate with data.</param>
		/// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext"/>) for this serialization.</param>
		/// <exception cref="T:System.Security.SecurityException">
		/// The caller does not have the required permission.
		/// </exception>
		public void GetObjectData (SerializationInfo info, StreamingContext context)
		{
			// As pool are scoped, it does not hurt if we create ours during the method call.
			using (NSAutoreleasePool pool = new NSAutoreleasePool()) {
				NSData data = this.TIFFRepresentation;
				info.AddValue ("Data", data.GetBuffer (), typeof(byte[]));
			}
		}
开发者ID:Monobjc,项目名称:monobjc,代码行数:16,代码来源:NSImage.ISerializable.cs


示例13: HideSearchingView

 public void HideSearchingView()
 {
     using(var pool = new NSAutoreleasePool()) {
         pool.BeginInvokeOnMainThread(() => {
             IsSearching = false;
             _SearchingView.Hidden = true;
         });
     }
 }
开发者ID:ZAD-Man,项目名称:Zadify,代码行数:9,代码来源:DrugSearchViewController.cs


示例14: Main

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		static void Main (string[] args)
		{
			NSApplication.Init ();

			using (var p = new NSAutoreleasePool ()) {
				NSApplication.SharedApplication.Delegate = new AppDelegate ();
				NSApplication.Main (args);
			}
		}
开发者ID:nilllzz,项目名称:Pokemon3D,代码行数:12,代码来源:Program.cs


示例15: SetRequestInterval

 public override bool SetRequestInterval(double intervalInSeconds)
 {
     using (var pool = new NSAutoreleasePool ()) {
         Thread thread = new Thread (SetRequestIntervalThread);
         thread.Priority = ThreadPriority.AboveNormal;
         thread.Start ((object)intervalInSeconds);
     }
     return true;
 }
开发者ID:jioe,项目名称:appverse-mobile,代码行数:9,代码来源:IPhoneWebtrekk.cs


示例16: Startup

		private void Startup ()
		{
			using (var pool = new NSAutoreleasePool ()) {
				InvokeOnMainThread (delegate {
					var binding = new BindingContext (new MovieListView (), "Movie List View");
					navigation.ViewControllers = new UIViewController[] { new DialogViewController (binding.Root, true) };
				});
			}
		}
开发者ID:briandonahue,项目名称:MonoTouch.MVVM,代码行数:9,代码来源:AppDelegateIPad.cs


示例17: backgroundWorker_ProgressChanged

        // This event handler updates the progress bar.
        private void backgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            NSAutoreleasePool pool = new NSAutoreleasePool();

            this.progressIndicator.DoubleValue = e.ProgressPercentage;
            this.labelResult.StringValue = "Progress is " + e.ProgressPercentage + "%";

            pool.Release();
        }
开发者ID:Monobjc,项目名称:monobjc-samples,代码行数:10,代码来源:AppController.cs


示例18: HandleThreadMethod

        protected override void HandleThreadMethod()
        {
            using(var pool = new NSAutoreleasePool())
            {
                // Run code in new thread
                clientInfo.BeginReceive();

            }
        }
开发者ID:jioe,项目名称:appverse-mobile,代码行数:9,代码来源:IPhoneHandlerThread.cs


示例19: Start

 public void Start()
 {
     using(var pool = new NSAutoreleasePool())
     {
         ThreadStart threadDelegate = new ThreadStart (HandleThreadMethod);
         Thread thread = new Thread (threadDelegate);
         thread.Start ();
     }
 }
开发者ID:thomascLM,项目名称:appverse-core,代码行数:9,代码来源:HandlerThread.cs


示例20: DownloadFile

 public override bool DownloadFile(string url)
 {
     using (var pool = new NSAutoreleasePool ()) {
         NSUrl urlParam = new NSUrl (Uri.EscapeUriString(url));
         var thread = new Thread (OpenUrlOnThread);
         thread.Start (urlParam);
     }
     return true;
 }
开发者ID:jioe,项目名称:appverse-mobile,代码行数:9,代码来源:IPhoneNet.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NSBundle类代码示例发布时间:2022-05-24
下一篇:
C# NSApplication类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap