本文整理汇总了C#中MonoMac.Foundation.NSAutoreleasePool类的典型用法代码示例。如果您正苦于以下问题:C# NSAutoreleasePool类的具体用法?C# NSAutoreleasePool怎么用?C# NSAutoreleasePool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSAutoreleasePool类属于MonoMac.Foundation命名空间,在下文中一共展示了NSAutoreleasePool类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: StatusIcon
public StatusIcon() : base() {
using (var a = new NSAutoreleasePool()) {
this.CreateAnimationFrames();
this.status_item = NSStatusBar.SystemStatusBar.CreateStatusItem(28);
this.status_item.HighlightMode = true;
this.status_item.Image = this.animation_frames[0];
this.status_item.Image = this.animation_frames[0];
this.status_item.Image.Size = new SizeF(16, 16);
this.status_item.AlternateImage = this.animation_frames_active[0];
this.status_item.AlternateImage.Size = new SizeF(16, 16);
this.CreateMenu();
}
this.Controller.UpdateIconEvent += delegate(int icon_frame) {
using (var a = new NSAutoreleasePool()) {
BeginInvokeOnMainThread(delegate {
if (icon_frame > -1) {
this.status_item.Image = this.animation_frames[icon_frame];
this.status_item.Image.Size = new SizeF(16, 16);
this.status_item.AlternateImage = this.animation_frames_active[icon_frame];
this.status_item.AlternateImage.Size = new SizeF(16, 16);
} else {
this.status_item.Image = this.error_image;
this.status_item.AlternateImage = this.error_image_active;
this.status_item.Image.Size = new SizeF(16, 16);
this.status_item.AlternateImage.Size = new SizeF(16, 16);
}
});
}
};
this.Controller.UpdateMenuEvent += delegate {
using (var a = new NSAutoreleasePool()) {
this.InvokeOnMainThread(() => this.CreateMenu());
}
};
this.Controller.UpdateSuspendSyncFolderEvent += delegate(string reponame) {
using (var a = new NSAutoreleasePool()){
this.InvokeOnMainThread(delegate {
foreach (var repoItem in this.repoItems) {
if (repoItem.RepositoryName == reponame) {
foreach (var repo in Program.Controller.Repositories) {
if (repo.Name.Equals(reponame)) {
repoItem.Status = repo.Status;
break;
}
}
break;
}
}
});
}
};
}
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:60,代码来源:StatusIcon.cs
示例2: CreateWorkerThread
public override Thread CreateWorkerThread(Action act)
{
return new Thread (() => {
using (var pool = new NSAutoreleasePool ())
act ();
});
}
开发者ID:kelegorm,项目名称:awareness,代码行数:7,代码来源:MacPlatform.cs
示例3: SparkleUI
public SparkleUI()
{
// Use translations
Catalog.Init ("sparkleshare",
Path.Combine (NSBundle.MainBundle.ResourcePath, "Translations"));
using (NSAutoreleasePool pool = new NSAutoreleasePool ()) {
// Needed for Growl
GrowlApplicationBridge.WeakDelegate = this;
GrowlApplicationBridge.Delegate = new SparkleGrowlDelegate ();
NSApplication.SharedApplication.ApplicationIconImage
= NSImage.ImageNamed ("sparkleshare.icns");
SetFolderIcon ();
Font = NSFontManager.SharedFontManager.FontWithFamily
("Lucida Grande", NSFontTraitMask.Condensed, 0, 13);
BoldFont = NSFontManager.SharedFontManager.FontWithFamily
("Lucida Grande", NSFontTraitMask.Bold, 0, 13);
StatusIcon = new SparkleStatusIcon ();
Bubbles = new SparkleBubbles ();
if (Program.Controller.FirstRun) {
Setup = new SparkleSetup ();
Setup.Controller.ShowSetupPage ();
}
}
}
开发者ID:budi-khoirudin,项目名称:SparkleShare,代码行数:32,代码来源:SparkleUI.cs
示例4: SparkleController
public SparkleController()
: base()
{
using (var a = new NSAutoreleasePool ())
{
string content_path =
Directory.GetParent (System.AppDomain.CurrentDomain.BaseDirectory).ToString ();
string app_path = Directory.GetParent (content_path).ToString ();
string growl_path = Path.Combine (app_path, "Frameworks", "Growl.framework", "Growl");
// Needed for Growl
Dlfcn.dlopen (growl_path, 0);
NSApplication.Init ();
}
// Let's use the bundled git first
SparkleLib.Git.SparkleGit.Path =
Path.Combine (NSBundle.MainBundle.ResourcePath,
"git", "libexec", "git-core", "git");
SparkleLib.Git.SparkleGit.ExecPath =
Path.Combine (NSBundle.MainBundle.ResourcePath,
"git", "libexec", "git-core");
}
开发者ID:nicolaslazartekaqui,项目名称:SparkleShare,代码行数:25,代码来源:SparkleController.cs
示例5: BackgroundWorkerThread
}//if
void BackgroundWorkerThread ()
{
// Create an Autorelease Pool or we will leak objects.
using (var pool = new NSAutoreleasePool()) {
// Create a loop that will add 5 new components with
// a 2 second pause between additions
Console.WriteLine ("Before component load");
for (int x = 1; x <= 5; x++) {
Console.WriteLine ("Before add");
// Make sure we invoke this on the Main Thread or OpenGL will throw an error
MonoMac.AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread (delegate {
Components.Add (new TestTexture (this));
});
Console.WriteLine ("After add");
// Sleep for 2 seconds between each component addition
Thread.Sleep (2000);
}
Console.WriteLine ("After component load");
}
}
开发者ID:Nailz,项目名称:MonoGame-Samples,代码行数:27,代码来源:Game1.cs
示例6: SparkleSetup
public SparkleSetup()
: base()
{
SparkleSetupController.HideWindowEvent += delegate {
NSRunLoop.Main.BeginInvokeOnMainThread (delegate {
PerformClose (this);
});
};
SparkleSetupController.ShowWindowEvent += delegate {
NSRunLoop.Main.BeginInvokeOnMainThread (delegate {
OrderFrontRegardless ();
});
};
SparkleSetupController.ChangePageEvent += delegate (Controller.PageType type, string [] warnings) {
using (var a = new NSAutoreleasePool ())
{
NSRunLoop.Main.BeginInvokeOnMainThread (delegate {
Reset ();
ShowPage (type, warnings);
ShowAll ();
});
}
};
}
开发者ID:greenqloud,项目名称:qloudsync,代码行数:26,代码来源:SparkleSetup.cs
示例7: Main
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
Debug.WriteLine("[Dark Havoc] Starting up...");
#if !MONOMAC
// Add application exit event hook.
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
// Create game instance.
gameInstance = new DarkHavocGame();
// Run game.
gameInstance.Run();
#else
Debug.WriteLine("[Dark Havoc] Initializing Mac OS X Subsystem...");
NSApplication.Init();
using (var p = new NSAutoreleasePool())
{
NSApplication.SharedApplication.Delegate = new AppDelegate();
NSApplication.Main(args);
}
#endif
}
开发者ID:JoshuaKennedy,项目名称:DarkHavoc,代码行数:29,代码来源:Program.cs
示例8: Main
static void Main(string[] args)
{
NSApplication.Init ();
using (var p = new NSAutoreleasePool ()) {
NSApplication.SharedApplication.Delegate = new AppDelegate();
NSApplication.Main(args);
}
}
开发者ID:GlennGeenen,项目名称:Mono-Chess,代码行数:8,代码来源:Main.cs
示例9: SetFolderIcon
public void SetFolderIcon ()
{
using (var a = new NSAutoreleasePool ())
{
NSImage folder_icon = NSImage.ImageNamed ("cmissync-folder.icns");
NSWorkspace.SharedWorkspace.SetIconforFile (folder_icon, Program.Controller.FoldersPath, 0);
}
}
开发者ID:keithwharrison,项目名称:Oris4Sync,代码行数:8,代码来源:UI.cs
示例10: Main
static void Main(string[] args)
{
NSApplication.Init();
using (var p = new NSAutoreleasePool ())
{
NSApplication.Main(args);
}
}
开发者ID:pascalfr,项目名称:MPfm,代码行数:8,代码来源:Main.cs
示例11: GetCredentials
public ICredentials GetCredentials (Uri uri, IWebProxy proxy, CredentialType credentialType, ICredentials existingCredentials, bool retrying)
{
bool result = false;
DispatchService.GuiSyncDispatch (() => {
using (var ns = new NSAutoreleasePool ()) {
var message = string.Format ("{0} needs {1} credentials to access {2}.", BrandingService.ApplicationName,
credentialType == CredentialType.ProxyCredentials ? "proxy" : "request", uri.Host);
NSAlert alert = NSAlert.WithMessage ("Credentials Required", "OK", "Cancel", null, message);
alert.Icon = NSApplication.SharedApplication.ApplicationIconImage;
NSView view = new NSView (new RectangleF (0, 0, 313, 91));
var creds = Utility.GetCredentialsForUriFromICredentials (uri, existingCredentials);
var usernameLabel = new NSTextField (new RectangleF (17, 55, 71, 17)) {
Identifier = "usernameLabel",
StringValue = "Username:",
Alignment = NSTextAlignment.Right,
Editable = false,
Bordered = false,
DrawsBackground = false,
Bezeled = false,
Selectable = false,
};
view.AddSubview (usernameLabel);
var usernameInput = new NSTextField (new RectangleF (93, 52, 200, 22));
usernameInput.StringValue = creds != null ? creds.UserName : string.Empty;
view.AddSubview (usernameInput);
var passwordLabel = new NSTextField (new RectangleF (22, 23, 66, 17)) {
StringValue = "Password:",
Alignment = NSTextAlignment.Right,
Editable = false,
Bordered = false,
DrawsBackground = false,
Bezeled = false,
Selectable = false,
};
view.AddSubview (passwordLabel);
var passwordInput = new NSSecureTextField (new RectangleF (93, 20, 200, 22));
passwordInput.StringValue = creds != null ? creds.Password : string.Empty;
view.AddSubview (passwordInput);
alert.AccessoryView = view;
result = alert.RunModal () == 1;
username = usernameInput.StringValue;
password = passwordInput.StringValue;
}
});
return result ? new NetworkCredential (username, password) : null;
}
开发者ID:fedorw,项目名称:monodevelop,代码行数:56,代码来源:MacProxyCredentialProvider.cs
示例12: SparkleUI
public SparkleUI()
{
using (var a = new NSAutoreleasePool ()) {
NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("qloudsync-app.icns");
Setup = new SparkleSetup ();
About = new AboutWindow ();
StatusIcon = new IconController ();
}
}
开发者ID:greenqloud,项目名称:qloudsync,代码行数:10,代码来源:SparkleUI.cs
示例13: Initialize
// Shared initialization code
void Initialize ()
{
Controller = new SetupController ();
Controller.ShowWindowEvent += delegate {
InvokeOnMainThread (delegate {
Window.OrderFrontRegardless();
});
};
Controller.HideWindowEvent += delegate {
InvokeOnMainThread (delegate {
Window.PerformClose (this);
});
};
Controller.ChangePageEvent += delegate (PageType type) {
using (var a = new NSAutoreleasePool ())
{
InvokeOnMainThread (delegate {
if (!IsWindowLoaded) {
LoadWindow();
}
switch (type)
{
case PageType.Setup:
ShowWelcomePage();
break;
case PageType.Tutorial:
ShowTutorialPage();
break;
case PageType.Add1:
ShowLoginPage();
break;
case PageType.Add2:
ShowRepoSelectPage();
break;
case PageType.Customize:
ShowCustomizePage();
break;
// case PageType.Syncing:
// ShowSyncingPage();
// break;
case PageType.Finished:
ShowFinishedPage();
break;
case PageType.Settings:
ShowSettingsPage();
break;
}
});
}
};
}
开发者ID:emrul,项目名称:CmisSync,代码行数:55,代码来源:SetupWizardController.cs
示例14: CreatePreferencesView
public override IDesktopPreferencesView CreatePreferencesView()
{
IDesktopPreferencesView view = null;
using (var pool = new NSAutoreleasePool())
{
pool.InvokeOnMainThread(delegate {
view = base.CreatePreferencesView();
});
}
return view;
}
开发者ID:pascalfr,项目名称:MPfm,代码行数:11,代码来源:MacNavigationManager.cs
示例15: StorageDeviceHelper
static StorageDeviceHelper ()
{
if (fileManager == null) {
// Because this will run in a background thread we need to wrap it
using (var p = new NSAutoreleasePool ()) {
fileManager = NSFileManager.DefaultManager;
attributes = fileManager.GetFileSystemAttributes(path, out error);
}
}
}
开发者ID:Zodge,项目名称:MonoGame,代码行数:11,代码来源:StorageDeviceHelper.cs
示例16: CreateCloudConnectView
public override ICloudConnectView CreateCloudConnectView()
{
ICloudConnectView view = null;
using (var pool = new NSAutoreleasePool())
{
pool.InvokeOnMainThread(delegate {
view = base.CreateCloudConnectView();
});
}
return view;
}
开发者ID:pascalfr,项目名称:MPfm,代码行数:11,代码来源:MacNavigationManager.cs
示例17: Setup
// private List<RootFolder> Repositories;
// private CmisOutlineController OutlineController;
// private CmisTreeDataSource DataSource;
// private OutlineViewDelegate DataDelegate;
// Dictionary<string,AsyncNodeLoader> Loader;
public Setup () : base ()
{
Controller.HideWindowEvent += delegate {
InvokeOnMainThread (delegate {
PerformClose (this);
});
};
Controller.ShowWindowEvent += delegate {
InvokeOnMainThread (delegate {
OrderFrontRegardless ();
});
};
Controller.ChangePageEvent += delegate (PageType type) {
using (var a = new NSAutoreleasePool ())
{
InvokeOnMainThread (delegate {
Reset ();
ShowPage (type);
ShowAll ();
});
}
};
Controller.UpdateSetupContinueButtonEvent += delegate(bool button_enabled) {
InvokeOnMainThread(delegate {
ContinueButton.Enabled = button_enabled;
});
};
Controller.UpdateAddProjectButtonEvent += delegate(bool button_enabled) {
InvokeOnMainThread(delegate {
ContinueButton.Enabled = button_enabled;
});
};
Controller.ChangeAddressFieldEvent += delegate(string text, string example_text) {
InvokeOnMainThread(delegate {
AddressTextField.StringValue = text;
AddressTextField.Enabled = true;
AddressHelpLabel.StringValue = example_text;
});
};
Controller.LocalPathExists += LocalPathExistsHandler;
Controller.UpdateProgressBarEvent += delegate(double percentage) {
InvokeOnMainThread(delegate {
ProgressIndicator.DoubleValue = percentage;
});
};
}
开发者ID:emrul,项目名称:CmisSync,代码行数:60,代码来源:Setup.cs
示例18: PlatformEntrance
public override void PlatformEntrance()
{
#if MACOS
NSApplication.Init();
using (var p = new NSAutoreleasePool())
{
NSApplication.SharedApplication.Delegate = new AppDelegate();
NSApplication.Main(null);
}
#endif
}
开发者ID:Cyberbanan,项目名称:voxeliq,代码行数:12,代码来源:MacOSPlatform.cs
示例19: Main
static void Main(string[] args)
{
#if !MACOS
Game = new Game1();
Game.Run();
#else
NSApplication.Init ();
using (var p = new NSAutoreleasePool ()) {
NSApplication.SharedApplication.Delegate = new AppDelegate ();
NSApplication.Main (args);
}
#endif
}
开发者ID:drock07,项目名称:SadConsole,代码行数:13,代码来源:Program.cs
示例20: Main
private static void Main(string[] args)
{
#if MONOMAC
NSApplication.Init ();
using (var p = new NSAutoreleasePool ()) {
NSApplication.SharedApplication.Delegate = new AppDelegate();
NSApplication.Main(args);
}
#else
RunGame();
#endif
}
开发者ID:SpagAachen,项目名称:Ballz,代码行数:13,代码来源:Program.cs
注:本文中的MonoMac.Foundation.NSAutoreleasePool类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论