本文整理汇总了C#中MonoMac.Foundation.NSString类的典型用法代码示例。如果您正苦于以下问题:C# NSString类的具体用法?C# NSString怎么用?C# NSString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSString类属于MonoMac.Foundation命名空间,在下文中一共展示了NSString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: EtoLoadNibNamed
static bool EtoLoadNibNamed (IntPtr self, IntPtr sel, IntPtr filePath, IntPtr owner)
{
var str = new NSString (filePath);
if (str.Length == 0)
return true;
return Messaging.bool_objc_msgSend_IntPtr_IntPtr (self, selEtoLoadNibNamed, filePath, owner);
}
开发者ID:hultqvist,项目名称:Eto,代码行数:7,代码来源:EtoBundle.cs
示例2: BestDepth
public static NSWindowDepth BestDepth (NSString colorspace, int bitsPerSample, int bitsPerPixel, bool planar, ref bool exactMatch)
{
if (colorspace == null)
throw new ArgumentNullException ("colorpsace");
return NSBestDepth (colorspace.Handle, bitsPerSample, bitsPerPixel, planar, ref exactMatch);
}
开发者ID:JoeMatt,项目名称:monomac,代码行数:7,代码来源:NSGraphics.cs
示例3: SetFont
public void SetFont (string fontName)
{
if (fontName == null)
throw new ArgumentNullException ("fontName");
using (var nss = new NSString (fontName))
_Font = nss.Handle;
}
开发者ID:polipo,项目名称:maccore,代码行数:7,代码来源:CATextLayer.cs
示例4: SetItem
public void SetItem(IListItem value)
{
var imgitem = value as IImageListItem;
if (imgitem != null && imgitem.Image != null)
Image = ((IImageSource)imgitem.Image.Handler).GetImage();
Text = (NSString)value.Text;
}
开发者ID:GilbertoBotaro,项目名称:Eto,代码行数:7,代码来源:MacImageAndTextCell.cs
示例5: GetProxiesForAutoConfigurationScript
public static CFProxy[] GetProxiesForAutoConfigurationScript(NSString proxyAutoConfigurationScript, NSUrl targetURL)
{
if (proxyAutoConfigurationScript == null)
throw new ArgumentNullException ("proxyAutoConfigurationScript");
if (targetURL == null)
throw new ArgumentNullException ("targetURL");
NSArray array = CopyProxiesForAutoConfigurationScript (proxyAutoConfigurationScript, targetURL);
if (array == null)
return null;
NSDictionary[] dictionaries = NSArray.ArrayFromHandle<NSDictionary> (array.Handle);
array.Dispose ();
if (dictionaries == null)
return null;
CFProxy[] proxies = new CFProxy [dictionaries.Length];
for (int i = 0; i < dictionaries.Length; i++)
proxies[i] = new CFProxy (dictionaries[i]);
return proxies;
}
开发者ID:jacksonh,项目名称:maccore,代码行数:25,代码来源:CFProxySupport.cs
示例6: SparkleMacWatcher
public SparkleMacWatcher (string path)
{
Path = path;
m_callback = DoCallback;
NSString [] s = new NSString [1];
s [0] = new NSString (path);
NSArray path_p = NSArray.FromNSObjects (s);
m_stream = FSEventStreamCreate ( // note that the stream will always be valid
IntPtr.Zero, // allocator
m_callback, // callback
IntPtr.Zero, // context
path_p.Handle, // pathsToWatch
kFSEventStreamEventIdSinceNow, // sinceWhen
2, // latency (in seconds)
FSEventStreamCreateFlags.kFSEventStreamCreateFlagNone); // flags
FSEventStreamScheduleWithRunLoop (
m_stream, // streamRef
CFRunLoopGetMain(), // runLoop
kCFRunLoopDefaultMode); // runLoopMode
bool started = FSEventStreamStart (m_stream);
if (!started) {
GC.SuppressFinalize (this);
throw new InvalidOperationException ("Failed to start FSEvent stream for " + path);
}
}
开发者ID:WisdomWolf,项目名称:SparkleShare,代码行数:29,代码来源:SparkleMacWatcher.cs
示例7: ObjectForKey
public NSObject this [NSString key] {
get {
return ObjectForKey (key);
}
set {
SetObjectForKey (value, key);
}
}
开发者ID:Anomalous-Software,项目名称:maccore,代码行数:8,代码来源:NSUbiquitousKeyValueStore.cs
示例8: CFException
public CFException(string description, NSString domain, int code, string failureReason, string recoverySuggestion)
: base(description)
{
Code = code;
Domain = domain;
FailureReason = failureReason;
RecoverySuggestion = recoverySuggestion;
}
开发者ID:kangaroo,项目名称:maccore,代码行数:8,代码来源:CFException.cs
示例9: CalculateSize
void CalculateSize ()
{
NSString str = new NSString (badgeNumber.ToString());
NSDictionary attibutedStringAttributed = NSDictionary.FromObjectAndKey(Font, NSAttributedString.FontAttributeName);
numberSize = str.StringSize (attibutedStringAttributed);
Frame = new RectangleF (Frame.Location, new SizeF (Math.Max (numberSize.Width, height), height));
}
开发者ID:robertmiles3,项目名称:xamarin-store-app,代码行数:8,代码来源:BadgeView.cs
示例10: NeedsDisplayForKey
static bool NeedsDisplayForKey (NSString key)
{
switch (key.ToString ()) {
case "clockColor":
return true;
default:
return CALayer.NeedsDisplayForKey (key);
}
}
开发者ID:Anomalous-Software,项目名称:monomac,代码行数:9,代码来源:ClockLayer.cs
示例11: GlobalGetClass
public static Class GlobalGetClass(string codedName)
{
if (codedName == null)
throw new ArgumentNullException ("codedName");
using (var nsname = new NSString (codedName))
return new Class (
MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr (
class_ptr, selClassForClassName_, nsname.Handle));
}
开发者ID:roblillack,项目名称:maccore,代码行数:9,代码来源:NSKeyedUnarchiver.cs
示例12: OpenApplication
public static ProcessSerialNumber OpenApplication (ApplicationStartInfo application)
{
if (application == null)
throw new ArgumentNullException ("application");
if (string.IsNullOrEmpty (application.Application) || !System.IO.Directory.Exists (application.Application))
throw new ArgumentException ("Application is not valid");
var appParams = new LSApplicationParameters ();
if (application.NewInstance)
appParams.flags |= LSLaunchFlags.NewInstance;
if (application.Async)
appParams.flags |= LSLaunchFlags.Async;
NSArray argv = null;
if (application.Args != null && application.Args.Length > 0) {
var args = application.Args;
NSObject[] arr = new NSObject[args.Length];
for (int i = 0; i < args.Length; i++)
arr[i] = new NSString (args[i]);
argv = NSArray.FromNSObjects (arr);
appParams.argv = argv.Handle;
}
NSDictionary dict = null;
if (application.Environment.Count > 0) {
dict = new NSMutableDictionary ();
foreach (var kvp in application.Environment)
dict.SetValueForKey (new NSString (kvp.Value), new NSString (kvp.Key));
appParams.environment = dict.Handle;
}
var cfUrl = global::MonoMac.CoreFoundation.CFUrl.FromFile (application.Application);
ProcessSerialNumber psn;
try {
appParams.application = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (FSRef)));
if (!CoreFoundation.CFURLGetFSRef (cfUrl.Handle, appParams.application))
throw new Exception ("Could not create FSRef from CFUrl");
var status = LSOpenApplication (ref appParams, out psn);
if (status != OSStatus.Ok)
throw new Exception ("Failed to start process: " + ((int)status).ToString ());
} finally {
if (appParams.application != IntPtr.Zero)
Marshal.FreeHGlobal (appParams.application);
appParams.application = IntPtr.Zero;
if (dict != null)
dict.Dispose (); //also ensures the NSDictionary is kept alive for the params
if (argv != null)
argv.Dispose (); //also ensures the NSArray is kept alive for the params
}
return psn;
}
开发者ID:nickname100,项目名称:monodevelop,代码行数:56,代码来源:Interop.cs
示例13: LibraryBrowserItem
public LibraryBrowserItem(LibraryBrowserEntity entity)
{
Entity = entity;
StringValue = new NSString(entity.Title);
// Create empty list of subitems
SubItems = new List<LibraryBrowserItem>();
foreach(LibraryBrowserEntity subEntity in entity.SubItems)
SubItems.Add(new LibraryBrowserItem(subEntity));
}
开发者ID:pascalfr,项目名称:MPfm,代码行数:10,代码来源:LibraryBrowserItem.cs
示例14: AddLoginItem
public static void AddLoginItem (string path)
{
if (path == null)
throw new ArgumentNullException ("path");
var nspath = new NSString (path);
MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr (class_ptr, selAddLoginItem, nspath.Handle);
nspath.Dispose ();
}
开发者ID:kelegorm,项目名称:awareness,代码行数:10,代码来源:LoginItemManager.g.cs
示例15: GlobalSetClass
public static void GlobalSetClass(Class kls, string codedName)
{
if (codedName == null)
throw new ArgumentNullException ("codedName");
if (kls == null)
throw new ArgumentNullException ("kls");
using (var nsname = new NSString (codedName))
MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr (class_ptr, selSetClassForClassName_, kls.Handle, nsname.Handle);
}
开发者ID:roblillack,项目名称:maccore,代码行数:10,代码来源:NSKeyedUnarchiver.cs
示例16: AddObserver
public NSObject AddObserver(NSString aName, Action<NSNotification> notify, NSObject fromObject)
{
if (notify == null)
throw new ArgumentNullException ("notify");
var proxy = new InternalNSNotificationHandler (this, notify);
AddObserver (proxy, postSelector, aName, fromObject);
return proxy;
}
开发者ID:officedrop,项目名称:maccore,代码行数:11,代码来源:NSNotificationCenter.cs
示例17: DefaultAnimationFor
static new NSObject DefaultAnimationFor (NSString key)
{
if (key == "drawnLineWidth"){
if (drawnLineWidthBasicAnimation == null) {
drawnLineWidthBasicAnimation = new CABasicAnimation ();
//drawnLineWidthBasicAnimation.Duration = 2.0f;
}
return drawnLineWidthBasicAnimation;
} else
return NSView.DefaultAnimationFor (key);
}
开发者ID:Anomalous-Software,项目名称:monomac,代码行数:11,代码来源:MyView.cs
示例18: GlobalSetClassName
public static void GlobalSetClassName (string name, Class kls)
{
if (name == null)
throw new ArgumentNullException ("name");
if (kls == null)
throw new ArgumentNullException ("kls");
var nsname = new NSString (name);
MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr (class_ptr, Selector.GetHandle (selSetClassNameForClass_), nsname.Handle, kls.Handle);
nsname.Dispose ();
}
开发者ID:Anomalous-Software,项目名称:maccore,代码行数:11,代码来源:NSKeyedArchiver.cs
示例19: SetValueForKey
// Get a value for a key. Not using this method but instead
// used the [Export("xxxxxx")] method.
//public override NSObject ValueForKey (NSString key)
//{
// return attributeValues[key];
//}
public override void SetValueForKey (NSObject value, NSString key)
{
if (personValues.ContainsKey (key))
personValues [key] = value;
else
base.SetValueForKey (value, key);
// you can also just do a simple:
//attributeValues[key] = value;
}
开发者ID:jamiebriant,项目名称:monomac,代码行数:19,代码来源:Person.cs
示例20: CVPixelFormatDescription
static CVPixelFormatDescription ()
{
var handle = Dlfcn.dlopen (Constants.CoreVideoLibrary, 0);
if (handle == IntPtr.Zero)
return;
try {
NameKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatName");
ConstantKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatConstant");
CodecTypeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCodecType");
FourCCKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatFourCC");
PlanesKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatPlanes");
BlockWidthKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockWidth");
BlockHeightKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockHeight");
BitsPerBlockKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBitsPerBlock");
BlockHorizontalAlignmentKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockHorizontalAlignment");
BlockVerticalAlignmentKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlockVerticalAlignment");
BlackBlockKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatBlackBlock");
HorizontalSubsamplingKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatHorizontalSubsampling");
VerticalSubsamplingKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatVerticalSubsampling");
OpenGLFormatKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLFormat");
OpenGLTypeKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLType");
OpenGLInternalFormatKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLInternalFormat");
CGBitmapInfoKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCGBitmapInfo");
QDCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatQDCompatibility");
CGBitmapContextCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCGBitmapContextCompatibility");
CGImageCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatCGImageCompatibility");
OpenGLCompatibilityKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatOpenGLCompatibility");
FillExtendedPixelsCallbackKey = Dlfcn.GetStringConstant (handle, "kCVPixelFormatFillExtendedPixelsCallback");
}
finally {
Dlfcn.dlclose (handle);
}
}
开发者ID:Anomalous-Software,项目名称:maccore,代码行数:33,代码来源:CVPixelFormatDescription.cs
注:本文中的MonoMac.Foundation.NSString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论