本文整理汇总了C#中MonoMac.AppKit.NSWindow类的典型用法代码示例。如果您正苦于以下问题:C# NSWindow类的具体用法?C# NSWindow怎么用?C# NSWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSWindow类属于MonoMac.AppKit命名空间,在下文中一共展示了NSWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FinishedLaunching
public override void FinishedLaunching (NSObject notification)
{
window = new NSWindow(new RectangleF (50, 50, 400, 400), (NSWindowStyle) (1 | (1 << 1) | (1 << 2) | (1 << 3)), NSBackingStore.Buffered, false);
window.MakeKeyAndOrderFront(this);
//mainWindowController = new MainWindowController ();
//mainWindowController.Window.MakeKeyAndOrderFront (this);
}
示例2: BeginSheet
public void BeginSheet (NSWindow window, NSAction onEnded)
{
BeginSheetForResponse (window, r => {
if (onEnded != null)
onEnded ();
});
}
示例3: ModalEventArgs
public ModalEventArgs(IntPtr session, Window window, NSWindow nativeWindow, bool isModal = false, bool isSheet = false)
{
Session = session;
EtoWindow = window;
NativeWindow = nativeWindow;
IsModal = isModal;
IsSheet = isSheet;
}
示例4: RunModal
public void RunModal(NSWindow window)
{
SetUiToStart();
window.DidBecomeKey -= DidBecomeKey;
window.DidBecomeKey += DidBecomeKey;
window.WillClose -= WindowWillClose;
window.WillClose += WindowWillClose;
NSApplication.SharedApplication.RunModalForWindow(window);
}
示例5: FinishedLaunching
public override void FinishedLaunching(NSObject notification)
{
text = new NSTextField (new RectangleF (44, 32, 232, 31)) {
StringValue = "Hello Mono Mac!"
};
window = new NSWindow (new RectangleF (50, 50, 400, 400), (NSWindowStyle) (1 | (1 << 1) | (1 << 2) | (1 << 3)), 0, false);
window.ContentView.AddSubview (text);
window.MakeKeyAndOrderFront (this);
}
示例6: goFullScreen
partial void goFullScreen (NSObject sender)
{
isInFullScreenMode = true;
// Pause the non-fullscreen view
openGLView.StopAnimation ();
RectangleF mainDisplayRect;
RectangleF viewRect;
// Create a screen-sized window on the display you want to take over
// Note, mainDisplayRect has a non-zero origin if the key window is on a secondary display
mainDisplayRect = NSScreen.MainScreen.Frame;
fullScreenWindow = new NSWindow (mainDisplayRect, NSWindowStyle.Borderless, NSBackingStore.Buffered, true);
// Set the window level to be above the menu bar
fullScreenWindow.Level = NSWindowLevel.MainMenu + 1;
// Perform any other window configuration you desire
fullScreenWindow.IsOpaque = true;
fullScreenWindow.HidesOnDeactivate = true;
// Create a view with a double-buffered OpenGL context and attach it to the window
// By specifying the non-fullscreen context as the shareContext, we automatically inherit the
// OpenGL objects (textures, etc) it has defined
viewRect = new RectangleF (0, 0, mainDisplayRect.Size.Width, mainDisplayRect.Size.Height);
fullScreenView = new MyOpenGLView (viewRect, openGLView.OpenGLContext);
fullScreenWindow.ContentView = fullScreenView;
// Show the window
fullScreenWindow.MakeKeyAndOrderFront (this);
// Set the scene with the full-screen viewport and viewing transformation
camera.init(viewRect);
// scene.ResizeGLScene (viewRect);
// Assign the view's MainController to self
fullScreenView.MainController = this;
if (!isAnimating) {
// Mark the view as needing drawing to initalize its contents
fullScreenView.NeedsDisplay = true;
} else {
// Start playing the animation
fullScreenView.StartAnimation ();
}
}
示例7: DidFinishLaunching
public override void DidFinishLaunching(NSNotification notification)
{
var menu = new NSMenu ();
var menuItem = new NSMenuItem ();
menu.AddItem (menuItem);
var appMenu = new NSMenu ();
var quitItem = new NSMenuItem ("Quit " + NSProcessInfo.ProcessInfo.ProcessName, "q", (s, e) => NSApplication.SharedApplication.Terminate (menu));
appMenu.AddItem (quitItem);
var window = new NSWindow ();
menuItem.Submenu = appMenu;
NSApplication.SharedApplication.MainMenu = menu;
}
示例8: FinishedLaunching
public override void FinishedLaunching (NSObject notification)
{
_window = new NSWindow (new RectangleF(200,200,400,700), NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled,
NSBackingStore.Buffered, false, NSScreen.MainScreen);
var setup = new Setup (this, _window);
setup.Initialize ();
var startup = Mvx.Resolve<IMvxAppStart> ();
startup.Start ();
_window.MakeKeyAndOrderFront (this);
return;
}
示例9: SelectFile
public static void SelectFile(NSWindow window, NSTextField field)
{
NSOpenPanel openPanel = new NSOpenPanel ();
openPanel.BeginSheet (window, (i) => {
try {
if (openPanel.Url != null) {
string path = openPanel.Url.Path;
if (!string.IsNullOrEmpty (path))
field.StringValue = path;
}
} finally {
openPanel.Dispose ();
}
});
}
示例10: AQ_Exception
/// <summary>
/// Log Exception/Error. To display alert requires source NSWindow
/// </summary>
/// <param name="exception">Exception.</param>
/// <param name="message">Message.</param>
/// <param name="displayAlert">If set to <c>true</c> display alert.</param>
/// <param name="source">Source.</param>
public static void AQ_Exception(AQ_EXCEPTION_CODE exception, string message, bool displayAlert = true, NSWindow source = null)
{
// build entry
string sExceptionEntry = string.Format ("{0} {1}{2}Exception: {3}{2}{4}"
, DateTime.Now.ToShortDateString()
, DateTime.Now.ToShortTimeString()
, Environment.NewLine
, exception
, message);
// add to log
m_sLog += sExceptionEntry + Environment.NewLine;
// display alert
if (displayAlert) {
// create and display alert
NSAlert alert = new NSAlert ();
alert.AlertStyle = NSAlertStyle.Warning;
alert.MessageText = sExceptionEntry;
alert.BeginSheet (source);
}
}
示例11: BeginSheet
public void BeginSheet (NSWindow sheet, NSWindow docWindow)
{
BeginSheet (sheet, docWindow, null, null, IntPtr.Zero);
}
示例12: ShowSheet
public virtual void ShowSheet(NSWindow dockToWindow) {
NSApplication.SharedApplication.BeginSheet(Window, dockToWindow);
DidOpen(this, new EventArgs());
}
示例13: Initialize
// Shared initialization code
void Initialize ()
{
//window = new NSWindow(new RectangleF(0,0, 470, 250), NSWindowStyle.Titled | NSWindowStyle.Closable, NSBackingStore.Buffered, false);
window = new NSWindow(new RectangleF(0,0, 470, 250), NSWindowStyle.Titled, NSBackingStore.Buffered, false);
window.HasShadow = true;
NSView content = window.ContentView;
window.WindowController = this;
window.Title = "Sign In";
NSTextField signInLabel = new NSTextField(new RectangleF(17, 190, 109, 17));
signInLabel.StringValue = "Sign In:";
signInLabel.Editable = false;
signInLabel.Bordered = false;
signInLabel.BackgroundColor = NSColor.Control;
content.AddSubview(signInLabel);
// Create our select button
selectButton = new NSButton(new RectangleF(358,12,96,32));
selectButton.Title = "Select";
selectButton.SetButtonType(NSButtonType.MomentaryPushIn);
selectButton.BezelStyle = NSBezelStyle.Rounded;
selectButton.Activated += delegate {
profileSelected();
};
selectButton.Enabled = false;
content.AddSubview(selectButton);
// Setup our table view
NSScrollView tableContainer = new NSScrollView(new RectangleF(20,60,428, 123));
tableContainer.BorderType = NSBorderType.BezelBorder;
tableContainer.AutohidesScrollers = true;
tableContainer.HasVerticalScroller = true;
tableView = new NSTableView(new RectangleF(0,0,420, 123));
tableView.UsesAlternatingRowBackgroundColors = true;
NSTableColumn colGamerTag = new NSTableColumn("Gamer");
tableView.AddColumn(colGamerTag);
colGamerTag.Width = 420;
colGamerTag.HeaderCell.Title = "Gamer Profile";
tableContainer.DocumentView = tableView;
content.AddSubview(tableContainer);
// Create our add button
NSButton addButton = new NSButton(new RectangleF(20,27,25,25));
//Console.WriteLine(NSImage.AddTemplate);
addButton.Image = NSImage.ImageNamed("NSAddTemplate");
addButton.SetButtonType(NSButtonType.MomentaryPushIn);
addButton.BezelStyle = NSBezelStyle.SmallSquare;
addButton.Activated += delegate {
addLocalPlayer();
};
content.AddSubview(addButton);
// Create our remove button
NSButton removeButton = new NSButton(new RectangleF(44,27,25,25));
removeButton.Image = NSImage.ImageNamed("NSRemoveTemplate");
removeButton.SetButtonType(NSButtonType.MomentaryPushIn);
removeButton.BezelStyle = NSBezelStyle.SmallSquare;
removeButton.Activated += delegate {
removeLocalPlayer();
};
content.AddSubview(removeButton);
gamerList = MonoGameGamerServicesHelper.DeserializeProfiles();
// for (int x= 1; x< 25; x++) {
// gamerList.Add("Player " + x);
// }
tableView.DataSource = new GamersDataSource(this);
tableView.Delegate = new GamersTableDelegate(this);
}
示例14: ShouldZoom
public override bool ShouldZoom (NSWindow window, RectangleF newFrame)
{
return _owner.AllowUserResizing;
}
示例15: Run
public static void Run (NSWindow mainForm)
{
MonoMacInit();
NSApplication.Main (new string[]{});
}