本文整理汇总了C#中MObjc.NSObject类的典型用法代码示例。如果您正苦于以下问题:C# NSObject类的具体用法?C# NSObject怎么用?C# NSObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSObject类属于MObjc命名空间,在下文中一共展示了NSObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: clear
public void clear(NSObject sender)
{
NSDocumentController.sharedDocumentController().clearRecentDocuments(this);
DoReload();
m_table.reloadData();
}
示例2: Init
public void Init()
{
AssertListener.Install();
Registrar.CanInit = true;
m_pool = new NSObject(NSObject.AllocAndInitInstance("NSAutoreleasePool"));
}
示例3: Main
internal static void Main(string[] args)
{
try
{
Registrar.CanInit = true;
// Make our app a foreground app (this is redundant if we were started via the
// Finder or the open command, but important if we were started by directly
// executing the launcher script).
var psn = new ProcessSerialNumber();
psn.highLongOfPSN = 0;
psn.lowLongOfPSN = kCurrentProcess;
int err = TransformProcessType(ref psn, kProcessTransformToForegroundApplication);
if (err != 0)
throw new InvalidOperationException("TransformProcessType returned " + err + ".");
err = SetFrontProcess(ref psn);
if (err != 0)
throw new InvalidOperationException("SetFrontProcess returned " + err + ".");
// Load the nib and run the main event loop.
NSObject pool = new NSObject(NSObject.AllocAndInitInstance("NSAutoreleasePool"));
App app = new App("MainMenu.nib");
pool.release();
app.Run();
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
示例4: pressedOK
public void pressedOK(NSObject sender)
{
Unused.Value = sender;
NSApplication.sharedApplication().stopModalWithCode(Enums.NSOKButton);
window().orderOut(this);
}
示例5: addDir
public void addDir(NSObject sender)
{
NSOpenPanel panel = NSOpenPanel.openPanel();
panel.setCanChooseFiles(false);
panel.setCanChooseDirectories(true);
panel.setAllowsMultipleSelection(true);
panel.setCanCreateDirectories(false);
int result = panel.runModalForDirectory_file_types(null, null, null);
if (result == Enums.NSOKButton && panel.filenames().count() > 0)
{
NSMutableArray dirs = NSMutableArray.Create();
NSUserDefaults defaults = NSUserDefaults.standardUserDefaults();
dirs.addObjectsFromArray(defaults.arrayForKey(NSString.Create("default find directories")));
foreach (NSString path in panel.filenames())
{
if (!dirs.containsObject(path))
dirs.addObject(path);
}
defaults.setObject_forKey(dirs, NSString.Create("default find directories"));
m_find.AddDefaultDirs();
}
}
示例6: NSBeginInformationalAlertSheet
public static void NSBeginInformationalAlertSheet(NSString title, NSString defaultButton, NSString alternateButton, NSString otherButton, NSWindow docWindow, NSObject modalDelegate, string didEndSelector, string didDismissSelector, IntPtr contextInfo, NSString message)
{
Selector endSelector = didEndSelector != null ? new Selector(didEndSelector) : null;
Selector dismissSelector = didDismissSelector != null ? new Selector(didDismissSelector) : null;
NativeMethods.NSBeginInformationalAlertSheet(title, defaultButton, alternateButton, otherButton, docWindow, modalDelegate, endSelector, dismissSelector, contextInfo, message);
}
示例7: memoryTest
public void memoryTest(NSObject sender)
{
lock (m_lock)
{
if (m_checkingMemory)
{
m_checkingMemory = false;
Monitor.PulseAll(m_lock);
m_thread1 = null;
m_thread2 = null;
}
else
{
NSObject app = (NSObject) new Class("NSApplication").Call("sharedApplication");
NSObject window = (NSObject) app.Call("mainWindow");
NSObject content = (NSObject) window.Call("contentView");
NSObject view = (NSObject) content.Call("viewWithTag:", 33);
if (!view.IsNil())
{
m_thread1 = new Thread(this.DoDumpStatsThread);
m_thread1.Start();
m_thread2 = new Thread(this.DoMemoryThread);
m_thread2.Start(view);
m_checkingMemory = true;
}
else
Console.WriteLine("Couldn't find the simple layout view.");
}
}
}
示例8: removeLastBox
public void removeLastBox(NSObject sender)
{
NSObject last = Subviews.LastObject().To<NSObject>();
last.Call("removeFromSuperview");
DoLayout();
}
示例9: generatePressed
public void generatePressed(NSObject sender)
{
Generate = true;
NSApplication.sharedApplication().stopModalWithCode(Enums.NSOKButton);
window().orderOut(this);
}
示例10: replaceAndFind
public void replaceAndFind(NSObject sender)
{
Unused.Value = sender;
OnUpdateLists();
Finder.ReplaceAndFind();
}
示例11: next
public void next(NSObject sender)
{
Unused.Value = sender;
OnUpdateLists();
Finder.FindNext();
}
示例12: ArrayArg
public void ArrayArg()
{
NSObject pool = new NSObject(NSObject.AllocAndInitInstance("NSAutoreleasePool"));
Class nsData = new Class("NSData");
long bytes = DoGetMemory();
for (int j = 1; j < 100; ++j)
{
for (int i = 0; i < NumIterations/100; ++i)
{
byte[] data = new byte[]{2, 5, 6, 3};
NSObject d = new NSObject(nsData.Call("alloc"));
NSObject e = (NSObject) d.Call("initWithBytes:length:", data, data.Length);
e.release();
}
GC.Collect();
}
pool.release();
GC.Collect();
GC.WaitForPendingFinalizers();
long delta = DoGetMemory() - bytes;
if (delta/NumIterations > 4)
Assert.Fail("ArrayArg used {0}K of memory ({1} bytes per iteration)!", delta/1024, delta/NumIterations);
}
示例13: cancelPressed
public void cancelPressed(NSObject sender)
{
Unused.Value = sender;
NSApplication.sharedApplication().endSheet(m_sheet.Value);
m_sheet.Value.orderOut(this);
m_dir = null;
}
示例14: applicationWillTerminate
public void applicationWillTerminate(NSObject notification)
{
#if DEBUG
// These are fairly expensive to create and it's easy to mess up and
// create tons inside loops so we'll print the count here.
Console.WriteLine("{0} BigFloat instances were created.", BigFloat.InstanceCount);
#endif
}
示例15: flagsCancel
public void flagsCancel(NSObject sender)
{
Unused.Value = sender;
NSApplication.sharedApplication().stopModal();
window().orderOut(this);
window().release();
}