public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); // Add code to here after the controller has loaded the document window // Populate the popup menu NSMenu menu = popup.Menu; NSViewController vc = viewControllers.GetItem<NSViewController>(0); NSMenuItem mi = new NSMenuItem(vc.Title, null, ""); // Set CMD-B as the key equvialent // NSMenuItem mi = new NSMenuItem(vc.Title, null, "b"); // mi.KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask; menu.AddItem(mi); vc = viewControllers.GetItem<NSViewController>(1); mi = new NSMenuItem(vc.Title, null, ""); // Set CMD-A as the key equvialent // mi = new NSMenuItem(vc.Title, null, "a"); // mi.KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask; menu.AddItem(mi); // Initially show the first controller. popup.SelectItem(0); DisplayViewController(viewControllers.GetItem<NSViewController>(0)); }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); // Add code to here after the controller has loaded the document window RenderImage(null); }
// Called when created directly from a XIB file /* [Export ("initWithCoder:")] * public MyDocument (NSCoder coder) : base (coder) * { * } */ public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); Console.WriteLine("On callback, sleeping"); System.Threading.Thread.Sleep(1000); // Enable user to manipulate the view with the built-in behavior sceneView.AllowsCameraControl = true; // Improves anti-aliasing when scene is still sceneView.JitteringEnabled = true; // Play the animations sceneView.Playing = true; // Automatically light scenes without light sceneView.AutoenablesDefaultLighting = true; // Background color sceneView.BackgroundColor = NSColor.Black; var url = NSBundle.MainBundle.PathForResource("scene", "dae"); sceneView.LoadScene(url); }
public override void AwakeFromNib() { base.AwakeFromNib(); currentDelegate = NSApplication.SharedApplication.Delegate as AppDelegate; // Blur Overlay is the Visual Effect View with Blur and Vibrancy BlurOverlay.WantsLayer = true; BlurOverlay.Material = NSVisualEffectMaterial.Dark; BlurOverlay.BlendingMode = NSVisualEffectBlendingMode.WithinWindow; ThumbnailView.WantsLayer = true; ThumbnailView.Layer.CornerRadius = 32.0f; #region Settings Menu settingsMenu = new NSMenu(); artwork = new NSMenuItem("Background Artwork", new ObjCRuntime.Selector("artwork:"), ""); launch = new NSMenuItem("Launch at Login", new ObjCRuntime.Selector("launch:"), ""); NSMenuItem about = new NSMenuItem("About", new ObjCRuntime.Selector("about:"), ""); NSMenuItem quit = new NSMenuItem("Quit Carol", new ObjCRuntime.Selector("quit:"), "q"); settingsMenu.AddItem(artwork); settingsMenu.AddItem(launch); settingsMenu.AddItem(about); settingsMenu.AddItem(NSMenuItem.SeparatorItem); settingsMenu.AddItem(quit); #endregion SettingsButton.AddTrackingArea(new NSTrackingArea(SettingsButton.Bounds, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveAlways, this, null)); cursor = NSCursor.CurrentSystemCursor; windowController = currentDelegate.Storyboard.InstantiateControllerWithIdentifier("AboutWindow") as NSWindowController; }
void CheckForUpdates(NSObject sender) { if (sender == null) { throw new ArgumentNullException(nameof(sender)); } if (updaterWindowController != null) { updaterWindowController.Window.MakeKeyAndOrderFront(sender); return; } updaterWindowController = (NSWindowController)updaterStoryboard .InstantiateControllerWithIdentifier("CheckingForUpdatesWindowController"); updaterWindowController.Window.Center(); CancellationTokenSource cancellation = null; updaterWindowController.Window.WindowShouldClose = (o) => { cancellation?.Cancel(); return(true); }; updaterWindowController.Window.MakeKeyAndOrderFront(sender); cancellation = ClientApp .SharedInstance .Updater .CheckForUpdatesInBackground( true, update => UpdateHandler(sender, update)); }
public override void WindowControllerDidLoadNib (NSWindowController windowController) { base.WindowControllerDidLoadNib (windowController); // A reference to the window controller must be kept on the managed side // to keep the object from being GC'd so that the delegates below resolve. // Don't remove unless the framework is updated to track the reference. this.windowController = windowController; NSError err; windowController.Window.WillClose += delegate { if (captureSession != null) captureSession.StopRunning (); var dev = captureInput.Device; if (dev.IsOpen) dev.Close (); }; // Create a movie, and store the information in memory on an NSMutableData movie = new QTMovie (new NSMutableData (1), out err); if (movie == null){ NSAlert.WithError (err).RunModal (); return; } movieView.Movie = movie; // Find video device captureSession = new QTCaptureSession (); var device = QTCaptureDevice.GetDefaultInputDevice (QTMediaType.Video); if (!device.Open (out err)){ NSAlert.WithError (err).RunModal (); return; } // Add device input captureInput = new QTCaptureDeviceInput (device); if (!captureSession.AddInput (captureInput, out err)){ NSAlert.WithError (err).RunModal (); return; } // Create decompressor for video output, to get raw frames decompressedVideo = new QTCaptureDecompressedVideoOutput (); decompressedVideo.DidOutputVideoFrame += delegate(object sender, QTCaptureVideoFrameEventArgs e) { lock (this){ currentImage = e.VideoFrame; } }; if (!captureSession.AddOutput (decompressedVideo, out err)){ NSAlert.WithError (err).RunModal (); return; } // Activate preview captureView.CaptureSession = captureSession; // Start running. captureSession.StartRunning (); }
public static void ActivateWindowDrag(this NSWindowController windowController) { if (windowController.Window != null) { windowController.Window.MovableByWindowBackground = true; } }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); tabSelector.SelectFirst(this); history = new History(navigationCells); SetupOutline(); SetupSearch(); SetupBookmarks(); webView.DecidePolicyForNavigation += HandleWebViewDecidePolicyForNavigation; webView.FinishedLoad += HandleWebViewFinishedLoad; ((WebViewExtraordinaire)webView).SwipeEvent += (sender, e) => { if (e.Side == SwipeSide.Left && history.BackClicked()) { navigationCells.SetSelected(true, 0); } else if (history.ForwardClicked()) { navigationCells.SetSelected(true, 1); } }; HideMultipleMatches(); if (!string.IsNullOrEmpty(initialLoadFromUrl)) { LoadUrl(initialLoadFromUrl); } }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); // Add code to here after the controller has loaded the document window // Populate the popup menu NSMenu menu = popup.Menu; NSViewController vc = viewControllers.GetItem <NSViewController>(0); NSMenuItem mi = new NSMenuItem(vc.Title, null, ""); // Set CMD-B as the key equvialent // NSMenuItem mi = new NSMenuItem(vc.Title, null, "b"); // mi.KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask; menu.AddItem(mi); vc = viewControllers.GetItem <NSViewController>(1); mi = new NSMenuItem(vc.Title, null, ""); // Set CMD-A as the key equvialent // mi = new NSMenuItem(vc.Title, null, "a"); // mi.KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask; menu.AddItem(mi); // Initially show the first controller. popup.SelectItem(0); DisplayViewController(viewControllers.GetItem <NSViewController>(0)); }
/// <summary> /// Wraps the specified Cocoa <paramref name="windowController"/> in an Eto control so it can be used as a parent when showing dialogs, etc. /// </summary> /// <returns>The eto window wrapper around the native Cocoa window.</returns> /// <param name="windowController">Cocoa Window to wrap.</param> public static Window ToEtoWindow(this NSWindowController windowController) { if (windowController == null) { return(null); } return(new Form(new NativeFormHandler(windowController))); }
public People() { var storyboard = NSStoryboard.FromName("People", null); peopleWindow = storyboard.InstantiateControllerWithIdentifier("PeopleWindow") as NSWindowController; peopleWindow.Window.SetFrame(new CoreGraphics.CGRect(300, 300, 800, 500), true); peopleView = peopleWindow.ContentViewController as PeopleViewController; }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { NSError err; // Create a movie, and store the information in memory on an NSMutableData movie = new QTMovie(new NSMutableData(1), out err); if (movie == null) { NSAlert.WithError(err).RunModal(); return; } movieView.Movie = movie; // Find video device captureSession = new QTCaptureSession(); var device = QTCaptureDevice.GetDefaultInputDevice(QTMediaType.Video); if (device == null) { new NSAlert { MessageText = "You do not have a camera connected." }.BeginSheet(windowController.Window); return; } else if (!device.Open(out err)) { NSAlert.WithError(err).BeginSheet(windowController.Window); return; } // Add device input captureInput = new QTCaptureDeviceInput(device); if (!captureSession.AddInput(captureInput, out err)) { NSAlert.WithError(err).BeginSheet(windowController.Window); return; } // Create decompressor for video output, to get raw frames decompressedVideo = new QTCaptureDecompressedVideoOutput(); decompressedVideo.DidOutputVideoFrame += delegate(object sender, QTCaptureVideoFrameEventArgs e) { lock (this) { currentImage = e.VideoFrame; } }; if (!captureSession.AddOutput(decompressedVideo, out err)) { NSAlert.WithError(err).BeginSheet(windowController.Window); return; } // Activate preview captureView.CaptureSession = captureSession; // Start running. captureSession.StartRunning(); }
/// <inheritdoc/> protected override void Dispose(bool disposing) { Controller = null; // MonoMac has some problems w/ lifetime. This was an attempt to prevent leaking dialogs. // However, there are cases that result in over-release that are not easily identified. // So, leak it is! :( // base.Dispose(disposing); }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); // Create session session = new QTCaptureSession(); // Attach preview to session captureView.CaptureSession = session; captureView.WillDisplayImage = WillDisplayImage; // Attach outputs to session movieFileOutput = new QTCaptureMovieFileOutput(); movieFileOutput.WillStartRecording += WillStartRecording; movieFileOutput.DidStartRecording += DidStartRecording; movieFileOutput.ShouldChangeOutputFile = ShouldChangeOutputFile; movieFileOutput.MustChangeOutputFile += MustChangeOutputFile; // These ones we care about, some notifications movieFileOutput.WillFinishRecording += WillFinishRecording; movieFileOutput.DidFinishRecording += DidFinishRecording; NSError error; session.AddOutput(movieFileOutput, out error); audioPreviewOutput = new QTCaptureAudioPreviewOutput(); audioPreviewOutput.Volume = 0; session.AddOutput(audioPreviewOutput, out error); if (VideoDevices.Length > 0) { SelectedVideoDevice = VideoDevices [0]; } if (AudioDevices.Length > 0) { SelectedAudioDevice = AudioDevices [0]; } session.StartRunning(); // events: devices added/removed AddObserver(QTCaptureDevice.WasConnectedNotification, DevicesDidChange); AddObserver(QTCaptureDevice.WasDisconnectedNotification, DevicesDidChange); // events: connection format changes AddObserver(QTCaptureConnection.FormatDescriptionDidChangeNotification, FormatDidChange); AddObserver(QTCaptureConnection.FormatDescriptionWillChangeNotification, FormatWillChange); AddObserver(QTCaptureDevice.AttributeWillChangeNotification, AttributeWillChange); AddObserver(QTCaptureDevice.AttributeDidChangeNotification, AttributeDidChange); audioLevelTimer = NSTimer.CreateRepeatingScheduledTimer(0.1, UpdateAudioLevels); }
public override void WindowControllerDidLoadNib (NSWindowController windowController) { base.WindowControllerDidLoadNib (windowController); LoadImages (); history = new History (navigationCells); outlineView.DataSource = new DocTreeDataSource (this); outlineView.Delegate = new OutlineDelegate (this); webView.DecidePolicyForNavigation += HandleWebViewDecidePolicyForNavigation; }
public StatusBarController() { statusBar = new NSStatusBar(); statusItem = statusBar.CreateStatusItem(NSStatusItemLength.Variable); popOver = new NSPopover(); ViewController.QuitButtonClicked += HandleQuitButtonClicked; ViewController.AboutMenuItemClicked += HandleAboutMenuItemClicked; storyboard = NSStoryboard.FromName("Main", null); windowController = storyboard.InstantiateControllerWithIdentifier("AboutWindow") as NSWindowController; }
// Called when created directly from a XIB file // [Export("initWithCoder:")] // public MyDocument(NSCoder coder) : base(coder) // { // } #endregion #region - LifeCycle public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); // Add code to here after the controller has loaded the document window if (Cars == null) { Cars = new NSMutableArray(); } }
void OpenLocation(NSObject sender) { if (connectToAgentWindowController == null) { connectToAgentWindowController = (NSWindowController)NSStoryboard .FromName("Main", NSBundle.MainBundle) .InstantiateControllerWithIdentifier("ConnectToAgentWindowController"); } connectToAgentWindowController.Window.MakeKeyAndOrderFront(sender); }
public override void WindowControllerDidLoadNib (NSWindowController windowController) { base.WindowControllerDidLoadNib (windowController); WebView.UIDelegate = new MarkdownWebUIDelegate (); WebView.PolicyDelegate = new MarkdownWebPolicyDelegate (); WebView.FrameLoadDelegate = new MarkdownWebFrameLoadDelegate (this); var templatePath = Path.Combine (NSBundle.MainBundle.ResourcePath, "Template.html"); WebView.MainFrame.LoadRequest (new NSUrlRequest (new NSUrl (templatePath))); }
public override void WindowControllerDidLoadNib (NSWindowController windowController) { base.WindowControllerDidLoadNib (windowController); WebView.UIDelegate = new MarkdownWebUIDelegate (); WebView.DecidePolicyForNavigation += OnDecidePolicyForNavigation; WebView.FinishedLoad += (o, e) => ReloadDocument (); var templatePath = Path.Combine (NSBundle.MainBundle.ResourcePath, "Template.html"); WebView.MainFrame.LoadRequest (new NSUrlRequest (new NSUrl (templatePath))); }
public override async void WindowControllerDidLoadNib (NSWindowController windowController) { base.WindowControllerDidLoadNib (windowController); // Add code to here after the controller has loaded the document window var filename = Path.Combine (NSBundle.MainBundle.BundlePath, "sample_iTunes.mov"); NSUrl url = NSUrl.FromFilename ("/Users/kichang/Downloads/sample_iTunes.mov"); asset = AVAsset.FromUrl (url); string[] keys = { "playable", "hasProtectedContent", "tracks", "duration" }; Task task = asset.LoadValuesTaskAsync (keys); await task; NSError assetError; if (asset.StatusOfValue ("playable", out assetError) == AVKeyValueStatus.Failed) { return; } if (asset.Playable) { float height = asset.Tracks [0].NaturalSize.Height; float width = asset.Tracks [0].NaturalSize.Width; playerItem = new AVPlayerItem (asset); player = new AVPlayer (); playerLayer = AVPlayerLayer.FromPlayer (player); playerView.WantsLayer = true; playerView.Layer.BackgroundColor = new CGColor (1, 1, 1, 1); playerLayer.Frame = new RectangleF (0, 0, width, height); playerView.Frame = playerLayer.Frame; playerView.Layer.AddSublayer (playerLayer); player.ReplaceCurrentItemWithPlayerItem (playerItem); player.Play (); } }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); WebView.UIDelegate = new MarkdownWebUIDelegate(); WebView.DecidePolicyForNavigation += OnDecidePolicyForNavigation; WebView.FinishedLoad += (o, e) => ReloadDocument(); var templatePath = Path.Combine(NSBundle.MainBundle.ResourcePath, "Template.html"); WebView.MainFrame.LoadRequest(new NSUrlRequest(new NSUrl(templatePath))); }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); WebView.UIDelegate = new MarkdownWebUIDelegate(); WebView.PolicyDelegate = new MarkdownWebPolicyDelegate(); WebView.FrameLoadDelegate = new MarkdownWebFrameLoadDelegate(this); var templatePath = Path.Combine(NSBundle.MainBundle.ResourcePath, "Template.html"); WebView.MainFrame.LoadRequest(new NSUrlRequest(new NSUrl(templatePath))); }
void ShowCauseEffectMatrixScreen( UnexplainedVarianceProportionMatrix unexplainedVarianceProportionMatrix, CausalRelationshipMatrix causalRelationshipMatrix ) { CauseEffectMatrixWindowController = (NSWindowController)Storyboard.InstantiateControllerWithIdentifier("CauseEffectMatrixWindowController"); var viewController = (CauseEffectMatrixViewController)CauseEffectMatrixWindowController.Window.ContentViewController; viewController.ViewModel = new CauseEffectMatrixViewModel(unexplainedVarianceProportionMatrix, causalRelationshipMatrix); CauseEffectMatrixWindowController.ShowWindow(this); }
public override void WindowControllerDidLoadNib(NSWindowController aController) { this.SendMessageSuper(MyDocumentClass, "windowControllerDidLoadNib:", aController); if (this.FileURL != null) { NSError error; QTMovie movie = QTMovie.MovieWithURLError(this.FileURL, out error); movie.SetAttributeForKey((NSNumber) true, QTMovie.QTMovieEditableAttribute); this.mMovieView.Movie = movie; } }
public override void MakeWindowControllers() { var controller = new NSWindowController("EditorWindow"); //Console.WriteLine ("Made window controller: " + controller); //var c = new ViewController (); //c.MakeEditor (); //c.Document = this; //controller.LoadWindow (); //controller.Window.ContentViewController = c; //controller.ContentViewController = c; AddWindowController(controller); }
public override void WindowControllerDidLoadNib (NSWindowController windowController) { base.WindowControllerDidLoadNib (windowController); UpdateBackForwardSensitivity (); noteWebView.FinishedLoad += HandleFinishedLoad; noteWebView.DecidePolicyForNavigation += HandleWebViewDecidePolicyForNavigation; Editable (true); if (string.IsNullOrEmpty(currentNoteID)) LoadNewNote(); else LoadNote(); }
public WindowHandle CreateWindow(Page page, WindowCreationFlags flags) { var window = new NSWindow(new CoreGraphics.CGRect(100, 100, 640, 480), NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled | NSWindowStyle.Miniaturizable, NSBackingStore.Buffered, false) { ContentViewController = page.CreateViewController(), IsVisible = !flags.HasFlag(WindowCreationFlags.Hidden) }; using (var ctrl = new NSWindowController(window)) ctrl.ShowWindow(null); return(new MacWindowHandle(window)); }
partial void ShowResults(NSButton sender) { CauseEffectMatrixWindowController = (NSWindowController)Storyboard.InstantiateControllerWithIdentifier("CauseEffectMatrixWindowController"); var viewController = (CauseEffectMatrixViewController)CauseEffectMatrixWindowController.Window.ContentViewController; viewController.ViewModel = new CauseEffectMatrixViewModel( ViewModel._UnexplainedVarianceProportionMatrix, ViewModel._CausalRelationshipMatrix ); View.Window.Close(); CauseEffectMatrixWindowController.ShowWindow(this); }
void ShowModelsPairScreen( UnexplainedVarianceProportionMatrix unexplainedVarianceProportionMatrix, CausalRelationshipMatrix causalRelationshipMatrix ) { ModelsComparingWindowController = (NSWindowController)Storyboard.InstantiateControllerWithIdentifier("ModelsPairWindowController"); var viewController = (ModelsComparingViewController)ModelsComparingWindowController.Window.ContentViewController; viewController.ViewModel = new ModelsComparingViewModel(unexplainedVarianceProportionMatrix, causalRelationshipMatrix); viewController.Algorithms = algorithmService; ModelsComparingWindowController.ShowWindow(this); }
public override void WindowControllerDidLoadNib (NSWindowController windowController) { base.WindowControllerDidLoadNib (windowController); // Create session session = new QTCaptureSession (); // Attach preview to session captureView.CaptureSession = session; captureView.WillDisplayImage = WillDisplayImage; // Attach outputs to session movieFileOutput = new QTCaptureMovieFileOutput (); movieFileOutput.WillStartRecording += WillStartRecording; movieFileOutput.DidStartRecording += DidStartRecording; movieFileOutput.ShouldChangeOutputFile = ShouldChangeOutputFile; movieFileOutput.MustChangeOutputFile += MustChangeOutputFile; // These ones we care about, some notifications movieFileOutput.WillFinishRecording += WillFinishRecording; movieFileOutput.DidFinishRecording += DidFinishRecording; NSError error; session.AddOutput (movieFileOutput, out error); audioPreviewOutput = new QTCaptureAudioPreviewOutput (); audioPreviewOutput.Volume = 0; session.AddOutput (audioPreviewOutput, out error); if (VideoDevices.Length > 0) SelectedVideoDevice = VideoDevices [0]; if (AudioDevices.Length > 0) SelectedAudioDevice = AudioDevices [0]; session.StartRunning (); // events: devices added/removed AddObserver (QTCaptureDevice.WasConnectedNotification, DevicesDidChange); AddObserver (QTCaptureDevice.WasDisconnectedNotification, DevicesDidChange); // events: connection format changes AddObserver (QTCaptureConnection.FormatDescriptionDidChangeNotification, FormatDidChange); AddObserver (QTCaptureConnection.FormatDescriptionWillChangeNotification, FormatWillChange); AddObserver (QTCaptureDevice.AttributeWillChangeNotification, AttributeWillChange); AddObserver (QTCaptureDevice.AttributeDidChangeNotification, AttributeDidChange); audioLevelTimer = NSTimer.CreateRepeatingScheduledTimer (0.1, UpdateAudioLevels); }
public override void FinishedLaunching(NSObject notification) { AppController.Initialize (); mainWindowController = new MainWindowController (); mainWindowController.ShowWindow (this); if (openFile != null) mainWindowController.Window.Miniaturize (this); else { if (VersionInformationWindowController.ShouldShowVersionInformation) { VersionInformationWindowController versionInfo = new VersionInformationWindowController (); versionInfo.ShowWindow (this); } } }
private static ModalResult RunWindow(NSWindowController controller) { int response = NSApplication.SharedApplication.RunModalForWindow(controller.Window); controller.Window.Close(); controller.Window.OrderOut(null); if (!Enum.IsDefined(typeof(ModalResult), response)) { response = 0; } return((ModalResult)response); }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); // Add code to here after the controller has loaded the document window if (HasPass) { StartPasswordSheet(); } else { SetupDoc(); } }
public override void DidFinishLaunching(NSNotification notification) { var storyboard = NSStoryboard.FromName("Main", null); _controller = storyboard.InstantiateControllerWithIdentifier("WindowController") as NSWindowController; _item = NSStatusBar.SystemStatusBar.CreateStatusItem(NSStatusItemLength.Variable); _item.Button.Image = NSImage.ImageNamed("status_enabled"); _item.Menu = new NSMenu(); var watcherItem = new NSMenuItem("Disable watcher"); watcherItem.Activated += (sender, e) => { _isAppEnabled = !_isAppEnabled; watcherItem.Title = _isAppEnabled ? $"Disable watcher" : $"Enable watcher"; _item.Button.Image = _isAppEnabled ? NSImage.ImageNamed("status_enabled") : NSImage.ImageNamed("status_disabled"); if (_isAppEnabled) { StartTimer(); } else { StopTimer(); } }; var aboutItem = new NSMenuItem("About"); aboutItem.Activated += (sender, e) => { if (_controller?.Window?.IsVisible == false) { _controller.ShowWindow(this); } }; var exitItem = new NSMenuItem("Exit"); exitItem.Activated += (sender, e) => { NSApplication.SharedApplication.Terminate(this); }; _item.Menu.AddItem(watcherItem); _item.Menu.AddItem(aboutItem); _item.Menu.AddItem(NSMenuItem.SeparatorItem); _item.Menu.AddItem(exitItem); StartTimer(); }
private static ModalResult RunWindow (NSWindowController controller) { //NSApplication.SharedApplication.BeginSheet (controller.Window, NSApplication.SharedApplication.MainWindow); int response = NSApplication.SharedApplication.RunModalForWindow (controller.Window); //NSApplication.SharedApplication.EndSheet(controller.Window); controller.Window.Close(); controller.Window.OrderOut(null); if (!Enum.IsDefined(typeof(ModalResult), response)) response = 0; return (ModalResult)response; }
public override void WindowControllerDidLoadNib (NSWindowController windowController) { NSError err; // Create a movie, and store the information in memory on an NSMutableData movie = new QTMovie (new NSMutableData (1), out err); if (movie == null) { NSAlert.WithError (err).RunModal (); return; } movieView.Movie = movie; // Find video device captureSession = new QTCaptureSession (); var device = QTCaptureDevice.GetDefaultInputDevice (QTMediaType.Video); if (device == null) { new NSAlert { MessageText = "You do not have a camera connected." }.BeginSheet (windowController.Window); return; } else if (!device.Open (out err)) { NSAlert.WithError (err).BeginSheet (windowController.Window); return; } // Add device input captureInput = new QTCaptureDeviceInput (device); if (!captureSession.AddInput (captureInput, out err)) { NSAlert.WithError (err).BeginSheet (windowController.Window); return; } // Create decompressor for video output, to get raw frames decompressedVideo = new QTCaptureDecompressedVideoOutput (); decompressedVideo.DidOutputVideoFrame += delegate(object sender, QTCaptureVideoFrameEventArgs e) { lock (this) { currentImage = e.VideoFrame; } }; if (!captureSession.AddOutput (decompressedVideo, out err)) { NSAlert.WithError (err).BeginSheet (windowController.Window); return; } // Activate preview captureView.CaptureSession = captureSession; // Start running. captureSession.StartRunning (); }
public override void AwakeFromNib() { base.AwakeFromNib(); currentDelegate = NSApplication.SharedApplication.Delegate as AppDelegate; LyricsTextView.BackgroundColor = NSColor.Clear; //Getting the font size from preferences LyricsTextView.Font = NSFont.SystemFontOfSize(NSUserDefaults.StandardUserDefaults.FloatForKey("TextSize"), 0.2f); // Blur Overlay is the Visual Effect View with Blur and Vibrancy BlurOverlay.WantsLayer = true; BlurOverlay.Material = NSVisualEffectMaterial.Dark; BlurOverlay.BlendingMode = NSVisualEffectBlendingMode.WithinWindow; ThumbnailView.WantsLayer = true; ThumbnailView.Layer.CornerRadius = 32.0f; // Progress bar shows how much of lyrics have you covered. It works with scrollview progress = ProgressBar.Frame; //Adding observer of Scroll view change in Notification Center. It helps to update the width of progress bar MainScroll.ContentView.PostsBoundsChangedNotifications = true; NSNotificationCenter.DefaultCenter.AddObserver(this, new ObjCRuntime.Selector("boundsChange:"), NSView.BoundsChangedNotification, MainScroll.ContentView); #region Settings Menu settingsMenu = new NSMenu(); artwork = new NSMenuItem("Background Artwork", new ObjCRuntime.Selector("artwork:"), ""); launch = new NSMenuItem("Launch at Login", new ObjCRuntime.Selector("launch:"), ""); NSMenuItem about = new NSMenuItem("About", new ObjCRuntime.Selector("about:"), ""); NSMenuItem quit = new NSMenuItem("Quit Carol", new ObjCRuntime.Selector("quit:"), "q"); settingsMenu.AddItem(artwork); settingsMenu.AddItem(launch); settingsMenu.AddItem(about); settingsMenu.AddItem(NSMenuItem.SeparatorItem); settingsMenu.AddItem(quit); #endregion OpenInBrowserButton.AddTrackingArea(new NSTrackingArea(OpenInBrowserButton.Bounds, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveAlways, this, null)); ChangeTextSizeButton.AddTrackingArea(new NSTrackingArea(ChangeTextSizeButton.Bounds, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveAlways, this, null)); SettingsButton.AddTrackingArea(new NSTrackingArea(SettingsButton.Bounds, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveAlways, this, null)); cursor = NSCursor.CurrentSystemCursor; windowController = currentDelegate.Storyboard.InstantiateControllerWithIdentifier("AboutWindow") as NSWindowController; }
public override void WindowControllerDidLoadNib (NSWindowController windowController) { base.WindowControllerDidLoadNib (windowController); tabSelector.SelectFirst (this); LoadImages (); history = new History (navigationCells); SetupOutline (); SetupSearch (); SetupBookmarks (); webView.DecidePolicyForNavigation += HandleWebViewDecidePolicyForNavigation; webView.FinishedLoad += HandleWebViewFinishedLoad; HideMultipleMatches (); if (!string.IsNullOrEmpty (initialLoadFromUrl)) LoadUrl (initialLoadFromUrl); }
public static void SmartWindow(this NSWindowController windowController) { if (windowController.Window is NSWindow window) { window.StyleMask = NSWindowStyle.UnifiedTitleAndToolbar | NSWindowStyle.FullSizeContentView | NSWindowStyle.Titled; if (window.Toolbar != null) { window.Toolbar.Visible = false; } window.TitleVisibility = NSWindowTitleVisibility.Hidden; window.TitlebarAppearsTransparent = true; } }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); // Add code to here after the controller has loaded the document window if (Employees == null) { Employees = new List <Person>(); } tableView.WeakDataSource = this; tableView.WeakDelegate = this; tableView.BackgroundColor = PreferenceController.PreferenceTableBgColor; }
void UpdateHandler(NSObject sender, Task <UpdateItem> update) { if (ClientInfo.Flavor == ClientFlavor.Inspector) { return; } if (updaterWindowController != null) { updaterWindowController.Close(); updaterWindowController.Dispose(); updaterWindowController = null; } if (update.IsFaulted) { if (sender != null) { MacUpdaterViewModel.PresentUpdateCheckFailedDialog(update.Exception); } return; } if (update.IsCanceled) { return; } if (update.Result == null) { if (sender != null) { MacUpdaterViewModel.PresentUpToDateDialog(); } return; } updaterWindowController = (NSWindowController)updaterStoryboard .InstantiateControllerWithIdentifier("UpdateAvailableWindowController"); updaterWindowController.Window.WillClose += (o, e) => { updaterWindowController.Dispose(); updaterWindowController = null; }; ((UpdaterViewController)updaterWindowController.ContentViewController) .PresentUpdate(update.Result); }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); // Add code to here after the controller has loaded the document window stretchView.AddToUndo = new UndoDelegate(delegate(Oval oval) { NSUndoManager undo = this.UndoManager; NSArray args = NSArray.FromObjects(new object[] { oval }); undo.RegisterUndoWithTarget(this, new Selector("undoAdd:"), args); undo.SetActionname("Add Oval"); }); stretchView.Ovals = Ovals; }
partial void ShowParametersRelationships(NSButton sender) { ParameterDependenciesWindowController = (NSWindowController)Storyboard.InstantiateControllerWithIdentifier("ParameterDependenciesWindowController"); var viewController = (ParameterDependenciesViewController)ExogenousProcessesWindowController.Window.ContentViewController; //viewController.ViewModel = new ParameterDependenciesViewModel( //new ExogenousParameters( // Enumerable.Range(0, ViewModel.UVPMatrix.Dimension.Rows) // .Select(ViewModel.UVPMatrix.RowByIndex) // .Select(uvpRow => uvpRow.First(elem => elem != null)) // .Select(uvp => uvp.Output) // .ToArray(), // ViewModel.CRMatrix, // ViewModel.UVPMatrix //) //); }
public override void WindowControllerDidLoadNib (NSWindowController windowController) { base.WindowControllerDidLoadNib (windowController); tabSelector.SelectFirst (this); history = new History (navigationCells); SetupOutline (); SetupSearch (); SetupBookmarks (); webView.DecidePolicyForNavigation += HandleWebViewDecidePolicyForNavigation; webView.FinishedLoad += HandleWebViewFinishedLoad; ((WebViewExtraordinaire)webView).SwipeEvent += (sender, e) => { if (e.Side == SwipeSide.Left && history.BackClicked ()) navigationCells.SetSelected (true, 0); else if (history.ForwardClicked ()) navigationCells.SetSelected (true, 1); }; HideMultipleMatches (); LoadUrl (string.IsNullOrEmpty (initialLoadFromUrl) ? "root:" : initialLoadFromUrl); }
public override void WindowControllerDidLoadNib (NSWindowController windowController) { base.WindowControllerDidLoadNib (windowController); // Add code to here after the controller has loaded the document window windowController.Window.DidBecomeKey += delegate { NSFontManager.SharedFontManager.Target = this; NSFontPanel.SharedFontPanel.SetPanelFont (arcView.Font, false); }; txtField.Changed += delegate(object sender, EventArgs e) { arcView.Title = txtField.StringValue; // you can also use the object that is sent from the NSNotification //NSNotification notification = (NSNotification)sender; //NSTextField field = (NSTextField)notification.Object; //arcView.Title = field.StringValue; updateDisplay (); }; }
// Called when created directly from a XIB file /* [Export ("initWithCoder:")] public MyDocument (NSCoder coder) : base (coder) { } */ public override void WindowControllerDidLoadNib (NSWindowController windowController) { base.WindowControllerDidLoadNib (windowController); Console.WriteLine ("On callback, sleeping"); System.Threading.Thread.Sleep (1000); // Enable user to manipulate the view with the built-in behavior sceneView.AllowsCameraControl = true; // Improves anti-aliasing when scene is still sceneView.JitteringEnabled = true; // Play the animations sceneView.Playing = true; // Automatically light scenes without light sceneView.AutoenablesDefaultLighting = true; // Background color sceneView.BackgroundColor = NSColor.Black; var url = NSBundle.MainBundle.PathForResource ("scene", "dae"); sceneView.LoadScene (url); }
public override void ShouldCloseWindowController(NSWindowController windowController, NSObject delegateObject, Selector shouldCloseSelector, IntPtr contextInfo) { base.ShouldCloseWindowController(windowController, delegateObject, shouldCloseSelector, contextInfo); }
public override void WindowControllerDidLoadNib (NSWindowController windowController) { base.WindowControllerDidLoadNib (windowController); // Add code to here after the controller has loaded the document window // NSView view = new NSView (); // var scrollView = new NSScrollView (); // var clipView = new NSClipView (); // // var textView = new NSTextView (); // clipView.AddSubview (textView); // // scrollView.AddSubview (clipView); // // view.AddSubview (scrollView); // // windowController.Window.ContentView.AddSubview (view); //Xcode assistant editor aint working, so I'm resorting to finding views manually /*var textViews = windowController.Window.ContentView.FindViews<NSTextView> (); var count = 0; //foreach(var view in textViews) //{ // view.InsertText (new NSString("View: " + count++)); //}//0: cshapr //1: output //2:Intermediate //3://CPP CSharpTextBox = textViews [0]; ConsoleTextBox = textViews [1]; IntermediateTextBox = textViews [2]; CPPTextBox = textViews [3]; */ windowController.Window.Title = "Visual Compiler Mac"; CppFileList.UsesDataSource = true; MainWindowViewModel.TempDir = Path.Combine (Path.GetTempPath (), "CsNative"); if (!Directory.Exists (MainWindowViewModel.TempDir)) { Directory.CreateDirectory (MainWindowViewModel.TempDir); } // Dispatcher.Invoke(() => Console.SetOut(new ControlWriter(Errors))); CompilerUtils.DeleteFilesByWildcards ("Test*.exe", MainWindowViewModel.TempDir); CSharpTextEditor.TextStorage.TextStorageDidProcessEditing += (object sender, EventArgs e) => { ViewModel.SourceCode = CSharpTextEditor.Value; }; CPPTextEditor.TextStorage.TextStorageDidProcessEditing += (object sender, EventArgs e) => { ViewModel.OutputCode = CPPTextEditor.Value; }; CSharpTextEditor.Value = VisualCompilerConstants.InitialCode; CPPRunButton.Activated += RunCPPButton_Click; OpenFileButton.Activated += OpenFile; CppFileList.Activated += SelectedFile; CSharpRunButton.Activated += RunCSharpButton_Click; TestButton.Activated += TestButton_Click; RunAllTests.Activated+= RunAllTests_Click; }
public NativeFormHandler(NSWindowController windowController) : base(windowController) { }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib (windowController); UpdateBackForwardSensitivity (); noteWebView.FinishedLoad += HandleFinishedLoad; }
public override void WindowControllerDidLoadNib (NSWindowController windowController) { NSError error; base.WindowControllerDidLoadNib (windowController); // Create session session = new QTCaptureSession (); // Attach preview to session captureView.CaptureSession = session; captureView.WillDisplayImage = (view, image) => { if (videoPreviewFilterDescription == null) return image; var selectedFilter = (NSString) videoPreviewFilterDescription [filterNameKey]; var filter = CIFilter.FromName (selectedFilter); filter.SetDefaults (); filter.SetValueForKey (image, CIFilterInputKey.Image); return (CIImage) filter.ValueForKey (CIFilterOutputKey.Image); }; // Attach outputs to session movieFileOutput = new QTCaptureMovieFileOutput (); movieFileOutput.WillStartRecording += delegate { Console.WriteLine ("Will start recording"); }; movieFileOutput.DidStartRecording += delegate { Console.WriteLine ("Started Recording"); }; movieFileOutput.ShouldChangeOutputFile = (output, url, connections, reason) => { // Should change the file on error Console.WriteLine (reason.LocalizedDescription); return false; }; movieFileOutput.MustChangeOutputFile += delegate(object sender, QTCaptureFileErrorEventArgs e) { Console.WriteLine ("Must change file due to error"); }; // These ones we care about, some notifications movieFileOutput.WillFinishRecording += delegate(object sender, QTCaptureFileErrorEventArgs e) { Console.WriteLine ("Will finish recording"); InvokeOnMainThread (delegate { WillChangeValue ("Recording"); }); }; movieFileOutput.DidFinishRecording += delegate(object sender, QTCaptureFileErrorEventArgs e) { Console.WriteLine ("Recorded {0} bytes duration {1}", movieFileOutput.RecordedFileSize, movieFileOutput.RecordedDuration); DidChangeValue ("Recording"); if (e.Reason != null){ NSAlert.WithError (e.Reason).BeginSheet (Window, delegate {}); return; } var save = NSSavePanel.SavePanel; save.AllowedFileTypes = new string[] {"mov"}; save.CanSelectHiddenExtension = true; save.Begin (code => { NSError err2; if (code == (int)NSPanelButtonType.Ok){ NSFileManager.DefaultManager.Move (e.OutputFileURL, save.Url, out err2); } else { NSFileManager.DefaultManager.Remove (e.OutputFileURL.Path, out err2); } }); }; session.AddOutput (movieFileOutput, out error); audioPreviewOutput = new QTCaptureAudioPreviewOutput (); session.AddOutput (audioPreviewOutput, out error); if (VideoDevices.Length > 0) SelectedVideoDevice = VideoDevices [0]; if (AudioDevices.Length > 0) SelectedAudioDevice = AudioDevices [0]; session.StartRunning (); // events: devices added/removed AddObserver (QTCaptureDevice.WasConnectedNotification, DevicesDidChange); AddObserver (QTCaptureDevice.WasDisconnectedNotification, DevicesDidChange); // events: connection format changes AddObserver (QTCaptureConnection.FormatDescriptionDidChangeNotification, FormatDidChange); AddObserver (QTCaptureConnection.FormatDescriptionWillChangeNotification, FormatWillChange); AddObserver (QTCaptureDevice.AttributeDidChangeNotification, AttributeDidChange); AddObserver (QTCaptureDevice.AttributeWillChangeNotification, AttributeWillChange); }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); // Add code to here after the controller has loaded the document window stretchView.AddToUndo = new UndoDelegate(delegate(Oval oval) { NSUndoManager undo = this.UndoManager; NSArray args = NSArray.FromObjects(new object[]{oval}); undo.RegisterUndoWithTarget(this, new Selector("undoAdd:"), args); undo.SetActionname("Add Oval"); }); stretchView.Ovals = Ovals; }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); // Add code to here after the controller has loaded the document window if (Employees == null) Employees = new List<Person>(); tableView.WeakDataSource = this; tableView.WeakDelegate = this; tableView.BackgroundColor = PreferenceController.PreferenceTableBgColor; }
public override void ShouldCloseWindowController(NSWindowController windowController, NSObject delegateObject, Selector shouldCloseSelector, IntPtr contextInfo) { base.ShouldCloseWindowController(windowController, delegateObject, shouldCloseSelector, contextInfo); NSNotificationCenter.DefaultCenter.RemoveObserver(this); Console.WriteLine("{0}: Unregistered from notification center", this); }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); // Add code to here after the controller has loaded the document window if (Cars == null) Cars = new NSMutableArray(); }
public override void WindowControllerDidLoadNib(NSWindowController aController) { this.SendMessageSuper(MyDocumentClass, "windowControllerDidLoadNib:", aController); // Add any code here that need to be executed once the windowController has loaded the document's window. // .. // the following code adds the horizontal scroll bar to the scroll view and makes the text view horizontally // resizable so it can display text of any width: // NSRect frameRect; NSWindow theWindow = this.textView.Window; frameRect = this.textView.Frame; NSScrollView scrollview = this.textView.EnclosingScrollView; NSSize contentSize = scrollview.ContentSize; scrollview.BorderType = NSBorderType.NSNoBorder; scrollview.HasVerticalScroller = true; scrollview.HasHorizontalScroller = true; // for horizontal scrolling scrollview.AutoresizingMask = NSAutoresizingMask .NSViewWidthSizable | NSAutoresizingMask.NSViewHeightSizable; frameRect = NSRect.NSMakeRect(0, 0, contentSize.width, contentSize.height); this.textView.Frame = frameRect; this.textView.MinSize = NSSize.NSMakeSize(contentSize.width, contentSize.height); this.textView.MaxSize = NSSize.NSMakeSize(float.MaxValue, float.MaxValue); this.textView.IsVerticallyResizable = true; this.textView.IsHorizontallyResizable = true; // for horizontal scrolling this.textView.AutoresizingMask = NSAutoresizingMask.NSViewWidthSizable | NSAutoresizingMask.NSViewHeightSizable; this.textView.TextContainer.ContainerSize = NSSize.NSMakeSize(float.MaxValue, float.MaxValue); this.textView.TextContainer.WidthTracksTextView = true; scrollview.DocumentView = this.textView; theWindow.ContentView = scrollview; theWindow.MakeKeyAndOrderFront(null); theWindow.MakeFirstResponder(this.textView); this.UpdateView(); }
public override void WindowControllerDidLoadNib(NSWindowController controller) { // Super. this.SendMessageSuper(MyPDFDocumentClass, "windowControllerDidLoadNib:", controller); if (this.FileName != null) { PDFDocument pdfDoc = new PDFDocument(NSURL.FileURLWithPath(this.FileName)).Autorelease<PDFDocument>(); this._pdfView.Document = pdfDoc; } // Page changed notification. NSNotificationCenter.DefaultCenter.AddObserverSelectorNameObject(this, ObjectiveCRuntime.Selector("pageChanged:"), PDFView.PDFViewPageChangedNotification, this._pdfView); // Find notifications. NSNotificationCenter.DefaultCenter.AddObserverSelectorNameObject(this, ObjectiveCRuntime.Selector("startFind:"), PDFDocument.PDFDocumentDidBeginFindNotification, this._pdfView.Document); NSNotificationCenter.DefaultCenter.AddObserverSelectorNameObject(this, ObjectiveCRuntime.Selector("findProgress:"), PDFDocument.PDFDocumentDidEndPageFindNotification, this._pdfView.Document); NSNotificationCenter.DefaultCenter.AddObserverSelectorNameObject(this, ObjectiveCRuntime.Selector("endFind:"), PDFDocument.PDFDocumentDidEndFindNotification, this._pdfView.Document); // Set self to be delegate (find). this._pdfView.Document.Delegate = this; // Get outline. this._outline = this._pdfView.Document.OutlineRoot; if (this._outline != null) { this._outline.Retain(); // Remove text that says, "No outline." this._noOutlineText.RemoveFromSuperview(); this._noOutlineText = null; // Force it to load up. this._outlineView.ReloadData(); } else { // Remove outline view (leaving instead text that says, "No outline."). this._outlineView.EnclosingScrollView.RemoveFromSuperview(); this._outlineView = null; } // Open drawer. this._drawer.Open(); // Size the window. NSSize windowSize = this._pdfView.RowSizeForPage(this._pdfView.CurrentPage); if (((this._pdfView.DisplayMode & PDFDisplayMode.kPDFDisplaySinglePageContinuous) == PDFDisplayMode.kPDFDisplaySinglePageContinuous) && (this._pdfView.Document.PageCount > 1)) { windowSize.width += NSScroller.ScrollerWidth; } controller.Window.SetContentSize(windowSize); }