Exemplo n.º 1
0
        protected override async void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <VidyoConnector.Controls.NativeView> e)
        {
            base.OnElementChanged(e);

            if (Control == null)
            {
                // Instantiate the native control and assign it to the Control property with
                // the SetNativeControl method
                _uiView = new UIView()
                {
                    ContentMode = UIViewContentMode.ScaleToFill
                };
                SetNativeControl(_uiView);
            }

            if (e.OldElement != null)
            {
                // Unsubscribe from event handlers and cleanup any resources
                VidyoController.GetInstance().Cleanup();
            }

            if (e.NewElement != null)
            {
                // Configure the control and subscribe to event handlers
                e.NewElement.Handle = this.Control.Handle;
                await this.AuthorizeMediaUse();
            }
        }
Exemplo n.º 2
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                mapView = Control as MKMapView;

                myMap = e.NewElement as MyMap;

                mapView.OverlayRenderer = (m, o) => {
                    if (lineRenderer == null)
                    {
                        lineRenderer             = new MKPolylineRenderer(o as MKPolyline);
                        lineRenderer.StrokeColor = UIColor.Red;
                        lineRenderer.FillColor   = UIColor.Red;
                    }
                    return(lineRenderer);
                };

                var point1 = new CLLocationCoordinate2D(37, -122);
                var point2 = new CLLocationCoordinate2D(37, -122.001);
                var point3 = new CLLocationCoordinate2D(37.001, -122.002);

                lineOverlay = MKPolyline.FromCoordinates(new CLLocationCoordinate2D[] { point1, point2, point3 });
                mapView.AddOverlay(lineOverlay);
            }
        }
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Xamarin.Forms.Picker> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement != null || this.Element == null)
            {
                return;
            }

            var element = Element as MvvmAspire.Controls.Picker;

            if (element != null)
            {
                SetTextColor(element);
                SetBorderColor(element);

                //var test = true;

                if (textColor.ToColor() != UIColor.White.ToColor())
                {
                    setPlaceHolderColor(element);
                }

                if (UIAccessibility.IsVoiceOverRunning)
                {
                    AutomationProperties.SetIsInAccessibleTree(element, true);
                }
                //if( !test )
                //setPlaceHolderColor(element);
            }
        }
Exemplo n.º 4
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                var nativeMap = (MKMapView)Control;
                if (nativeMap != null)
                {
                    nativeMap.RemoveAnnotations(nativeMap.Annotations);
                    nativeMap.GetViewForAnnotation            = null;
                    nativeMap.DidSelectAnnotationView        -= OnDidSelectAnnotationView;
                    nativeMap.DidDeselectAnnotationView      -= OnDidDeselectAnnotationView;
                    ((DefaultMap)e.OldElement).OnPinsUpdated -= UpdatePins;
                }
            }

            if (e.NewElement != null)
            {
                var formsMap  = (DefaultMap)e.NewElement;
                var nativeMap = (MKMapView)Control;
                _pins = formsMap.Pins;
                _delayedBusIndices                   = formsMap.DelayedBusIndices;
                nativeMap.GetViewForAnnotation       = GetViewForAnnotation;
                nativeMap.DidSelectAnnotationView   += OnDidSelectAnnotationView;
                nativeMap.DidDeselectAnnotationView += OnDidDeselectAnnotationView;
                formsMap.OnPinsUpdated              += UpdatePins;
            }
        }
Exemplo n.º 5
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Xamarin.Forms.View> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                var nativeMap = Control as MKMapView;
                nativeMap.GetViewForAnnotation     = null;
                nativeMap.DidSelectAnnotationView -= OnDidSelectAnnotationViewAsync;
                nativeMap.OverlayRenderer         -= GetOverlayRenderer;
            }

            if (e.NewElement != null)
            {
                var formsMap      = e.NewElement as CustomMap;
                var nativeMap     = Control as MKMapView;
                var TapRecognizer = new UITapGestureRecognizer(OnMapTapped);

                nativeMap.GetViewForAnnotation     = GetViewForAnnotation;
                nativeMap.DidSelectAnnotationView += OnDidSelectAnnotationViewAsync;
                nativeMap.OverlayRenderer         += GetOverlayRenderer;
                nativeMap.AddGestureRecognizer(TapRecognizer);

                customPins = formsMap.CustomPins;
            }
        }
