public virtual NSToolbarItem ToolbarItemForItemIdentifierWillBeInsertedIntoToolbar(NSToolbar toolbar, NSString itemIdentifier, bool flag) { NSToolbarItem item = new NSToolbarItem(itemIdentifier); if (itemIdentifier.IsEqualToString(TOOLBAR_ITEM1)) { item.Image = NSImage.ImageNamed(NSImage.NSImageNameAdvanced); item.Label = "Toolbar Item 1"; item.Target = this; item.Action = ObjectiveCRuntime.Selector("doSomething1:"); } if (itemIdentifier.IsEqualToString(TOOLBAR_ITEM2)) { item.Image = NSImage.ImageNamed(NSImage.NSImageNameEveryone); item.Label = "Toolbar Item 2"; item.Target = this; item.Action = ObjectiveCRuntime.Selector("doSomething2:"); } if (itemIdentifier.IsEqualToString(TOOLBAR_ITEM3)) { item.Image = NSImage.ImageNamed(NSImage.NSImageNameDotMac); item.Label = "Toolbar Item 3"; item.Target = this; item.Action = ObjectiveCRuntime.Selector("doSomething3:"); } item.PaletteLabel = item.Label; return item; }
public void SetExpression(NSString expression) { // Set up to begin animating the frames if (this._expressionFrameTimer != null) { this._expressionFrameTimer.Invalidate(); this._expressionFrameTimer = null; } this._currentExpression.SafeRelease(); this._currentExpression = expression.SafeRetain(); this._curFrameArray = this._characterDescription[this._currentExpression].CastTo<NSArray>(); this._curFrameIndex = 0; this.AnimateNextExpressionFrame(); // If the expression we just set is NOT the idle or sleep expression, then set up the idle start timer. if (! (expression.IsEqualToString(kCharacterExpressionIdentifierIdle) || expression.IsEqualToString(kCharacterExpressionIdentifierSleep))) { if (this._idleStartTimer != null) { this._idleStartTimer.Invalidate(); } this._idleStartTimer = NSTimer.ScheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats(0.5f, this, ObjectiveCRuntime.Selector("startIdleExpression"), null, false); } else { if (this._idleStartTimer != null) { this._idleStartTimer.Invalidate(); this._idleStartTimer = null; } } }
/// <summary> /// Determines whether this string is null or empty. /// </summary> /// <param name="string">The string.</param> /// <returns> /// <c>true</c> if it is null or empty; otherwise, <c>false</c>. /// </returns> public static bool IsNullOrEmpty(NSString @string) { return (@string == null || @string.IsEqualToString(NSString.String)); }