// Save the data in Firebase Database.
        void SaveNote()
        {
            ReplaceImagesWithinTextWithImagesIds();

            // Create data to be saved in FIrebase Database.
            var title        = txtTitle.Text.Trim();
            var content      = TxtContent.Text;
            var lastModified = AppDelegate.GetUtcTimestamp();
            var created      = Note.CreatedUnformatted ?? lastModified.ToString();

            title   = string.IsNullOrWhiteSpace(title) ? null : title;
            content = string.IsNullOrWhiteSpace(content) ? null : content;

            var imagesInfo = new NSMutableDictionary();

            foreach (var imageInfo in Note.ImagesInfo)
            {
                var location = NSNumber.FromNInt(imageInfo.Location);
                imagesInfo [imageInfo.Id] = NSDictionary.FromObjectAndKey(location, new NSString("location"));
            }

            object [] keys   = { "content", "created", "lastModified", "negativeLastModified", "title", "imagesInfo" };
            object [] values = { content, double.Parse(created), lastModified, -lastModified, title, imagesInfo };
            var       data   = NSDictionary.FromObjectsAndKeys(values, keys, keys.Length);

            // Save data in note node.
            noteNode.SetValue(data);
            // Increment notes count in folder.
            notesCountNode.SetValue(NSNumber.FromNUInt(NotesCount));
        }
예제 #2
0
        private void TxtPath()
        {
            var          path  = ChartTool.GetStringPath("Object To evaluate.x");
            CAShapeLayer layer = new CAShapeLayer();

            layer.Frame       = new CGRect(new CGPoint(20, 20), path.CGPath.PathBoundingBox.Size);
            layer.Path        = path.CGPath;
            layer.StrokeColor = UIColor.Red.CGColor;
            layer.FillColor   = UIColor.Clear.CGColor;
            //layer.BackgroundColor = UIColor.White.CGColor;
            layer.GeometryFlipped = true;
            layer.LineWidth       = 2;
            Context.Layer.AddSublayer(layer);



            CABasicAnimation animation = CABasicAnimation.FromKeyPath("strokeEnd");

            animation.From = NSNumber.FromNInt(0);
            animation.To   = NSNumber.FromInt16(1);
            animation.RemovedOnCompletion = false;
            animation.FillMode            = CAFillMode.Forwards;
            animation.Duration            = 4;
            layer.AddAnimation(animation, "ma");
        }
예제 #3
0
        public override void LayoutSublayers()
        {
            Frame           = View.Bounds;
            LineWidth       = 1;
            FillColor       = UIColor.Clear.CGColor;
            LineJoin        = JoinRound;
            LineDashPattern = new [] { NSNumber.FromNInt(2), NSNumber.FromNInt(5), NSNumber.FromNInt(5) };

            var path = UIBezierPath.FromRoundedRect(Bounds, 0);

            Path = path.CGPath;

            if (AnimationForKey("linePhase") != null)
            {
                RemoveAnimation("linePhase");
            }
            else
            {
                var animation = CABasicAnimation.FromKeyPath("lineDashPhase");
                animation.SetFrom(new NSNumber(300));
                animation.SetTo(new NSNumber(0));
                animation.Duration    = 10f;
                animation.RepeatCount = 10000;
                AddAnimation(animation, "linePhase");
            }
            ShadowOpacity = 0.8f;
            ShadowOffset  = new CoreGraphics.CGSize(3, 3);
            base.LayoutSublayers();
        }
예제 #4
0
        void ButtonClicked()
        {
            var vc = new FlutterViewController(AppDelegate.FlutterEngine, null, null);

            PresentViewController(vc, true, null);

            var channel = FlutterMethodChannel.MethodChannelWithName("diversido.io/main", vc.BinaryMessenger);

            channel.InvokeMethod("reset", NSNumber.FromNInt(11));

            channel.SetMethodCallHandler((FlutterMethodCall call, FlutterResult result) =>
            {
                if (call.Method == "increment")
                {
                    var counter = (int)(NSNumber)call.Arguments;

                    try
                    {
                        result((NSNumber)(counter + 1));
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine(e);
                    }
                }
            });
        }
예제 #5
0
        public void ObjectUsageTest()
        {
            var diff = new NSDiffableDataSourceSnapshot <NSNumber, NSUuid> ();

            diff.AppendSections(new NSNumber [] { NSNumber.FromNInt(1) });
            diff.AppendItems(new NSUuid [] { new NSUuid() }, NSNumber.FromNInt(1));
            Assert.That(diff.NumberOfSections, Is.GreaterThan((nint)0), "Sections");
            Assert.That(diff.GetNumberOfItems(NSNumber.FromNInt(1)), Is.GreaterThan((nint)0), "Items");
        }