Exemplo n.º 6
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <MediaElement> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                e.OldElement.SetRenderer(null);
            }

            if (e.NewElement != null)
            {
                SetNativeControl(_avPlayerViewController.View);
                e.NewElement.SetRenderer(this);

                _avPlayerViewController.ShowsPlaybackControls = Element.AreTransportControlsEnabled;
                _avPlayerViewController.VideoGravity          = AVLayerVideoGravity.ResizeAspect;
                if (Element.KeepScreenOn)
                {
                    SetKeepScreenOn(true);
                }

                _notificationHandle = NSNotificationCenter.DefaultCenter.AddObserver(AVPlayerItem.DidPlayToEndTimeNotification, PlayedToEnd);

                UpdateSource();
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Mapの生成時に呼び出される
        /// </summary>
        /// <param name="e">E.</param>
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);

            if (Element == null)
            {
                return;
            }

            // Elementをキャストして、共通クラスで定義したMapを取得
            var formsMap = (CustomMap)Element;

            // ↑で取得したマップから、初期の中心座標を取得
            var position = formsMap.firstPosition;

            // カメラ位置(中心座標と表示領域)を設定
            var camera = CameraPosition.FromCamera(position.Latitude, position.Longitude, 10);

            // マップを作成
            var mapView = MapView.FromCamera(CoreGraphics.CGRect.Empty, camera);

            // 現在地を表示
            mapView.MyLocationEnabled = true;

            // 現在位置へ移動ボタンを表示
            mapView.Settings.MyLocationButton = true;

            // コントロールに作成したMapViewを設定
            // これにより、ここで生成したMapViewがFormsのマップの代わりに扱われるようになる
            SetNativeControl(mapView);
        }
Exemplo n.º 8
0
        // Override the OnElementChanged method so we can tweak this renderer post-initial setup
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            if (Control != null && Element != null)
            {
                switch (Element.HorizontalTextAlignment)
                {
                case TextAlignment.Center: Control.TextAlignment = UITextAlignment.Center; break;

                case TextAlignment.Start: Control.TextAlignment = UITextAlignment.Left; break;

                case TextAlignment.End: Control.TextAlignment = UITextAlignment.Right; break;
                }

                //Control.TextAlignment = UITextAlignment.Left;

                Control.TextColor             = UIColor.White;
                Control.Font                  = UIFont.FromName(Config.FontFamily, Config.SuperLargeFontSize);
                Control.AttributedPlaceholder = new NSAttributedString(
                    "--",
                    font: UIFont.FromName(Config.FontFamily, Config.SuperLargeFontSize),
                    foregroundColor: UIColor.FromRGB((byte)(int)(Config.ColorTextOnBackgroundGrayed.R * 255), (byte)(int)(Config.ColorTextOnBackgroundGrayed.G * 255), (byte)(int)(Config.ColorTextOnBackgroundGrayed.B * 255)),// UIColor.White,
                    strokeWidth: 0
                    );
            }
        }
Exemplo n.º 9
0
 protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Telerik.XamarinForms.Input.RadDataForm> e)
 {
     base.OnElementChanged(e);
     if (this.Element != null)
     {
         this.Element.GroupLayoutDefinition = new DataFormGroupStackLayoutDefinition();
     }
 }
Exemplo n.º 10
0
 protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Entry> e)
 {
     base.OnElementChanged(e);
     if (Control != null)
     {
         this.Control.BorderStyle = UITextBorderStyle.None;
     }
 }
Exemplo n.º 11
0
 protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Xamarin.Forms.View> e)
 {
     base.OnElementChanged(e);
     if (e.NewElement != null)
     {
         CreateMap();
     }
 }
Exemplo n.º 12
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <ListView> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                Control.Delegate = new ListViewTableViewDelegate(this);
            }
        }
Exemplo n.º 13
0
        // Override the OnElementChanged method so we can tweak this renderer post-initial setup
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Picker> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.Font = UIFont.FromName(Config.FontFamily, Config.DefaultFontSize);
            }
        }
 protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Syncfusion.SfAutoComplete.XForms.SfAutoComplete> e)
 {
     base.OnElementChanged(e);
     if (e.OldElement == null)
     {
         Control.Layer.BorderWidth = 0;
     }
     // Control?.SetBackgroundColor(Android.Graphics.Color.Transparent);
 }
Exemplo n.º 15
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Xamarin.Forms.Entry> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.BackgroundColor = UIColor.FromRGB(204, 153, 255);
                Control.BorderStyle     = UITextBorderStyle.Bezel;
            }
        }
