本文整理汇总了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 ();
}
示例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();
}
示例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 ();
}
示例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();
}
示例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 ();
}
}
}