예제 #6
0
            public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, nint row)
            {
                var col  = tableColumn as TableColumn;
                var cell = tableView.MakeView(tableColumn.Identifier, this) as CompositeCell;

                if (cell == null)
                {
                    cell = col.CreateNewView();
                }
                cell.ObjectValue = NSNumber.FromNInt(row);
                return(cell);
            }
예제 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static NSDictionary GetPhotoLibraryMetadata(NSUrl url)
        {
            NSDictionary meta  = null;
            var          image = PHAsset.FetchAssets(new NSUrl[] { url }, new PHFetchOptions()).firstObject as PHAsset;

            if (image == null)
            {
                return(null);
            }


            try
            {
                var imageManager   = PHImageManager.DefaultManager;
                var requestOptions = new PHImageRequestOptions
                {
                    Synchronous          = true,
                    NetworkAccessAllowed = true,
                    DeliveryMode         = PHImageRequestOptionsDeliveryMode.HighQualityFormat,
                };
                imageManager.RequestImageData(image, requestOptions, (data, dataUti, orientation, info) =>
                {
                    try
                    {
                        var fullimage = CIImage.FromData(data);
                        if (fullimage?.Properties != null)
                        {
                            meta = new NSMutableDictionary
                            {
                                [ImageIO.CGImageProperties.Orientation]    = NSNumber.FromNInt((int)(fullimage.Properties.Orientation ?? CIImageOrientation.TopLeft)),
                                [ImageIO.CGImageProperties.ExifDictionary] = fullimage.Properties.Exif?.Dictionary ?? new NSDictionary(),
                                [ImageIO.CGImageProperties.TIFFDictionary] = fullimage.Properties.Tiff?.Dictionary ?? new NSDictionary(),
                                [ImageIO.CGImageProperties.GPSDictionary]  = fullimage.Properties.Gps?.Dictionary ?? new NSDictionary(),
                                [ImageIO.CGImageProperties.IPTCDictionary] = fullimage.Properties.Iptc?.Dictionary ?? new NSDictionary(),
                                [ImageIO.CGImageProperties.JFIFDictionary] = fullimage.Properties.Jfif?.Dictionary ?? new NSDictionary()
                            };
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                });
            }
            catch
            {
            }

            return(meta);
        }
        public static NSDictionary <NSString, NSObject> ToOptions(this NxGeoJsonOptions nxoptions)
        {
            if (nxoptions == null)
            {
                return(null);
            }

            var options = new NSMutableDictionary <NSString, NSObject>();

            if (nxoptions.Buffer.HasValue)
            {
                options.Add(MGLShapeSourceOptions.Buffer, NSNumber.FromNInt(nxoptions.Buffer.Value));
            }
            if (nxoptions.Cluster.HasValue)
            {
                options.Add(MGLShapeSourceOptions.Clustered, NSNumber.FromBoolean(nxoptions.Cluster.Value));
            }
            if (nxoptions.ClusterMaxZoom.HasValue)
            {
                options.Add(MGLShapeSourceOptions.ClusterRadius, NSNumber.FromNInt(nxoptions.ClusterMaxZoom.Value));
            }
            if (nxoptions.ClusterRadius.HasValue)
            {
                options.Add(MGLShapeSourceOptions.ClusterRadius, NSNumber.FromNInt(nxoptions.ClusterRadius.Value));
            }
            if (nxoptions.LineMetrics.HasValue)
            {
                options.Add(MGLShapeSourceOptions.LineDistanceMetrics, NSNumber.FromBoolean(nxoptions.LineMetrics.Value));
            }
            if (nxoptions.MaxZoom.HasValue)
            {
                options.Add(MGLShapeSourceOptions.MaximumZoomLevel, NSNumber.FromNInt(nxoptions.MaxZoom.Value));
            }
            if (nxoptions.MinZoom.HasValue)
            {
                options.Add(MGLShapeSourceOptions.MinimumZoomLevel, NSNumber.FromNInt(nxoptions.MinZoom.Value));
            }
            if (nxoptions.Tolerance.HasValue)
            {
                options.Add(MGLShapeSourceOptions.SimplificationTolerance, NSNumber.FromFloat(nxoptions.Tolerance.Value));
            }
            return(new NSDictionary <NSString, NSObject>(options.Keys, options.Values));
        }
예제 #9
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // @NOTE(sjv): Below is how we will force rotation
            // Xamarin.Forms has a lot of limitations
            MessagingCenter.Subscribe <IDCardView>(this, "forceLandscape", (obj) =>
            {
                UIDevice.CurrentDevice.SetValueForKey(NSNumber.FromNInt((int)(UIInterfaceOrientation.LandscapeLeft)), new NSString("orientation"));
            });

            MessagingCenter.Subscribe <IDCardViewModel>(this, "forcePortait", (obj) =>
            {
                UIDevice.CurrentDevice.SetValueForKey(NSNumber.FromNInt((int)(UIInterfaceOrientation.Portrait)), new NSString("orientation"));
            });

            global::Xamarin.Forms.Forms.Init();

            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
예제 #10
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();


            // Subscribe to Screen Orientation Messages
            MessagingCenter.Subscribe <object>(this, "Portrait", sender => {
                UIDevice.CurrentDevice.SetValueForKey(NSNumber.FromNInt((int)(UIInterfaceOrientation.Portrait)), new NSString("orientation"));
            });
            MessagingCenter.Subscribe <object>(this, "Landscape", sender => {
                UIDevice.CurrentDevice.SetValueForKey(NSNumber.FromNInt((int)(UIInterfaceOrientation.LandscapeRight)), new NSString("orientation"));
            });
            MessagingCenter.Subscribe <object>(this, "Unspecified", sender => {
                UIDevice.CurrentDevice.SetValueForKey(NSNumber.FromNInt((int)(UIInterfaceOrientation.Unknown)), new NSString("orientation"));
            });

            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
예제 #11
0
        nfloat CalcRowHeight(nint row, bool tryReuse = true)
        {
            updatingRowHeight = true;
            var height = Table.RowHeight;

            for (int i = 0; i < Columns.Count; i++)
            {
                CompositeCell cell = tryReuse ? Table.GetView(i, row, false) as CompositeCell : null;
                if (cell == null)
                {
                    cell = (Columns [i] as TableColumn)?.DataView as CompositeCell;
                }

                if (cell != null)
                {
                    cell.ObjectValue = NSNumber.FromNInt(row);
                    height           = (nfloat)Math.Max(height, cell.FittingSize.Height);
                }
            }
            updatingRowHeight = false;
            return(height);
        }
예제 #12
0
        public override void LayoutSublayers()
        {
            Frame           = View.Bounds;
            LineWidth       = 2;
            FillColor       = UIColor.Clear.CGColor;
            LineJoin        = JoinRound;
            LineDashPattern = new [] { NSNumber.FromNInt(2), NSNumber.FromNInt(5), NSNumber.FromNInt(5) };

            var path = UIBezierPath.FromRoundedRect(Bounds, 15);

            Path = path.CGPath;

            var flash = CABasicAnimation.FromKeyPath("opacity");

            flash.SetFrom(NSNumber.FromFloat(0));
            flash.SetTo(NSNumber.FromFloat(1));
            flash.Duration    = 0.75;
            flash.RepeatCount = 10000;

            AddAnimation(flash, "flashAnimation");
            base.LayoutSublayers();
        }
예제 #13
0
        public static NSDictionary <NSString, NSObject> ToOptions(this NxTileSourceOptions nxoptions)
        {
            if (nxoptions == null)
            {
                return(null);
            }

            var options = new NSMutableDictionary <NSString, NSObject>();

            if (nxoptions.MinimumZoomLevel.HasValue)
            {
                options.Add(MGLTileSourceOptions.MinimumZoomLevel, NSNumber.FromNInt(nxoptions.MinimumZoomLevel.Value));
            }
            if (nxoptions.MaximumZoomLevel.HasValue)
            {
                options.Add(MGLTileSourceOptions.MaximumZoomLevel, NSNumber.FromNInt(nxoptions.MaximumZoomLevel.Value));
            }

            // TODO add other options

            return(new NSDictionary <NSString, NSObject>(options.Keys, options.Values));
        }
예제 #14
0
        public void Ctors()
        {
            TestRuntime.AssertXcodeVersion(9, 0);

            NSError err;
            var     shape     = new nint [] { 1 };
            var     strides   = new nint [] { 0 };
            var     nsshape   = new NSNumber [] { NSNumber.FromNInt(1) };
            var     nsstrides = new NSNumber [] { NSNumber.FromNInt(0) };

            using (var arr = new MLMultiArray(shape, MLMultiArrayDataType.Int32, out err)) {
                Assert.AreEqual(shape, arr.Shape, "1 Shape");
                Assert.AreEqual(MLMultiArrayDataType.Int32, arr.DataType, "1 DataType");
                Assert.IsNull(err, "1 err");
            }

            using (var arr = new MLMultiArray(IntPtr.Zero, shape, MLMultiArrayDataType.Float32, strides, (v) => Marshal.FreeHGlobal(v), out err)) {
                Assert.AreEqual(shape, arr.Shape, "2 Shape");
                Assert.AreEqual(MLMultiArrayDataType.Float32, arr.DataType, "2 DataType");
                Assert.AreEqual(strides, arr.Strides, "2 Strides");
                Assert.IsNull(err, "2 err");
            }

            using (var arr = new MLMultiArray(IntPtr.Zero, nsshape, MLMultiArrayDataType.Double, nsstrides, (v) => Marshal.FreeHGlobal(v), out err)) {
                Assert.AreEqual(shape, arr.Shape, "3 Shape");
                Assert.AreEqual(MLMultiArrayDataType.Double, arr.DataType, "3 DataType");
                Assert.AreEqual(strides, arr.Strides, "3 Strides");
                Assert.AreEqual(IntPtr.Zero, arr.DataPointer, "3 DataPointer");
                Assert.IsNull(err, "3 err");
            }

            using (var arr = new MLMultiArray(nsshape, MLMultiArrayDataType.Int32, out err)) {
                Assert.AreEqual(shape, arr.Shape, "4 Shape");
                Assert.AreEqual(MLMultiArrayDataType.Int32, arr.DataType, "4 DataType");
                Assert.IsNull(err, "4 err");
            }
        }
예제 #15
0
 public override void ViewWillDisappear(bool animated)
 {
     base.ViewWillDisappear(animated);
     UIDevice.CurrentDevice.SetValueForKey(NSNumber.FromNInt((int)(UIInterfaceOrientation.Portrait)), new NSString("orientation"));
 }
 public override void ViewWillDisappear(bool animated)
 {
     AppDelegate.AllowLandscape = false;
     base.ViewWillDisappear(animated);
     UIDevice.CurrentDevice.SetValueForKey(NSNumber.FromNInt((int)UIInterfaceOrientation.Portrait), new NSString("orientation"));
 }
 public void ForceSensor()
 {
     ((AppDelegate)UIApplication.SharedApplication.Delegate).CurrentOrientation = UIInterfaceOrientationMask.All;
     UIDevice.CurrentDevice.SetValueForKey(NSNumber.FromNInt((int)(UIInterfaceOrientation.Portrait)), new NSString("orientation"));
 }
예제 #18
0
 private void Page_Disappearing(object sender, EventArgs e)
 {
     (sender as Page).Disappearing -= Page_Disappearing;
     UIDevice.CurrentDevice.SetValueForKey(NSNumber.FromNInt((int)UIInterfaceOrientation.Unknown), new NSString("orientation"));
 }
 public override void ViewDidAppear(bool animated)
 {
     base.ViewDidAppear(animated);
     UIDevice.CurrentDevice.SetValueForKey(NSNumber.FromNInt((int)(UIInterfaceOrientation.LandscapeLeft)), new NSString("orientation"));
 }
예제 #20
0
        public void Indexers()
        {
            TestRuntime.AssertXcodeVersion(9, 0);

            NSError err;
            var     shape = new nint [] { 10 };

            using (var arr = new MLMultiArray(shape, MLMultiArrayDataType.Int32, out err)) {
                Assert.IsNull(err, "err");
                Assert.AreEqual(10, arr.Count, "Count");
                Assert.AreEqual(new nint [] { 10 }, arr.Shape, "Shape");
                Assert.AreEqual(new nint [] { 1 }, arr.Strides, "Strides");

                arr [0] = 0;                 // MLMultiArray's elements aren't zero-initialized
                Assert.AreEqual(0, arr [0].Int32Value, "a");
                Assert.AreEqual(0, arr [new nint [] { 0 }].Int32Value, "b");
                Assert.AreEqual(0, arr [new NSNumber [] { NSNumber.FromNInt(0) }].Int32Value, "c nint");
                Assert.AreEqual(0, arr [new NSNumber [] { NSNumber.FromInt32(0) }].Int32Value, "c int32");
                Assert.AreEqual(0, arr [new NSNumber [] { NSNumber.FromByte(0) }].Int32Value, "c byte");
                Assert.AreEqual(0, arr [new NSNumber [] { NSNumber.FromFloat(0) }].Int32Value, "c float");

                Assert.AreEqual(0, arr.GetObject(0).Int32Value, "GetObject a");
                Assert.AreEqual(0, arr.GetObject(new nint [] { 0 }).Int32Value, "GetObject b");
                Assert.AreEqual(0, arr.GetObject(new NSNumber [] { NSNumber.FromNInt(0) }).Int32Value, "GetObject c nint");
                Assert.AreEqual(0, arr.GetObject(new NSNumber [] { NSNumber.FromInt32(0) }).Int32Value, "GetObject c int32");
                Assert.AreEqual(0, arr.GetObject(new NSNumber [] { NSNumber.FromByte(0) }).Int32Value, "GetObject c byte");
                Assert.AreEqual(0, arr.GetObject(new NSNumber [] { NSNumber.FromFloat(0) }).Int32Value, "GetObject c float");

                arr [1] = NSNumber.FromInt32(1);
                arr [new nint [] { 2 }] = NSNumber.FromInt32(2);
                arr [new NSNumber [] { NSNumber.FromUInt16(3) }] = NSNumber.FromInt32(3);
                arr.SetObject(NSNumber.FromInt32(4), 4);
                arr.SetObject(NSNumber.FromInt32(5), new nint [] { 5 });
                arr.SetObject(NSNumber.FromInt32(6), new NSNumber [] { NSNumber.FromSByte(6) });

                Assert.AreEqual(1, arr [1].Int32Value, "1");
                Assert.AreEqual(2, arr [2].Int32Value, "2");
                Assert.AreEqual(3, arr [3].Int32Value, "3");
                Assert.AreEqual(4, arr [4].Int32Value, "4");
                Assert.AreEqual(5, arr [5].Int32Value, "5");
                Assert.AreEqual(6, arr [6].Int32Value, "6");
            }

            // multi-dimensional
            shape = new nint [] { 7, 7, 7 };
            using (var arr = new MLMultiArray(shape, MLMultiArrayDataType.Int32, out err)) {
                Assert.IsNull(err, "err");
                Assert.AreEqual(shape [0] * shape [1] * shape [2], arr.Count, "Count");

                arr [0, 0, 0] = 0;                 // MLMultiArray's elements aren't zero-initialized
                Assert.AreEqual(0, arr [0, 0, 0].Int32Value, "a");
                Assert.AreEqual(0, arr [new nint [] { 0, 0, 0 }].Int32Value, "b");
                Assert.AreEqual(0, arr [new NSNumber [] { NSNumber.FromNInt(0), NSNumber.FromNInt(0), NSNumber.FromNInt(0) }].Int32Value, "c nint");

                Assert.AreEqual(0, arr.GetObject(0, 0, 0).Int32Value, "GetObject a");
                Assert.AreEqual(0, arr.GetObject(new nint [] { 0, 0, 0 }).Int32Value, "GetObject b");
                Assert.AreEqual(0, arr.GetObject(new NSNumber [] { NSNumber.FromNInt(0), NSNumber.FromNInt(0), NSNumber.FromNInt(0) }).Int32Value, "GetObject c nint");

                arr [1, 1, 1] = NSNumber.FromInt32(1);
                arr [new nint [] { 2, 2, 2 }] = NSNumber.FromInt32(2);
                arr [new NSNumber [] { NSNumber.FromUInt16(3), NSNumber.FromUInt16(3), NSNumber.FromUInt16(3) }] = NSNumber.FromInt32(3);
                arr.SetObject(NSNumber.FromInt32(4), 4, 4, 4);
                arr.SetObject(NSNumber.FromInt32(5), new nint [] { 5, 5, 5 });
                arr.SetObject(NSNumber.FromInt32(6), new NSNumber [] { NSNumber.FromSByte(6), NSNumber.FromSByte(6), NSNumber.FromSByte(6) });

                Assert.AreEqual(1, arr [1, 1, 1].Int32Value, "1");
                Assert.AreEqual(2, arr [2, 2, 2].Int32Value, "2");
                Assert.AreEqual(3, arr [3, 3, 3].Int32Value, "3");
                Assert.AreEqual(4, arr [4, 4, 4].Int32Value, "4");
                Assert.AreEqual(5, arr [5, 5, 5].Int32Value, "5");
                Assert.AreEqual(6, arr [6, 6, 6].Int32Value, "6");
            }
        }
 public void ForceLandscape()
 {
     ((AppDelegate)UIApplication.SharedApplication.Delegate).CurrentOrientation = UIInterfaceOrientationMask.LandscapeRight;
     UIDevice.CurrentDevice.SetValueForKey(NSNumber.FromNInt((int)(UIInterfaceOrientation.LandscapeRight)), new NSString("orientation"));
 }
예제 #22
0
        public void _buttonInput(UIButton button)
        {
            MMNumberKeyboardButton keyboardButton = MMNumberKeyboardButton.None;

            //https://github.com/xamarin/monotouch-samples/blob/master/AppPrefs/Settings.cs
            //NSArray.FromArray<NSDictionary> (
            //	foreach (KeyValuePair<NSObject,NSObject> t in this.buttonDictionary.GetEnumerator<KeyValuePair<NSObject,NSObject>>()) {
            //foreach (var t in this.buttonDictionary.GetEnumerator()) {
            //	this.buttonDictionary.
            //foreach (var item  in NSArray.FromArray<NSDictionary> (this.buttonDictionary.GetEnumerator)) {
            for (nuint i = 0; i < this.buttonDictionary.Count; i++)
            {
                //id key, id obj, BOOL *stop
                NSObject key = this.buttonDictionary.Keys[i];
                NSObject obj = this.buttonDictionary.Values[i];

                MMNumberKeyboardButton k = (MMNumberKeyboardButton)Enum.Parse(typeof(MMNumberKeyboardButton), key.ToString());
                if (button == obj)
                {
                    keyboardButton = k;
                    //stop = true;
                    break;
                }
            }

            if (keyboardButton == MMNumberKeyboardButton.None)
            {
                return;
            }

            // Get first responder.
            IUIKeyInput keyInput = this.keyInput;
            MMNumberKeyboardDelegate Delegate = this.Delegate;

            if (!(keyInput != null))
            {
                return;
            }

            // Handle number.
            /*const*/ MMNumberKeyboardButton numberMin = MMNumberKeyboardButton.NumberMin;
            /*const*/ MMNumberKeyboardButton numberMax = MMNumberKeyboardButton.NumberMax;

            if (keyboardButton >= numberMin && keyboardButton < numberMax)
            {
                NSNumber number  = NSNumber.FromNInt(keyboardButton - numberMin);
                string   @string = number.ToString();

                if (Delegate.RespondsToSelector(new Selector("numberKeyboard:shouldAddText:")))
                {
                    //bool  shouldAdd = Delegate.numberKeyboard(this ,/*shouldAddText*/ @string);
                    //bool  shouldAdd = Delegate.Invoke("numberKeyboard", new [] {this ,/*shouldAddText*/ @string});
                    bool shouldAdd = (bool)Delegate.Invoke("numberKeyboard", this, /*shouldAddText*/ @string);
                    if (!shouldAdd)
                    {
                        return;
                    }
                }

                keyInput.InsertText(@string);
            }

            // Handle backspace.
            else if (keyboardButton == MMNumberKeyboardButton.Backspace)
            {
                keyInput.DeleteBackward();
            }

            // Handle done.
            else if (keyboardButton == MMNumberKeyboardButton.Done)
            {
                bool shouldReturn = true;

                if (Delegate.RespondsToSelector(new Selector("numberKeyboardShouldReturn*/ ")))
                {
                    shouldReturn = (bool)Delegate.Invoke("numberKeyboardShouldReturn", this);
                }

                if (shouldReturn)
                {
                    this._dismissKeyboard(button);
                }
            }

            // Handle special key.
            else if (keyboardButton == MMNumberKeyboardButton.Special)
            {
                Action handler = this.specialKeyHandler;
                if (handler != null)
                {
                    handler();
                }
            }

            // Handle .
            else if (keyboardButton == MMNumberKeyboardButton.DecimalPoint)
            {
                string decimalText = button.Title(UIControlState.Normal);
                if (Delegate.RespondsToSelector(new Selector("numberKeyboard:shouldAddText:")))
                {
                    bool shouldAdd = (bool)Delegate.Invoke("numberKeyboard", new object[] { this, /*shouldAddText*/ decimalText });
                    if (!shouldAdd)
                    {
                        return;
                    }
                }

                keyInput.InsertText(decimalText);
            }
        }