/******************************* SEGUE *******************************/ public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender) { base.PrepareForSegue (segue, sender); if (segue.Identifier == "registerSegue") { var navCon = segue.DestinationViewController as UINavigationController; if (navCon != null) { RegisterTableViewController regTVC = navCon.TopViewController as RegisterTableViewController; if (regTVC != null) { regTVC.studentID = usernameBox.Text; regTVC.loginVC = this; } } } else if (segue.Identifier == "loginSegue"){ var splitVC = segue.DestinationViewController as UISplitViewController; if (splitVC != null) { var navVC = splitVC.ViewControllers[0] as UINavigationController; if (navVC != null) { var menuTVC = navVC.TopViewController as MenuTableViewController; menuTVC.Student = student; menuTVC.LoginVC = this; } var navVC2 = splitVC.ViewControllers[1] as UINavigationController; if (navVC2 != null) { var fbTVC = navVC2.TopViewController as FutureBookingsTableViewController; fbTVC.Student = student; } } } }
public override void Awake (NSObject context) { base.Awake (context); // Configure interface objects here. Console.WriteLine ("{0} awake with context", this); }
public void ShareUrl(object sender, Uri uri) { var item = new NSUrl(uri.AbsoluteUri); var activityItems = new NSObject[] { item }; UIActivity[] applicationActivities = null; var activityController = new UIActivityViewController (activityItems, applicationActivities); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { var window = UIApplication.SharedApplication.KeyWindow; var pop = new UIPopoverController (activityController); var barButtonItem = sender as UIBarButtonItem; if (barButtonItem != null) { pop.PresentFromBarButtonItem(barButtonItem, UIPopoverArrowDirection.Any, true); } else { var rect = new CGRect(window.RootViewController.View.Frame.Width / 2, window.RootViewController.View.Frame.Height / 2, 0, 0); pop.PresentFromRect (rect, window.RootViewController.View, UIPopoverArrowDirection.Any, true); } } else { var viewController = UIApplication.SharedApplication.KeyWindow.RootViewController; viewController.PresentViewController(activityController, true, null); } }
partial void earnButtonClicked(NSObject sender) { decimal amt = 0; try { amt = Convert.ToDecimal(this.amount.Text); } catch { amt = 0; } var subscription = Observable.Start( () => { var cmd = this.context.NewCommandExecutor<MinionAggregate>(); cmd.Execute(new EarnAllowanceCommand { AggregateId = this.minionId, Date = this.dateField.Date, Amount = amt, Description = this.description.Text }); }).Subscribe(); this.DismissModalViewControllerAnimated(true); }
const int buttonSpace = 45; //24; public SessionCell (UITableViewCellStyle style, NSString ident, Session showSession, string big, string small) : base (style, ident) { SelectionStyle = UITableViewCellSelectionStyle.Blue; titleLabel = new UILabel () { TextAlignment = UITextAlignment.Left, BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f) }; speakerLabel = new UILabel () { TextAlignment = UITextAlignment.Left, Font = smallFont, TextColor = UIColor.DarkGray, BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f) }; locationImageView = new UIImageView(); locationImageView.Image = building; button = UIButton.FromType (UIButtonType.Custom); button.TouchDown += delegate { UpdateImage (ToggleFavorite ()); if (AppDelegate.IsPad) { NSObject o = new NSObject(); NSDictionary progInfo = NSDictionary.FromObjectAndKey(o, new NSString("FavUpdate")); NSNotificationCenter.DefaultCenter.PostNotificationName( "NotificationFavoriteUpdated", o, progInfo); } }; UpdateCell (showSession, big, small); ContentView.Add (titleLabel); ContentView.Add (speakerLabel); ContentView.Add (button); ContentView.Add (locationImageView); }
public CalloutView (string text, PointF pt, NSObject target, Selector sel) : base(_initframe) { SetAnchorPoint (pt); Initialize (); Text = text; AddButtonTarget (target, sel); }
partial void GetPosition (NSObject sender) { Setup(); this.cancelSource = new CancellationTokenSource(); PositionStatus.Text = String.Empty; PositionLatitude.Text = String.Empty; PositionLongitude.Text = String.Empty; this.geolocator.GetPositionAsync (timeout: 10000, cancelToken: this.cancelSource.Token, includeHeading: true) .ContinueWith (t => { if (t.IsFaulted) PositionStatus.Text = ((GeolocationException)t.Exception.InnerException).Error.ToString(); else if (t.IsCanceled) PositionStatus.Text = "Canceled"; else { PositionStatus.Text = t.Result.Timestamp.ToString("G"); PositionLatitude.Text = "La: " + t.Result.Latitude.ToString("N4"); PositionLongitude.Text = "Lo: " + t.Result.Longitude.ToString("N4"); } }, scheduler); }
public static NSDictionary ToDictionary(this DropboxRace race) { var keys = new NSString[] { new NSString("Code"), new NSString("FullName"), new NSString("RaceDate"), new NSString("BoatsUpdated"), new NSString("DetailsUpdated"), new NSString("DatastoreID"), new NSString("IntermediateLocations"), }; NSDate d1 = DateTime.SpecifyKind(race.Date, DateTimeKind.Utc); NSDate d2 = DateTime.SpecifyKind(race.BoatsUpdated, DateTimeKind.Utc); NSDate d3 = DateTime.SpecifyKind(race.DetailsUpdated, DateTimeKind.Utc); var values = new NSObject[] { new NSString(race.Code), new NSString(race.Name), d1, d2, d3, new NSString(race.DataStoreID), new NSString(race .Locations .Select(l => l.Name) .Aggregate((h,t) => string.Format("{0},{1}", h,t))) }; return NSDictionary.FromObjectsAndKeys (values, keys); }
public IntelligentSplitViewController () { ObserverWillRotate = NSNotificationCenter.DefaultCenter.AddObserver( AppDelegate.NotificationWillChangeStatusBarOrientation, OnWillRotate); ObserverDidRotate = NSNotificationCenter.DefaultCenter.AddObserver( AppDelegate.NotificationDidChangeStatusBarOrientation, OnDidRotate); }
public override void ViewWillAppear (bool animated) { base.ViewWillAppear (animated); obs1 = NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.WillShowNotification, delegate (NSNotification n){ var kbdRect = UIKeyboard.BoundsFromNotification (n); var duration = UIKeyboard.AnimationDurationFromNotification (n); var frame = View.Frame; frame.Height -= kbdRect.Height; UIView.BeginAnimations ("ResizeForKeyboard"); UIView.SetAnimationDuration (duration); View.Frame = frame; UIView.CommitAnimations (); }); obs2 = NSNotificationCenter.DefaultCenter.AddObserver ("UIKeyboardWillHideNotification", delegate (NSNotification n){ var kbdRect = UIKeyboard.BoundsFromNotification (n); var duration = UIKeyboard.AnimationDurationFromNotification (n); var frame = View.Frame; frame.Height += kbdRect.Height; UIView.BeginAnimations ("ResizeForKeyboard"); UIView.SetAnimationDuration (duration); View.Frame = frame; UIView.CommitAnimations (); }); }
public override void ViewDidLoad () { if (motionActivityQueries == null) motionActivityQueries = new List<MotionActivityQuery> (); observer = NSNotificationCenter.DefaultCenter.AddObserver (UIApplication.WillEnterForegroundNotification, async (notification) => { await refreshDays (); }); }
UIButton detailButton; // need class-level ref to avoid GC /// <summary> /// This is very much like the GetCell method on the table delegate /// </summary> public override MKAnnotationView GetViewForAnnotation (MKMapView mapView, NSObject annotation) { // try and dequeue the annotation view MKAnnotationView annotationView = mapView.DequeueReusableAnnotation(annotationIdentifier); // if we couldn't dequeue one, create a new one if (annotationView == null) annotationView = new MKPinAnnotationView(annotation, annotationIdentifier); else // if we did dequeue one for reuse, assign the annotation to it annotationView.Annotation = annotation; // configure our annotation view properties annotationView.CanShowCallout = true; (annotationView as MKPinAnnotationView).AnimatesDrop = true; (annotationView as MKPinAnnotationView).PinColor = MKPinAnnotationColor.Green; annotationView.Selected = true; // you can add an accessory view, in this case, we'll add a button on the right, and an image on the left detailButton = UIButton.FromType(UIButtonType.DetailDisclosure); detailButton.TouchUpInside += (s, e) => { var c = (annotation as MKAnnotation).Coordinate; new UIAlertView("Annotation Clicked", "You clicked on " + c.Latitude.ToString() + ", " + c.Longitude.ToString() , null, "OK", null).Show(); }; annotationView.RightCalloutAccessoryView = detailButton; annotationView.LeftCalloutAccessoryView = new UIImageView(UIImage.FromBundle("Images/Icon/29_icon.png")); //annotationView.Image = UIImage.FromBundle("Images/Apress-29x29.png"); return annotationView; }
public override void DidUpdateBeaconRanges(NSObject[] rangedBeacons) { if (BeaconsUpdated != null) { var list = new List<BeaconStatus> (); foreach (var b in rangedBeacons) { var bStatus = new BeaconStatus (); var ndict = b as NSDictionary; foreach (var p in ndict) { if (p.Key.ToString() == "beacon_id") bStatus.Id = p.Value.ToString(); if (p.Key.ToString() == "beacon_tags") bStatus.Tags = p.Value.ToString(); if (p.Key.ToString() == "proximity_value") bStatus.ProximityValue = p.Value.ToString(); if (p.Key.ToString() == "beacon_name") bStatus.Name = p.Value.ToString(); if (p.Key.ToString() == "proximity_string") bStatus.ProximityString = p.Value.ToString(); } list.Add (bStatus); } InvokeOnMainThread(() => BeaconsUpdated (this, list)); } }
public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender) { if (!(segue.DestinationViewController is AssetGridViewController) || !(sender is UITableViewCell)) return; var assetGridViewController = (AssetGridViewController)segue.DestinationViewController; var cell = (UITableViewCell)sender; // Set the title of the AssetGridViewController. assetGridViewController.Title = cell.TextLabel.Text; // Get the PHFetchResult for the selected section. NSIndexPath indexPath = TableView.IndexPathForCell (cell); PHFetchResult fetchResult = sectionFetchResults [indexPath.Section]; if (segue.Identifier == allPhotosSegue) { assetGridViewController.AssetsFetchResults = fetchResult; } else if (segue.Identifier == collectionSegue) { // Get the PHAssetCollection for the selected row. var collection = fetchResult [indexPath.Row] as PHAssetCollection; if (collection == null) return; var assetsFetchResult = PHAsset.FetchAssets (collection, null); assetGridViewController.AssetsFetchResults = assetsFetchResult; assetGridViewController.AssetCollection = collection; } }
async partial void btnShare_Activated (UIBarButtonItem sender) { var text = viewModel.SharingMessage; var items = new NSObject[] { new NSString (text) }; var activityController = new UIActivityViewController (items, null); await PresentViewControllerAsync (activityController, true); }
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender) { base.PrepareForSegue (segue, sender); AppModel.ProviderSearchCriteria.Name=txtProviderName.Text; var controller = segue.DestinationViewController as AppModelInterface; controller.AppModel=this.AppModel; }
partial void Done (NSObject sender) { var model = _priceTileModel; if (model != null) { model.Done(); } }
public static void InitializeFramework(NSObject[] kits, CrashlyticsManager crashlyticsManager, bool enableDebugging = true) { if (kits == null) throw new ArgumentNullException("kits"); SharedSDK().Debug = enableDebugging; if (crashlyticsManager != null) { SharedSDK().CrashlyticsManager = crashlyticsManager; //only initialize Crashlytics with device builds since Xamarin.iOS //doesn't generate dSYM files for simulator builds if (Runtime.Arch == Arch.DEVICE) { Log(GetKitInitializationMessage(kits)); crashlyticsManager.EnableCrashReporting(() => Fabric.WithInternal(kits)); } else { Log("[MonoTouch.Fabric] Running on simulator: Crashlytics will not be enabled and crash reports will not be submitted", true); var otherKits = RemoveKit(kits, crashlyticsManager.SharedInstance); if (otherKits.Length > 0) { Log(GetKitInitializationMessage(otherKits)); Fabric.WithInternal(otherKits); } } } else { Log(GetKitInitializationMessage(kits)); Fabric.WithInternal(kits); } }
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender) { base.PrepareForSegue(segue, sender); var view = (AttachmentController) segue.DestinationViewController; view.SelectedMessage = CurrentMessage; }
/// <summary> /// This method is called when the application is about to terminate. Save data, if needed. /// </summary> /// <seealso cref="DidEnterBackground"/> public override void WillTerminate (UIApplication application) { if (observer != null) { NSNotificationCenter.DefaultCenter.RemoveObserver (observer); observer = null; } }
public override void ViewWillAppear (bool animated) { base.ViewWillAppear (animated); _show = UIKeyboard.Notifications.ObserveWillShow((sender, e) => { var r = UIKeyboard.FrameEndFromNotification(e.Notification); _scrollAmount = (float)r.Height; if (_isKeyboardShown) { Scroll(sender, e, true, true); } else { Scroll(sender, e, true); } this._isKeyboardShown = true; }); _hide = UIKeyboard.Notifications.ObserveWillHide((sender, e) => { if (_isKeyboardShown) { Scroll(sender, e, false); _scrollAmount = 0; _isKeyboardShown = false; } }); View.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; //page.ScrollList (); }
public override void ViewDidLoad() { base.ViewDidLoad(); _urlTextField.ShouldReturn = doReturn; _browser.Delegate = new customWebViewDelegate(this); var webDocumentView = new NSObject( Messaging.IntPtr_objc_msgSend(_browser.Handle, (new Selector("_documentView").Handle))); var webView = webDocumentView.GetNativeField("_webView"); Messaging.void_objc_msgSend_IntPtr(webView.Handle, (new Selector("setCustomUserAgent:")).Handle, (new NSString(@"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.38 Safari/532.0")).Handle); /* * * /* http://d.hatena.ne.jp/KishikawaKatsumi/20090217/1234818025 NSString *userAgent = @"Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_1 like Mac OS X; ja-jp) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5F136 Safari/525.20"; id webDocumentView; id webView; webDocumentView = objc_msgSend(myWebView, @selector(_documentView)); object_getInstanceVariable(webDocumentView, "_webView", (void**)&webView); objc_msgSend(webView, @selector(setCustomUserAgent:), userAgent); */ loadURL(_startURL); }
public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender) { base.PrepareForSegue (segue, sender); if (segue.Identifier == "showDetail") PrepareForSegue ((DetailViewController)segue.DestinationViewController); }
public void PlayVideo(Movie movie) { if (_player == null) { _player = new MPMoviePlayerController(); //_player.ControlStyle = MPMovieControlStyle.Fullscreen; _player.SourceType = MPMovieSourceType.Streaming; _player.Fullscreen = true; var center = NSNotificationCenter.DefaultCenter; _preloadObserver = center.AddObserver(NOTIFICATION_PRELOAD_FINISH, (notify)=>{ _player.Play(); notify.Dispose(); }); _playbackObserver = center.AddObserver(NOTIFICATION_PLAYBLACK_FINISH, (notify)=>{ notify.Dispose(); }); var f = this.View.Frame; _player.View.Frame = new Rectangle(0,0,(int)f.Width,(int)f.Height); this.Add(_player.View); } var url = NSUrl.FromString(movie.Url); _player.ContentUrl = url; _player.Play(); }
async partial void OnPress (NSObject sender) { HandlerType = null; TheButton.Enabled = false; switch (TheTable.SelectedRow) { case 0: new DotNet (this).HttpSample (); break; case 1: new DotNet (this).HttpSecureSample (); break; case 2: new Cocoa (this).HttpSample (); break; case 3: await new NetHttp (this).HttpSample (false); break; case 4: await new NetHttp (this).HttpSample (true); break; case 5: RunTls12Request (); break; } }
partial void ShowSecureEntry (NSObject sender) { var alertController = UIAlertController.Create (title, message, UIAlertControllerStyle.Alert); alertController.AddTextField (textField => { textField.Placeholder = "Password"; textField.SecureTextEntry = true; textField.InputAccessoryView = new CustomInputAccessoryView ("Enter at least 5 characters"); textField.EditingChanged += HandleTextFieldTextDidChangeNotification; }); var acceptAction = UIAlertAction.Create (acceptButtonTitle, UIAlertActionStyle.Default, _ => Console.WriteLine ("The \"Secure Text Entry\" alert's other action occured.") ); var cancelAction = UIAlertAction.Create (cancelButtonTitle, UIAlertActionStyle.Cancel, _ => Console.WriteLine ("The \"Text Entry\" alert's cancel action occured.") ); acceptAction.Enabled = false; secureTextAlertAction = acceptAction; // Add the actions. alertController.AddAction (acceptAction); alertController.AddAction (cancelAction); PresentViewController (alertController, true, null); }
partial void ShowSimpleForm (NSObject sender) { var alertController = UIAlertController.Create (title, message, UIAlertControllerStyle.Alert); alertController.AddTextField (textField => { textField.Placeholder = "Name"; textField.InputAccessoryView = new CustomInputAccessoryView ("Enter your name"); }); alertController.AddTextField (textField => { textField.KeyboardType = UIKeyboardType.EmailAddress; textField.Placeholder = "*****@*****.**"; textField.InputAccessoryView = new CustomInputAccessoryView ("Enter your email address"); }); var acceptAction = UIAlertAction.Create (acceptButtonTitle, UIAlertActionStyle.Default, _ => { Console.WriteLine ("The \"Text Entry\" alert's other action occured."); string enteredText = alertController.TextFields?.First ()?.Text; if (string.IsNullOrEmpty (enteredText)) Console.WriteLine ("The text entered into the \"Text Entry\" alert's text field was \"{0}\"", enteredText); }); var cancelAction = UIAlertAction.Create (cancelButtonTitle, UIAlertActionStyle.Cancel, _ => Console.WriteLine ("The \"Text Entry\" alert's cancel action occured.") ); // Add the actions. alertController.AddAction (acceptAction); alertController.AddAction (cancelAction); PresentViewController (alertController, true, null); }
partial void btnGrayscaleClicked(NSObject sender) { UIImage imageOriginal = UIImage.FromFile( @"Images/sample.png" ); UIImage imageSource = UIImage.FromImage( imageOriginal.CGImage ); Stopwatch watch = new Stopwatch(); watch.Start(); UIImage imageProcessed = ConvertToGrayScale( imageSource ); watch.Stop(); long tick = watch.ElapsedTicks; long milliSeconds = watch.ElapsedMilliseconds; watch.Reset(); imageViewDiplay.Image = imageProcessed; string message = string.Format(@"tick:{0};duration:{1}", tick, milliSeconds); lbTime.Text = message; }
public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender) { base.PrepareForSegue (segue, sender); var nxtVC = segue.DestinationViewController as SecondViewController; nxtVC.Data = "Hello from Root View"; }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); observerShowKeyboard = UIKeyboard.Notifications.ObserveWillShow((sender, args) => { var page = Element as ContentPage; if (page != null && !(page.Content is ScrollView)) { var padding = page.Padding; page.Padding = new Thickness(padding.Left, padding.Top, padding.Right, args.FrameBegin.Height); } }); observerHideKeyboard = UIKeyboard.Notifications.ObserveWillHide((sender, args) => { var page = Element as ContentPage; if (page != null && !(page.Content is ScrollView)) { var padding = page.Padding; page.Padding = new Thickness(padding.Left, padding.Top, padding.Right, 0); } }); }
public override void DecidePolicyForNavigation (WebView web_view, NSDictionary action_info, NSUrlRequest request, WebFrame frame, NSObject decision_token) { LinkClicked (request.Url.ToString ()); }
public override void SetObjectValue(NSTableView tableView, NSObject theObject, NSTableColumn tableColumn, nint row) { }
public ICrashlytics SetStringValue(string key, string value) { Bindings.CrashlyticsKit.Crashlytics.SharedInstance.SetObjectValue(NSObject.FromObject(value), key); return(this); }
public static async Task Fetch() { AppData.invitationsLST = new List <ChatListClass>(); if (AppData.auth.CurrentUser == null) { return; } bool done = false; foreach (InvitationClass anyCoord in AppData.invitationsData) { string chatName = anyCoord.ChatName; string ownerUid = anyCoord.ChatOwner.Uid; AppData.DataNode.GetChild(ownerUid).GetChild(chatName).ObserveSingleEvent(DataEventType.Value, (snapshot) => { var thisChatAllData = snapshot.GetValue <NSDictionary>(); List <MessageClass> itemsInChat = new List <MessageClass>(); if (thisChatAllData.ValueForKey((NSString)"items") != null) { if ((thisChatAllData.ValueForKey((NSString)"items")).IsKindOfClass(new ObjCRuntime.Class(typeof(NSDictionary)))) { NSDictionary itemsOfChatVals = (NSDictionary)NSObject.FromObject(thisChatAllData.ValueForKey((NSString)"items")); for (int i = 0; i < (int)itemsOfChatVals.Values.Length; i++) { NSDictionary eachItemVals = (NSDictionary)NSObject.FromObject(itemsOfChatVals.Values[i]); var fetchedItemName = (NSString)eachItemVals.ValueForKey((NSString)"itemName"); var fetchedItemCategory = (NSString)eachItemVals.ValueForKey((NSString)"itemCategory"); var fetchedItemTime = (NSString)eachItemVals.ValueForKey((NSString)"itemTime"); itemsInChat.Add(new MessageClass { ItemName = fetchedItemName, ItemTime = DateTime.Parse(fetchedItemTime) }); } } } ChatListClass thisChat = new ChatListClass { ChatName = chatName, ChatOwner = anyCoord.ChatOwner, ChatItems = itemsInChat }; AppData.invitationsLST.Add(thisChat); done = true; }); } while (!done) { await Task.Delay(50); } }
public override bool OpenUrl (UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { // Functionality to test preview containers of Google Tag Manager Analytics.HandleOpenUrl (url); return true; }
partial void DoneClicked(NSObject sender) { }
protected ReactiveWindowController(string windowNibName, NSObject owner) : base(windowNibName, owner) { setupRxObj(); }
public override void PerformClose (NSObject sender) { base.OrderOut (this); return; }
public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { return(ApplicationDelegate.SharedInstance.OpenUrl(application, url, sourceApplication, annotation)); }
public override bool WindowShouldClose (NSObject sender) { (sender as EventLog).Controller.WindowClosed (); return false; }
extern static void NSShowAnimationEffect(nuint animationEffect, CGPoint centerLocation, CGSize size, NSObject animationDelegate, Selector didEndSelector, IntPtr contextInfo);
public virtual bool RemoveData(NSObject data) { return(false); }
public override void SetObjectValue(object dataItem, NSObject value) { }
public static void ShowAnimationEffect(NSAnimationEffect animationEffect, CGPoint centerLocation, CGSize size, NSObject animationDelegate, Selector didEndSelector, IntPtr contextInfo) { NSShowAnimationEffect((nuint)(ulong)animationEffect, centerLocation, size, animationDelegate, didEndSelector, contextInfo); }
internal static void ViewModelRequestForSegue(this IMvxEventSourceViewController self, NSStoryboardSegue segue, NSObject sender) { var view = self as IMvxMacViewSegue; var parameterValues = view == null ? null : view.PrepareViewModelParametersForSegue(segue, sender); if (parameterValues is IMvxBundle) { self.ViewModelRequestForSegueImpl(segue, (IMvxBundle)parameterValues); } else if (parameterValues is IDictionary <string, string> ) { self.ViewModelRequestForSegueImpl(segue, (IDictionary <string, string>)parameterValues); } else { self.ViewModelRequestForSegueImpl(segue, parameterValues); } }
partial void Stop(NSObject sender) { AppDelegate.Instance.MainWindowController.Stop(); }
// Handle Custom Url Schemes for iOS 8 or older public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { Console.WriteLine($"OpenUrl Link {url.AbsoluteString}"); var dynamicLink = DynamicLinks.SharedInstance?.FromCustomSchemeUrl(url); if (dynamicLink == null) { return(false); } var link = dynamicLink.Url?.AbsoluteString.Split(new string[] { Constants.FirebaseDeepLinkUrl }, StringSplitOptions.None).LastOrDefault(); if (!string.IsNullOrWhiteSpace(link)) { var welcomeString = link.Split(new char[] { '&' }).FirstOrDefault(); Xamarin.Forms.MessagingCenter.Send(Xamarin.Forms.Application.Current, Constants.Welcome, welcomeString); } return(true); }
void HandleItemActivated(NSObject sender) { Cell.MenuItem = (NSMenuItem)sender; }
partial void CloseButtonClicked(NSObject sender) { this.View.RemoveFromSuperview(); }
public static void AddBundleURLType(IIgorModule ModuleInst, string PlistPath, string NewURLScheme) { if (IgorAssert.EnsureTrue(ModuleInst, File.Exists(PlistPath), "Plist " + PlistPath + " doesn't exist!")) { FileInfo PlistFileInfo = new FileInfo(PlistPath); NSObject PlistRoot = PropertyListParser.Parse(PlistFileInfo); if (IgorAssert.EnsureTrue(ModuleInst, PlistRoot != null, "Plist " + PlistPath + " could not be parsed!")) { if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSDictionary).IsAssignableFrom(PlistRoot.GetType()), "Plist " + PlistPath + " root object is not a dictionary.")) { NSDictionary RootDictionary = (NSDictionary)PlistRoot; if (IgorAssert.EnsureTrue(ModuleInst, RootDictionary != null, "Plist root is not a dictionary.")) { NSSet BundleURLTypes = null; if (RootDictionary.ContainsKey("CFBundleURLTypes")) { NSObject BundleURLTypesObj = RootDictionary.Get("CFBundleURLTypes"); if (IgorAssert.EnsureTrue(ModuleInst, BundleURLTypesObj != null, "CFBundleURLTypes wasn't found in the root dictionary even though the key exists.")) { if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSArray).IsAssignableFrom(BundleURLTypesObj.GetType()), "CFBundleURLTypes isn't an NSArray.")) { BundleURLTypes = new NSSet(((NSArray)BundleURLTypesObj).GetArray()); } } } if (BundleURLTypes == null) { BundleURLTypes = new NSSet(); } bool bAlreadyExists = false; foreach (NSObject CurrentURLType in BundleURLTypes) { if (bAlreadyExists) { break; } if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSDictionary).IsAssignableFrom(CurrentURLType.GetType()), "One of the CFBundleURLTypes isn't an NSDictionary.")) { NSDictionary CurrentURLTypeDict = (NSDictionary)CurrentURLType; if (IgorAssert.EnsureTrue(ModuleInst, CurrentURLTypeDict != null, "One of the CFBundleURLTypes didn't cast to NSDictionary correctly.")) { if (CurrentURLTypeDict.ContainsKey("CFBundleURLSchemes")) { NSObject CurrentURLSchemesArrayObj = CurrentURLTypeDict.Get("CFBundleURLSchemes"); if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSArray).IsAssignableFrom(CurrentURLSchemesArrayObj.GetType()), "A CFBundleURLSchemes key exists for a given CFBundleURLType, but it's not an NSArray type.")) { NSArray CurrentURLSchemesArray = (NSArray)CurrentURLSchemesArrayObj; if (IgorAssert.EnsureTrue(ModuleInst, CurrentURLSchemesArray != null, "The CFBundleURLSchemes object didn't cast to NSDictionary correctly.")) { NSSet CurrentURLSchemesSet = new NSSet(CurrentURLSchemesArray.GetArray()); foreach (NSObject CurrentURLSchemeObj in CurrentURLSchemesSet) { if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSString).IsAssignableFrom(CurrentURLSchemeObj.GetType()), "One of the CFBundleURLSchemes is not an NSString.")) { NSString CurrentURLScheme = (NSString)CurrentURLSchemeObj; if (IgorAssert.EnsureTrue(ModuleInst, CurrentURLScheme != null, "A CFBundleURLScheme entry didn't cast to NSString correctly.")) { if (CurrentURLScheme.GetContent() == NewURLScheme) { bAlreadyExists = true; IgorDebug.Log(ModuleInst, "URL scheme " + NewURLScheme + " is already in " + PlistPath); break; } } } } } } } } } } if (!bAlreadyExists) { NSString NewSchemeString = new NSString(NewURLScheme); NSArray NewSchemeArray = new NSArray(1); NewSchemeArray.SetValue(0, NewSchemeString); NSDictionary NewTypeDictionary = new NSDictionary(); NewTypeDictionary.Add("CFBundleURLSchemes", NewSchemeArray); BundleURLTypes.AddObject(NewTypeDictionary); NSArray BundleURLTypesArray = new NSArray(BundleURLTypes.AllObjects()); if (RootDictionary.ContainsKey("CFBundleURLTypes")) { RootDictionary["CFBundleURLTypes"] = BundleURLTypesArray; IgorDebug.Log(ModuleInst, "Updated CFBundleURLTypes to add " + NewURLScheme + "."); } else { RootDictionary.Add("CFBundleURLTypes", BundleURLTypesArray); IgorDebug.Log(ModuleInst, "Added CFBundleURLTypes to add " + NewURLScheme + "."); } IgorRuntimeUtils.DeleteFile(PlistPath); PropertyListParser.SaveAsXml(RootDictionary, PlistFileInfo); } } } } } }
private UAPush() { appBecomesActiveObs = NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidBecomeActiveNotification, ApplicationDidBecomeActive); appSentToBackgroundObs = NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidEnterBackgroundNotification, ApplicationSentToBackground); }
public void toggleFullScreen(NSObject sender) { controller.toggleFullScreen(sender); }
public static void Initialize(ApplicationOptions options) { #if iOS AVAudioSession.SharedInstance().Init(); interruptionNotification = AVAudioSession.Notifications.ObserveInterruption((sender, args) => { if (args.InterruptionType == AVAudioSessionInterruptionType.Began) { AVAudioSession.SharedInstance().SetActive(false); // OpenALMob can not continue after session interruption, so destroy context here. if (context != null) { foreach (var c in channels) { c.DisposeOpenALResources(); } context.Dispose(); context = null; } Active = false; } else if (args.InterruptionType == AVAudioSessionInterruptionType.Ended) { // Do not restore the audio session here, because incoming call screen is still visible. Defer it until the first update. audioSessionInterruptionEnded = true; } }); context = new AudioContext(); #elif ANDROID // LoadLibrary() ivokes JNI_OnLoad() Java.Lang.JavaSystem.LoadLibrary(Lib); // Some devices can throw AudioContextException : The audio context could not be created with the specified parameters // while AudioContext initializing. Try initialize context multiple times to avoid it. for (int i = 0; i < 3; i++) { try { context = new AudioContext(); Logger.Write($"AudioContext initialized successfully"); break; } catch (System.Exception e) { Logger.Write($"Initialize AudioContext error: {e.Message}"); } } #else bool isDeviceAvailable = !String.IsNullOrEmpty(AudioContext.DefaultDevice); if (isDeviceAvailable && !CommandLineArgs.NoAudio) { context = new AudioContext(); } #endif var err = AL.GetError(); if (err == ALError.NoError) { for (int i = 0; i < options.NumChannels; i++) { channels.Add(new AudioChannel(i)); } } if (options.DecodeAudioInSeparateThread) { streamingThread = new Thread(RunStreamingLoop); streamingThread.IsBackground = true; streamingThread.Start(); } }
public override void PrepareForSegue(NSStoryboardSegue segue, NSObject sender) { base.PrepareForSegue(segue, sender); this.ViewModelRequestForSegue(segue, sender); }
protected override void Dispose(NSObject obj, Type type) { switch (type.FullName) { // FIXME: those crash the application when Dispose is called case "MonoMac.AppKit.NSTextInputContext": case "AppKit.NSTextInputContext": if (Mac.CheckSystemVersion(10, 13)) { goto case "MonoMac.ImageKit.IKScannerDeviceView"; // fallthrough } goto default; case "MonoMac.JavaScriptCore.JSManagedValue": case "JavaScriptCore.JSManagedValue": // JSManagedValue crashes in Yosemite (b7), but not Mavericks. if (!Mac.CheckSystemVersion(10, 10)) { goto default; } goto case "MonoMac.ImageKit.IKScannerDeviceView"; // fallthrough case "MonoMac.ImageKit.IKScannerDeviceView": // 19835 case "ImageKit.IKScannerDeviceView": case "MonoMac.AppKit.NSFontPanel": // *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x11491cc00 of class NSButton was deallocated while key value observers were still registered with it. case "AppKit.NSFontPanel": case "MonoMac.AVFoundation.AVAudioRecorder": // same on iOS case "AVFoundation.AVAudioRecorder": case "MonoMac.Foundation.NSUrlConnection": case "Foundation.NSUrlConnection": // 10.8: case "MonoMac.Accounts.ACAccount": // maybe the default .ctor is not allowed ? case "Accounts.ACAccount": case "MonoMac.Accounts.ACAccountCredential": case "Accounts.ACAccountCredential": case "MonoMac.Accounts.ACAccountStore": case "Accounts.ACAccountStore": case "MonoMac.Accounts.ACAccountType": case "Accounts.ACAccountType": case "MonoMac.CoreData.NSPersistentStoreCoordinator": case "CoreData.NSPersistentStoreCoordinator": case "AppKit.NSColorPanel": case "MonoMac.AppKit.NSColorPanel": case "Foundation.NSFileProviderService": case "MonoMac.Foundation.NSFileProviderService": do_not_dispose.Add(obj); break; // 10.11 case "MonoMac.CoreImage.CIImageAccumulator": case "CoreImage.CIImageAccumulator": case "WebKit.WKNavigation": // crashes on El Capitan (b2) but not before if (!Mac.CheckSystemVersion(10, 11)) { goto default; } do_not_dispose.Add(obj); break; case "CoreLocation.CLBeacon": do_not_dispose.Add(obj); break; default: base.Dispose(obj, type); break; } }
public void TheAction(NSObject sender) { block(sender); }
public override void FinishedLaunching(UIApplication application) { Settings.LoadDefaultValues(); observer = NSNotificationCenter.DefaultCenter.AddObserver((NSString)"NSUserDefaultsDidChangeNotification", DefaultsChanged); DefaultsChanged(null); }
partial void VerificationAction(NSObject sender) { ChooseVerify().Forget(); }
public override void OrderOut(NSObject sender) { base.OrderOut(sender); (this.WindowController as VideoPlaybackWindowController).OnOrderOut(); }
public override bool WindowShouldClose(NSObject sender) { (sender as SparkleAbout).Controller.WindowClosed(); return(false); }