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


C# NSAutoreleasePool.Release方法代码示例

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


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

示例1: Run

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

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

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

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

示例3: DoComputation

        private void DoComputation()
        {
            NSAutoreleasePool pool = new NSAutoreleasePool ();

            RayTracer rayTracer = new RayTracer (width, height, (int x, int y, NSColor color) =>
            {
                this.imageRep.SetColorAtXy (color, x, y);
                if (x == 0) {
                    this.imageView.PerformSelectorOnMainThreadWithObjectWaitUntilDone (ObjectiveCRuntime.Selector ("setNeedsDisplay"), null, false);
                }
            });
            rayTracer.Render (rayTracer.DefaultScene);

            this.imageView.PerformSelectorOnMainThreadWithObjectWaitUntilDone (ObjectiveCRuntime.Selector ("setNeedsDisplay"), null, false);

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

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

示例5: ConvertTo

			/// <summary>
			/// Converts the given value object to the specified type, using the specified context and culture information.
			/// </summary>
			/// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that provides a format context.</param>
			/// <param name="culture">A <see cref="T:System.Globalization.CultureInfo"/>. If null is passed, the current culture is assumed.</param>
			/// <param name="value">The <see cref="T:System.Object"/> to convert.</param>
			/// <param name="destinationType">The <see cref="T:System.Type"/> to convert the <paramref name="value"/> parameter to.</param>
			/// <returns>
			/// An <see cref="T:System.Object"/> that represents the converted value.
			/// </returns>
			/// <exception cref="T:System.ArgumentNullException">
			/// The <paramref name="destinationType"/> parameter is null.
			/// </exception>
			/// <exception cref="T:System.NotSupportedException">
			/// The conversion cannot be performed.
			/// </exception>
			public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
			{
				NSAutoreleasePool pool = null;
				try {
					// As pool are scoped, it does not hurt if we create ours during the method call.
					pool = new NSAutoreleasePool ();

					if (destinationType != typeof(byte[])) {
						return base.ConvertTo (context, culture, value, destinationType);
					}
					if (value == null) {
						return new byte[0];
					}

					// The byte buffer returned will always be a TIFF representation for simplicity reasons.
					NSImage image = (NSImage)value;
					NSData data = image.TIFFRepresentation;
					return data.GetBuffer ();
				} finally {
					if (pool != null) {
						pool.Release ();
					}
				}
			}
开发者ID:Monobjc,项目名称:monobjc,代码行数:40,代码来源:NSImage.ISerializable.cs


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