private void OnScreenRotated(NSNotification nsNotification) { if (gameContext == null) return; UpdateOverlayAndEditBarLayout(); }
void DeviceOrientationDidChange (NSNotification notification) { var orientation = UIDevice.CurrentDevice.Orientation; // Don't update the reference orientation when the device orientation is face up/down or unknown. if (UIDeviceOrientation.Portrait == orientation || (UIDeviceOrientation.LandscapeLeft == orientation || UIDeviceOrientation.LandscapeRight == orientation)) videoProcessor.ReferenceOrientation = OrientationFromDeviceOrientation (orientation); }
private void KeyBoardUpNotification(NSNotification notifi) { var r = UIKeyboard.BoundsFromNotification(notifi); var screen = UIScreen.MainScreen.Bounds; SetElementSize(new Size(r.Width, screen.Height - r.Height)); }
public override void ItemDidExpand (NSNotification notification) { TreeDataNode node = notification.UserInfo ["NSObject"] as TreeDataNode; if (node != null) { Console.WriteLine("Finished Expanding: " + node.Data.NodeDisplay); } }
/// <summary> /// Devices the orientation did change. /// </summary> /// <param name="notification">Notification.</param> public static void DeviceOrientationDidChange (NSNotification notification) { var orientation = UIDevice.CurrentDevice.Orientation; bool isPortrait = orientation == UIDeviceOrientation.Portrait || orientation == UIDeviceOrientation.PortraitUpsideDown; SendOrientationMessage(isPortrait); }
void HandleResultViewTableViewSelectionDidChange(NSNotification aNotification) { if (SelectionChanged != null) { SelectionChanged(this, EventArgs.Empty); } }
public void ShowDetailTargetDidChange (NSNotification notification) { foreach (var cell in TableView.VisibleCells) { NSIndexPath indexPath = TableView.IndexPathForCell (cell); WillDisplay (TableView, cell, indexPath); } }
public override void WillBecomeActive(NSNotification notification) { if (NSApplication.SharedApplication.DockTile.BadgeLabel != null) { Program.Controller.ShowEventLogWindow (); NSApplication.SharedApplication.DockTile.BadgeLabel = null; } }
void KeyboardWillShow (NSNotification notification) { var nsValue = notification.UserInfo.ObjectForKey (UIKeyboard.BoundsUserInfoKey) as NSValue; if (nsValue == null) return; var kbdBounds = nsValue.RectangleFValue; Scroll.Frame = ComputeComposerSize (kbdBounds); }
private void OnKeyboardNotification (NSNotification notification) { if (IsViewLoaded) { //Check if the keyboard is becoming visible bool visible = notification.Name == UIKeyboard.WillShowNotification; //Start an animation, using values from the keyboard UIView.BeginAnimations ("AnimateForKeyboard"); UIView.SetAnimationBeginsFromCurrentState (true); UIView.SetAnimationDuration (UIKeyboard.AnimationDurationFromNotification (notification)); UIView.SetAnimationCurve ((UIViewAnimationCurve)UIKeyboard.AnimationCurveFromNotification (notification)); //Pass the notification, calculating keyboard height, etc. bool landscape = InterfaceOrientation == UIInterfaceOrientation.LandscapeLeft || InterfaceOrientation == UIInterfaceOrientation.LandscapeRight; if (visible) { var keyboardFrame = UIKeyboard.FrameEndFromNotification (notification); OnKeyboardChanged (visible, landscape ? keyboardFrame.Width : keyboardFrame.Height); } else { var keyboardFrame = UIKeyboard.FrameBeginFromNotification (notification); OnKeyboardChanged (visible, landscape ? keyboardFrame.Width : keyboardFrame.Height); } //Commit the animation UIView.CommitAnimations (); } }
public override void DidFinishLaunching(NSNotification notification) { suupdater.AutomaticallyChecksForUpdates = true; suupdater.CheckForUpdatesInBackground (); NewHandler (this); }
public override void DidFinishLaunching (NSNotification notification) { villain = new Villain { Name = "Lex Luthor", LastKnownLocation = "Smallville", SwornEnemy = "Superman", PrimaryMotivation = "Revenge", Powers = new [] {"Intellect", "Leadership"}, PowerSource = "Superhero Action", Evilness = 9 }; villains.Add (villain); // initialize delegates after critical data initialized villainsTableView.DataSource = new DataSource (this); villainsTableView.Delegate = new VillainsTableViewDelegate (this); notesView.TextDidChange += delegate { villain.Notes = notesView.Value; }; villainsTableView.ReloadData (); villainsTableView.SelectRow (0, false); UpdateDetailViews (); }
public void queryNotification (NSNotification note) { // the NSMetadataQuery will send back a note when updates are happening. By looking at the [note name], we can tell what is happening // the query has just started if (note.Name == NSMetadataQuery.DidStartGatheringNotification) { Console.WriteLine ("search: started gathering"); progressSearch.Hidden = false; progressSearch.StartAnimation (this); progressSearchLabel.StringValue = "Searching...."; } // at this point, the query will be done. You may recieve an update later on. if (note.Name == NSMetadataQuery.DidFinishGatheringNotification) { Console.WriteLine ("search: finished gathering"); progressSearch.Hidden = true; progressSearch.StopAnimation (this); loadResultsFromQuery (note); } // the query is still gathering results... if (note.Name == NSMetadataQuery.GatheringProgressNotification){ Console.WriteLine ("search: progressing...."); progressSearch.StartAnimation (this); } // an update will happen when Spotlight notices that a file as added, removed, or modified that affected the search results. if (note.Name == NSMetadataQuery.DidUpdateNotification) Console.WriteLine ("search: an updated happened."); }
private void HandleAnnotationAdded(NSNotification notif) { Console.WriteLine ("Annotation added"); if(notif.Object is PSPDFHighlightAnnotation) { ((PSPDFHighlightAnnotation)notif.Object).Color = defaultHighlightColor; } // Show annotations toolbar. UIView.Animate(0.3f, () => { this.verticalToolbar.Alpha = 1f; }); // Show scrobble bar. this.SetScrobbleBarEnabled (true, true); var toolbar = this.AnnotationButtonItem.AnnotationToolbar; if(toolbar.ToolbarMode == PSPDFAnnotationToolbarMode.Draw) { toolbar.ToolbarMode = PSPDFAnnotationToolbarMode.None; toolbar.FinishDrawingAnimated(false, true); return; } this.HUDViewMode = PSPDFHUDViewMode.Automatic; this.HUDVisible = true; toolbar.ToolbarMode = PSPDFAnnotationToolbarMode.None; }
void DataReloaded (NSNotification notification) { doc = (MonkeyDocument)notification.Object; alertText.Text = string.Format ("{0} dataReloaded: notification", DateTime.Now.ToString ("H:mm:ss")); // we just overwrite whatever was being typed, no conflict resolution for now docText.Text = doc.DocumentString; }
protected virtual void KeyboardDidShowNotification(NSNotification notification) { UIView activeView = KeyboardGetActiveView(); if (activeView == null) return; ((UITextField)activeView).ShowDoneButtonOnKeyboard(); UIScrollView scrollView = activeView.FindSuperviewOfType(this.View, typeof(UIScrollView)) as UIScrollView; if (scrollView == null) return; RectangleF keyboardBounds = UIKeyboard.BoundsFromNotification(notification); UIEdgeInsets contentInsets = new UIEdgeInsets(0.0f, 0.0f, keyboardBounds.Size.Height, 0.0f); scrollView.ContentInset = contentInsets; scrollView.ScrollIndicatorInsets = contentInsets; // If activeField is hidden by keyboard, scroll it so it's visible RectangleF viewRectAboveKeyboard = new RectangleF(this.View.Frame.Location, new SizeF(this.View.Frame.Width, this.View.Frame.Size.Height - keyboardBounds.Size.Height)); RectangleF activeFieldAbsoluteFrame = activeView.Superview.ConvertRectToView(activeView.Frame, this.View); // activeFieldAbsoluteFrame is relative to this.View so does not include any scrollView.ContentOffset // Check if the activeField will be partially or entirely covered by the keyboard if (!viewRectAboveKeyboard.Contains(activeFieldAbsoluteFrame)) { // Scroll to the activeField Y position + activeField.Height + current scrollView.ContentOffset.Y - the keyboard Height PointF scrollPoint = new PointF(0.0f, activeFieldAbsoluteFrame.Location.Y + activeFieldAbsoluteFrame.Height + scrollView.ContentOffset.Y - viewRectAboveKeyboard.Height); scrollView.SetContentOffset(scrollPoint, true); } }
public override void DidFinishLaunching (NSNotification notification) { mainWindowController = new MainWindowController (); // We create a tab control to insert both examples into, and set it to take the entire window and resize CGRect frame = mainWindowController.Window.ContentView.Frame; NSTabView tabView = new NSTabView (frame) { AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable }; NSTabViewItem firstTab = new NSTabViewItem () { View = new CustomDrawRectView (tabView.ContentRect), Label = "CustomDrawRectView" }; tabView.Add (firstTab); NSTabViewItem secondTab = new NSTabViewItem () { View = new CustomLayerBasedView (tabView.ContentRect), Label = "CustomLayerBasedView" }; tabView.Add (secondTab); mainWindowController.Window.ContentView.AddSubview (tabView); mainWindowController.Window.MakeKeyAndOrderFront (this); }
public void docStateChanged(NSNotification notification) { DocChange change = notification.object_().To<DocChange>(); NSGradient gradient = null; if (!NSObject.IsNullOrNil(change.Document)) { if ((change.Type & ChangeType.Palette) == ChangeType.Palette) { float[] locations = new float[change.Document.Palette.Length]; NSMutableArray colors = NSMutableArray.arrayWithCapacity((uint) change.Document.Palette.Length); for (int i = 0; i < change.Document.Palette.Length; ++i) { locations[i] = change.Document.Palette[i].Location; colors.addObject((NSColor) change.Document.Palette[i].Color); } gradient = NSGradient.Create(colors, locations).Retain(); } } else { gradient = NSGradient.Create(NSColor.blackColor(), NSColor.blackColor()).Retain(); } if (gradient != null) { if (m_gradient != null) m_gradient.release(); m_gradient = gradient; setNeedsDisplay(true); } }
public override void DidFinishLaunching (NSNotification notification) { testWindowController = new TestWindowController (); testWindowController.Window.MakeKeyAndOrderFront (this); }
public override void DidFinishLaunching(NSNotification notification) { mainWindowController = new MainWindowController (); // Tells the main window that it should be in focus and accept user input (key) mainWindowController.Window.MakeKeyAndOrderFront (this); }
public override void SelectionDidChange (NSNotification notification) { if (_app != null && _app.villainsTableView.SelectedRow >= 0) { _app.villain = _app.villains [(int)_app.villainsTableView.SelectedRow]; _app.UpdateDetailViews (); } }
public override void DidFinishLaunching(NSNotification notification) { mainWindowController = new MainWindowController (); // This is where we setup our visual tree. These could be setup in MainWindow.xib, but // this example is showing programmatic creation. // We create a tab control to insert both examples into, and set it to take the entire window and resize CGRect frame = mainWindowController.Window.ContentView.Frame; NSTabView tabView = new NSTabView (frame) { AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable }; NSTabViewItem firstTab = new NSTabViewItem () { View = OutlineSetup.SetupOutlineView (frame), Label = "NSOutlineView" }; tabView.Add (firstTab); NSTabViewItem secondTab = new NSTabViewItem () { View = TableSetup.SetupTableView (frame), Label = "NSTableView" }; tabView.Add (secondTab); mainWindowController.Window.ContentView.AddSubview (tabView); mainWindowController.Window.MakeKeyAndOrderFront (this); }
public override void DidFinishLaunching(NSNotification notification) { // Start the progress indicator animation. loadingProgressIndicator.StartAnimation (this); gameLogo.Image = new NSImage (NSBundle.MainBundle.PathForResource ("logo", "png")); archerButton.Image = new NSImage (NSBundle.MainBundle.PathForResource ("button_archer", "png")); warriorButton.Image = new NSImage (NSBundle.MainBundle.PathForResource ("button_warrior", "png")); // The size for the primary scene - 1024x768 is good for OS X and iOS. var size = new CGSize (1024, 768); // Load the shared assets of the scene before we initialize and load it. scene = new AdventureScene (size); scene.LoadSceneAssetsWithCompletionHandler (() => { scene.Initialize (); scene.ScaleMode = SKSceneScaleMode.AspectFill; SKView.PresentScene (scene); loadingProgressIndicator.StopAnimation (this); loadingProgressIndicator.Hidden = true; NSAnimationContext.CurrentContext.Duration = 2.0f; ((NSButton)archerButton.Animator).AlphaValue = 1.0f; ((NSButton)warriorButton.Animator).AlphaValue = 1.0f; scene.ConfigureGameControllers(); }); SKView.ShowsFPS = true; SKView.ShowsDrawCount = true; SKView.ShowsNodeCount = true; }
public override void DidFinishLaunching (NSNotification notification) { // Create a Status Bar Menu NSStatusBar statusBar = NSStatusBar.SystemStatusBar; var item = statusBar.CreateStatusItem (NSStatusItemLength.Variable); item.Title = "Text"; item.HighlightMode = true; item.Menu = new NSMenu ("Text"); var address = new NSMenuItem ("Address"); address.Activated += (sender, e) => { phrasesAddress(address); }; item.Menu.AddItem (address); var date = new NSMenuItem ("Date"); date.Activated += (sender, e) => { phrasesDate(date); }; item.Menu.AddItem (date); var greeting = new NSMenuItem ("Greeting"); greeting.Activated += (sender, e) => { phrasesGreeting(greeting); }; item.Menu.AddItem (greeting); var signature = new NSMenuItem ("Signature"); signature.Activated += (sender, e) => { phrasesSignature(signature); }; item.Menu.AddItem (signature); }
protected void OnWillRotate(NSNotification notification) { if (!this.IsViewLoaded) return; if (notification == null) return; var o1 = notification.UserInfo.ValueForKey(new NSString("UIApplicationStatusBarOrientationUserInfoKey")); int o2 = Convert.ToInt32(o1.ToString()); UIInterfaceOrientation toOrientation = (UIInterfaceOrientation)o2; var notModal = !(this.TabBarController.ModalViewController == null); var isSelectedTab = (this.TabBarController.SelectedViewController == this); //ConsoleD.WriteLine ("toOrientation:"+toOrientation); //ConsoleD.WriteLine ("isSelectedTab:"+isSelectedTab); var duration = UIApplication.SharedApplication.StatusBarOrientationAnimationDuration; if (!isSelectedTab || !notModal) { base.WillRotate(toOrientation, duration); UIViewController master = this.ViewControllers[0]; var theDelegate = this.Delegate; //YOU_DONT_FEEL_QUEAZY_ABOUT_THIS_BECAUSE_IT_PASSES_THE_APP_STORE UIBarButtonItem button = base.ValueForKey(new NSString("_barButtonItem")) as UIBarButtonItem; if (toOrientation == UIInterfaceOrientation.Portrait || toOrientation == UIInterfaceOrientation.PortraitUpsideDown) { if (theDelegate != null && theDelegate.RespondsToSelector(new Selector("splitViewController:willHideViewController:withBarButtonItem:forPopoverController:"))) { try { UIPopoverController popover = base.ValueForKey(new NSString("_hiddenPopoverController")) as UIPopoverController; theDelegate.WillHideViewController(this, master, button, popover); } catch (Exception e) { Console.WriteLine("There was a nasty error while notifyng splitviewcontrollers of a portrait orientation change: " + e.Message); } } } else { if (theDelegate != null && theDelegate.RespondsToSelector(new Selector("splitViewController:willShowViewController:invalidatingBarButtonItem:"))) { try { theDelegate.WillShowViewController(this, master, button); } catch (Exception e) { Console.WriteLine("There was a nasty error while notifyng splitviewcontrollers of a landscape orientation change: " + e.Message); } } } } }
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", "q", (s, e) => NSApplication.SharedApplication.Terminate (menu)); appMenu.AddItem (quitItem); menuItem.Submenu = appMenu; NSApplication.SharedApplication.MainMenu = menu; m_window = new NSWindow ( new CGRect (0, 0, 1024, 720), NSWindowStyle.Closable | NSWindowStyle.Miniaturizable | NSWindowStyle.Titled | NSWindowStyle.Resizable | NSWindowStyle.TexturedBackground, NSBackingStore.Buffered, false) { Title = "Bluebird WkBrowser", ReleasedWhenClosed = false, ContentMinSize = new CGSize (1024, 600), CollectionBehavior = NSWindowCollectionBehavior.FullScreenPrimary }; m_window.Center (); m_window.MakeKeyAndOrderFront (null); var viewController = new ViewController (); m_window.ContentView = viewController.View; m_window.ContentViewController = viewController; viewController.View.Frame = m_window.ContentView.Bounds; }
public void docStateChanged(NSNotification notification) { DocChange change = notification.object_().To<DocChange>(); m_document = change.Document; m_exponent.setEnabled(!NSObject.IsNullOrNil(m_document)); if (!NSObject.IsNullOrNil(m_document)) { if ((change.Type & ChangeType.Palette) == ChangeType.Palette) { window().setTitle(NSString.Create(m_document.Palette.Name)); } if ((change.Type & ChangeType.PaletteExponent) == ChangeType.PaletteExponent) { m_exponent.setFloatValue(m_document.PaletteExponent); } } else { m_exponent.setFloatValue(0.0f); window().setTitle(NSString.Create("Palette")); } }
public override void SelectionDidChange (NSNotification notification) { Console.WriteLine (notification); var table = notification.Object as NSTableView; var row = table.SelectedRow; // Anything to process if (row < 0) return; // Get current values from the data source var name = table.DataSource.GetObjectValue (table, new NSTableColumn("name"), row) + ""; var id = table.DataSource.GetObjectValue (table, new NSTableColumn("id"), row) + ""; // Confirm deletion of a todo item var alert = new NSAlert () { AlertStyle = NSAlertStyle.Critical, InformativeText = "Do you want to delete row " + name + "?", MessageText = "Delete Todo", }; alert.AddButton ("Cancel"); alert.AddButton ("Delete"); alert.BeginSheetForResponse (windowController.Window, async (result) => { Console.WriteLine ("Alert Result: {0}", result); if (result == 1001) { await windowController.Delete(id); } table.DeselectAll(this); }); }
private void HandleKeyboardAppearing(NSNotification notification, bool movedDown) { if (movedDown) { float offset = _lastOffset*-1; MoveView(notification, offset); _lastOffset = 0; } else if (_lastOffset == 0) { var frame = (NSValue) notification.UserInfo.ObjectForKey(UIKeyboard.FrameEndUserInfoKey); float offset = frame.RectangleFValue.Height; float screenHeight = UIScreen.MainScreen.Bounds.Height; float position = GetPositionToMove(); if (position > screenHeight - offset) { offset = offset + position - screenHeight; MoveView(notification, offset); _lastOffset = offset; } else { _lastOffset = 0; } } }
private void OnKeyboardNotification (NSNotification notification) { var keyboardFrame = UIKeyboard.FrameEndFromNotification (notification); var inset = new UIEdgeInsets(0, 0, keyboardFrame.Height, 0); TableView.ContentInset = inset; TableView.ScrollIndicatorInsets = inset; }
/// <summary> /// Sets which field is currently being edited /// </summary> /// <param name="notification">Notification.</param> private void FieldIsEditing(NSNotification notification) { _activeField = (UIView)notification.Object; }
public override void DidFinishLaunching(NSNotification notification) { mainWindowController = new MainWindowController(); mainWindowController.Window.MakeKeyAndOrderFront(this); }
public override void WillTerminate(NSNotification notification) { // Insert code here to tear down your application }
public override void DidFinishLaunching(NSNotification notification) { // Insert code here to initialize your application }
private void DidVideoFinishPlaying(NSNotification obj) { Completed?.Invoke(this, null); _timer.Stop(); }
public override void DidFinishLaunching(NSNotification notification) { // Disable automatice item enabling on the Edit menu EditMenu.AutoEnablesItems = false; EditMenu.Delegate = new EditMenuDelegate(); }
/// <summary> /// Nulls out the current edited field. /// </summary> /// <param name="notification">Notification.</param> private void FieldStoppedEditing(NSNotification notification) { _activeField = null; }
public override void WillTerminate(NSNotification notification) { // Insert code here to tear down your application // Clear caches System.IO.Directory.Delete(containerDirectory, true); }
private void ApplicationDidBecomeActive(NSNotification notification) { StartArchitectViewRendering(); }
public void WindowWillClose(NSNotification notification) { NSApplication.SharedApplication.StopModalWithCode(0); }
public override void DidFinishLaunching(NSNotification notification) { Forms.Init(); LoadApplication(new MyCircle.App()); base.DidFinishLaunching(notification); }
private void KeyBoardWillHide(NSNotification notification) { //bool wasViewMoved = !isMoveRequired; //if (isMoveRequired) { ScrollTheView(wasViewMoved); } ScrollTheView(false); }
private void OnLeavingBackground(NSNotification notification) { RaiseResuming(); RaiseLeavingBackground(() => Windows.UI.Xaml.Window.Current?.OnVisibilityChanged(true)); }
private void ApplicationWillResignActive(NSNotification notification) { StopArchitectViewRendering(); }
private static void PasteboardChanged(NSNotification notification) => OnContentChanged();
private void OnDeactivated(NSNotification notification) { Windows.UI.Xaml.Window.Current?.OnActivated(CoreWindowActivationState.Deactivated); }
/// <summary> /// Will terminate. /// </summary> /// <param name="notification">Notification.</param> public override void WillTerminate(NSNotification notification) { // Insert code here to tear down your application Preferences.StopUsingDefaultPreferences(); }
private void OnEnteredBackground(NSNotification notification) { Windows.UI.Xaml.Window.Current?.OnVisibilityChanged(false); RaiseEnteredBackground(() => RaiseSuspending()); }
void handleTextDidChange(NSNotification obj) { SendButton.Enabled = EmailTF.StringValue.Length > 0?true:false; }
void SubjectAreaDidChange(NSNotification notification) { var devicePoint = new CGPoint(0.5, 0.5); UpdateDeviceFocus(AVCaptureFocusMode.ContinuousAutoFocus, AVCaptureExposureMode.ContinuousAutoExposure, devicePoint, false); }
public void ReloadAll(NSNotification notification) { Servernode.Initialise(); NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadOutlineView", this); NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadTableView", this); }
private void DidBecomeActive(NSNotification notification) { ((App)Xamarin.Forms.Application.Current).SecondOnResume(); }
public void ReloadOutlineView(NSNotification notification) { splitViewController.MainOutlineView.ReloadData(); }
void HandleTreeSelectionDidChange(NSNotification notif) { ApplicationContext.InvokeUserCode(delegate { EventSink.OnSelectionChanged(); }); }
private void ReachabilityDidChange(NSNotification notification) { this.UpdateReachabilityColor(); }
public void ReloadTableView(NSNotification notification) { splitViewController.MainTableView.ReloadData(); }
public void Post(NSNotification s) { notify(s); s.Dispose(); }
protected override void KeyBoardUpNotification(NSNotification notification) { tagsTableView.ContentInset = new UIEdgeInsets(0, 0, UIKeyboard.FrameEndFromNotification(notification).Height, 0); base.KeyBoardUpNotification(notification); }
private void HandleReshape(NSNotification note) { UpdateView(); }
private void ActivationDidComplete(NSNotification notification) { this.UpdateReachabilityColor(); }