Exemplo n.º 16
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Xamarin.Forms.TableView> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                Control.SeparatorColor  = UIColor.Clear;
                Control.AllowsSelection = false;
            }
        }
 protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Xamarin.Forms.Label> e)
 {
     base.OnElementChanged(e);
     if (label == null)
     {
         label      = new MarqueeLabel(this.Bounds);
         label.Text = "Hello World this is a Marquee Label.  It is a long text. Text End!";
         SetNativeControl(label);
     }
 }
Exemplo n.º 18
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Xamarin.Forms.ListView> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                Control.SeparatorColor  = UIColor.Gray.ColorWithAlpha(0.3f);
                Control.TableFooterView = new UIView();
            }
        }
Exemplo n.º 19
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Xamarin.Forms.Editor> e)
        {
            base.OnElementChanged(e);

            if (Control != null && e.NewElement != null)
            {
                Control.Layer.BorderColor = new CoreGraphics.CGColor(1f, 1f, 1f);
                Control.Layer.BorderWidth = 1;
            }
        }
Exemplo n.º 20
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Xamarin.Forms.Editor> e)
        {
            base.OnElementChanged(e);
            var xEditor = (XTwitter.Views.XEditor)e.NewElement;

            if (xEditor != null)
            {
                Control.Font = UIFont.SystemFontOfSize((nfloat)xEditor.FontSize);
                Control.Layer.CornerRadius = 10;
            }
        }
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <TimePicker> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                UITextField  entry  = Control;
                UIDatePicker picker = (UIDatePicker)entry.InputView;
                picker.PreferredDatePickerStyle = UIDatePickerStyle.Wheels;
            }
        }
Exemplo n.º 22
0
        // Override the OnElementChanged method so we can tweak this renderer post-initial setup
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Picker> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.BorderStyle = UITextBorderStyle.None;
                Control.TextColor   = UIColor.White;
                Control.Font        = UIFont.FromName(Config.FontFamily, Config.VeryLargeFontSize);
            }
        }
Exemplo n.º 23
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                var formsMap  = (CustomMap)e.NewElement;
                var nativeMap = Control as MKMapView;
                nativeMap.Delegate = new CustomMapDelegate(formsMap.CustomPins as List <CustomPin>);
            }
        }
Exemplo n.º 24
0
        // Override the OnElementChanged method so we can tweak this renderer post-initial setup
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <DatePicker> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.BorderStyle = UITextBorderStyle.None;
                Control.TextColor   = UIColor.Black;
                Control.Font        = UIFont.FromName(Config.FontFamilyBold, (float)Config.DefaultFontSize);
            }
        }
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Syncfusion.SfNumericTextBox.XForms.SfNumericTextBox> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.Layer.CornerRadius = 5;
                Control.Layer.BorderWidth  = 1;
                Control.ClipsToBounds      = true;
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// Called when the portable element changes.
        /// </summary>
        /// <param name="e">The event arguments.</param>
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <ListView> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                // Stock XF renderer uses a combined UITableViewSource to configure both UITableViewDataSource and UITableViewDelegate.
                // However, as this class is internal within the XF renderer we can't extend it. So we do this...
                // By overriding just the delegate, we can intercept what we wish and route the rest back to the UITableViewSource in the XF renderer.
                Control.Delegate = new ListViewTableViewDelegate(this);
            }
        }
Exemplo n.º 27
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <RadListView> e)
        {
            base.OnElementChanged(e);

            if (this.Control != null)
            {
                var layout = (TKListViewLinearLayout)this.Control.Layout;
                layout.ItemAppearAnimation = TKListViewItemAnimation.Scale;
                // layout.ItemInsertAnimation = TKListViewItemAnimation.Scale;
                // layout.ItemDeleteAnimation = TKListViewItemAnimation.Scale;
            }
        }
Exemplo n.º 28
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <Picker> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                var bar = (UIToolbar)Control.InputAccessoryView;
                bar.BarTintColor = UIColor.Black;
                bar.Items[1].SetTitleTextAttributes(new UITextAttributes {
                    TextColor = UIColor.White
                }, UIControlState.Normal);
            }
        }
Exemplo n.º 29
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <View> e)
        {
            if (Control != null)
            {
                Control.RemoveGestureRecognizer(_tapRecogniser);
            }

            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.AddGestureRecognizer(_tapRecogniser);
            }
        }
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);
            var mapTile = (MapTile)Element;

            if (e.OldElement == null)
            {
                mapTile.PinUpdating      += (ss, ee) => { UpdatePins(); };
                mapTile.LocationUpdating += (ss, ee) => { UpdatePins(); };
                mapTile.RegionMoved      += (ss, ee) => { RegionMoved(ee); };

                SetGoogleMapControl();
            }
        }