public override UIKit.UITableViewCell GetCell(Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
		{
			var cell = base.GetCell(item, reusableCell, tv);
			cell.SelectionStyle = UITableViewCellSelectionStyle.None;

			return cell;
		}
        protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<View> e)
        {
            base.OnElementChanged (e);

            if (e.OldElement == null && e.NewElement != null) {
                //map created the first time
                page = GetContainingPage (e.NewElement);
                navPage = (page.Parent as myNavPage);
                navPage.Popped += OnPagePopped;
                //return;
            }

            var formsMap = (ExtendedMap)Element;
            var androidMapView = (MapView)Control;

            if (myMarkers == null)
                myMarkers = new List<Marker> ();

            if (androidMapView != null && androidMapView.Map != null) {
                androidMapView.Map.InfoWindowClick += MapOnInfoWindowClick;

            }

            //if (formsMap != null) {
            //	((ObservableCollection<Pin>)formsMap.Pins).CollectionChanged += OnCollectionChanged;
            //}
        }
		protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.DatePicker> e)
		{
			base.OnElementChanged(e);

			this.Control.SetTextColor(Android.Graphics.Color.Black);
			this.Control.SetTextSize(Android.Util.ComplexUnitType.Pt, 12);
		}
        protected override void OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs<Xamarin.Forms.Button> e)
        {
            base.OnElementChanged (e);

            if (e.NewElement != null) {
                Control.TouchUpInside += delegate(object sender, EventArgs e2) {

                    var formsView = new CommonFormsView ();

                    var rect = new CGRect (0, 0, 400, 400);
                    var iOSView = FormsViewToNativeiOS.ConvertFormsToNative (formsView, rect);

                    var viewController = new UIViewController();
                    viewController.Add(iOSView);
                    viewController.View.Frame = rect;

                    var popoverController = new UIPopoverController(viewController);
                    popoverController.ContentViewController.View.BackgroundColor = viewController.View.BackgroundColor;
                    popoverController.PopoverContentSize = rect.Size;
                    var frame = UIApplication.SharedApplication.KeyWindow.RootViewController.View.Frame;
                    popoverController.PresentFromRect (Control.Frame, UIApplication.SharedApplication.KeyWindow.RootViewController.View, 0, true);

                };
            }
        }
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="Microsoft.Rest.ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (Xcode != null)
     {
         Xcode.Validate();
     }
     if (Javascript != null)
     {
         Javascript.Validate();
     }
     if (Xamarin != null)
     {
         Xamarin.Validate();
     }
     if (Android != null)
     {
         Android.Validate();
     }
     if (Uwp != null)
     {
         Uwp.Validate();
     }
     if (Testcloud != null)
     {
         Testcloud.Validate();
     }
 }
Ejemplo n.º 6
0
		public async virtual Task PushPage (Xamarin.Forms.Page page, FreshBasePageModel model, bool modal = false, bool animate = true)
        {
            if (modal)
				await Navigation.PushModalAsync (CreateContainerPage (page), animate);
            else
				await Navigation.PushAsync (page, animate);
        }
		protected override View GetCellCore (Xamarin.Forms.Cell item, View convertView, ViewGroup parent, Context context)
		{

			var viewModel = (FullScheduleCellViewModel)item.BindingContext;
			LayoutInflater layoutInflater = LayoutInflater.FromContext (context);

			// creates the text color to be used depending on the track of the session
			var textColor = ((Xamarin.Forms.Color)new TrackTextColorConverter ()
				.Convert (viewModel.Track, typeof(Xamarin.Forms.Color), 
					null, CultureInfo.CurrentCulture))
				.ToAndroid ();

			var view = convertView;
			//if (view == null)
				view = layoutInflater.Inflate (Resource.Layout.FullScheduleCell, null);

			SetupTitle (view, viewModel, textColor, true);
			SetupLocation (view, viewModel, textColor, true);
			SetupTrack (view, viewModel, textColor, true);

			if(viewModel.IsOptional)
				SetupSelectButton (view, viewModel, textColor);

			// set the background color of the cell to the appropriate track color
			Color background = ((Xamarin.Forms.Color)new TrackBackgroundColorConverter ()
				.Convert (viewModel.Track, typeof(Xamarin.Forms.Color), null, CultureInfo.CurrentCulture)).ToAndroid ();
			view.SetBackgroundColor (background);

			return view;
		}
Ejemplo n.º 8
0
        protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<View> e)
        {
            base.OnElementChanged(e);

            var formsMap = (Xam.Plugin.MapExtend.Abstractions.MapExtend)Element;
            var androidMapView = (Android.Gms.Maps.MapView)Control;



            if (formsMap != null)
            {
                //((System.Collections.ObjectModel.ObservableCollection<Xamarin.Forms.Maps.Pin>)formsMap.Pins).CollectionChanged += OnPinsCollectionChanged;

                ((ObservableRangeCollection<Position>)formsMap.polilenes).CollectionChanged += OnPolCollectionChanged;

                ((ObservableRangeCollection<PinExtend>)formsMap.EPins).CollectionChanged += OnEPinCollectionChanged;

                androidMapView.Map.MarkerDragEnd += Map_MarkerDragEnd;
                androidMapView.Map.MapLongClick += (s, a) =>
                {
                    formsMap.Pins.Add(new Pin
                    {
                        Label = "Meu Endereço",
                        Position = new Position(a.Point.Latitude, a.Point.Longitude)
                    }
                    );
                };
            }
        }
Ejemplo n.º 9
0
        public override UITableViewCell GetCell(Xamarin.Forms.Cell item, UITableView tv)
        {
            TextCell textCell = (TextCell)item;
            UITableViewCellStyle style = UITableViewCellStyle.Value1;
            string text = "Xamarin.Forms.TextCell";
            CellTableViewCell cellTableViewCell = tv.DequeueReusableCell(text) as CellTableViewCell;
            if (cellTableViewCell == null)
            {
                cellTableViewCell = new CellTableViewCell(style, text);
            }
            else
            {
                cellTableViewCell.Cell.PropertyChanged -= new PropertyChangedEventHandler(cellTableViewCell.HandlePropertyChanged);
            }
            cellTableViewCell.Cell = textCell;
            textCell.PropertyChanged += new PropertyChangedEventHandler(cellTableViewCell.HandlePropertyChanged);
            cellTableViewCell.PropertyChanged = new Action<object, PropertyChangedEventArgs>(this.HandlePropertyChanged);
            cellTableViewCell.TextLabel.Text = textCell.Text;
            cellTableViewCell.DetailTextLabel.Text = textCell.Detail;
            //cellTableViewCell.TextLabel.TextColor = textCell.TextColor.ToUIColor(TextCellRenderer.DefaultTextColor);
            //cellTableViewCell.DetailTextLabel.TextColor = textCell.DetailColor.ToUIColor(TextCellRenderer.DefaultDetailColor);
            base.UpdateBackground(cellTableViewCell, item);

            cellTableViewCell.Accessory = UITableViewCellAccessory.DisclosureIndicator;

            return cellTableViewCell;
        }
Ejemplo n.º 10
0
        private static String SAMPLE = dir + "Video_2014_5_7__15_33_44.mpg";//"Video_2014_5_8__9_12_35.mpg";//"Video_2014_5_6__15_55_19.mpg";//


        protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.View> e)
        {
            Android.Util.Log.Debug(this.GetType().Name, "OnElementChanged()");

            Android.Util.Log.Debug("Android API-int: ", Android.OS.Build.VERSION.Sdk);
            Android.Util.Log.Debug("Android API build: ", ""+Android.OS.Build.VERSION.SdkInt);
            Android.Util.Log.Debug("Android API: ", Android.OS.Build.VERSION.Codename);



            //first call into this method, the render was just created?
            if (e.OldElement == null)
            {
                surf = new SurfaceView(Context);

                myV = e.NewElement;//capture our Xamarin View.

                Android.Util.Log.Debug("X =", myV.X.ToString());

                myV.SizeChanged += myV_SizeChanged;
                myV.PropertyChanged += myV_PropertyChanged;

                base.SetNativeControl(surf);

                surf.Holder.AddCallback(this);
            }
        }
Ejemplo n.º 11
0
        public virtual async Task PushPage (Xamarin.Forms.Page page, FreshBasePageModel model, bool modal = false, bool animated = true)
		{
			if (modal)
                await Navigation.PushModalAsync (new NavigationPage(page), animated);
			else
                await ((NavigationPage)_tabbedNavigationPage.CurrentPage).PushAsync (page, animated); 
		}
Ejemplo n.º 12
0
		protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Xamarin.Forms.Editor> e)
		{
			base.OnElementChanged(e);
			if (e.OldElement != null || this.Element == null)
				return;
			updateBackground();
		}
Ejemplo n.º 13
0
        public XFPopupDlg(Page _parent, Xamarin.Forms.View _content,  bool _cancelable, String _title, bool _rightClose, String _ok, String _ko)
        {
            var g = GenDialog (_content, _cancelable, _title, _rightClose, _ok, _ko);

            var svr = DependencyService.Get<IXFPopupSrvc> ();
            dlgNative = svr.CreateDialog(_parent, g, _cancelable);
        }
		/// <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);
		}
Ejemplo n.º 15
0
		protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs<SearchBar> e)
		{
			base.OnElementChanged(e);
			if (this.Control == null || this.Element == null)
				return;
			updateBackground();
		}
        protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<TimePicker> e)
        {
            base.OnElementChanged(e);

            this.Control.SetTextColor(AppConstants.ColorDarkGrey.ToAndroid());
            this.Control.SetTextSize(Android.Util.ComplexUnitType.Pt, 10);
        }
        /// <summary>
        /// Gets the color of the span.
        /// </summary>
        /// <param name="color">The color.</param>
        /// <param name="defaultColors">The default colors.</param>
        /// <returns>Android.Graphics.Color.</returns>
        public Android.Graphics.Color GetSpanColor(Xamarin.Forms.Color color, ColorStateList defaultColors)
        {
            if (color == Xamarin.Forms.Color.Default)
                return new Android.Graphics.Color(defaultColors.DefaultColor);

            return color.ToAndroid();
        }
		CAShapeLayer GetMaskShape (ViewMaskerType maskType, Xamarin.Forms.Size size)
		{
			var layer = new CAShapeLayer ();
			layer.FillColor = UIColor.White.CGColor;
			layer.StrokeColor = UIColor.White.CGColor;
			layer.LineWidth = 0;
			UIBezierPath path = null;
			var bounds = new CGRect (0, 0, size.Width, size.Height);

			switch (maskType) {
			case ViewMaskerType.Circle:
				path = UIBezierPath.FromRoundedRect (bounds, (nfloat)Math.Max (size.Width, size.Height));
				break;
			case ViewMaskerType.Triangle:
				var point1 = new CGPoint (0, size.Height);
				var point2 = new CGPoint (size.Width, size.Height);
				var point3 = new CGPoint (size.Width / 2, 0);
				path = new UIBezierPath ();
				path.MoveTo (point1);
				path.AddLineTo (point2);
				path.AddLineTo (point3);
				path.AddLineTo (point1);
				path.ClosePath ();
				path.Fill ();
				break;
			case ViewMaskerType.Square:
				var smallRectangle = UIBezierPath.FromRect (bounds.Inset (50, 50));
				path = UIBezierPath.FromRoundedRect (bounds, 20);
				break;
			default:
				throw new ArgumentOutOfRangeException ();
			}
			layer.Path = path.CGPath;
			return layer;
		}
        private static async void HandleSubMenu(Xamarin.Forms.MenuItem item, object parameter)
        {
            var cascadeMenuItem = item as CascadeMenuItem;
            var menu = cascadeMenuItem.SubMenu;

            if (menu == null || !menu.Any()) return;

            var element = cascadeMenuItem.Page;

            if (element != null)
            {
                var result = await element.DisplayActionSheet(item.Text, cancel: null, destruction: null,
                                        buttons: menu
                                        .Select(i => i.Text)
                                        .ToArray());

                if (result != null)
                {
                    var selectedItem = menu.First(x => x.Text == result);

                    if (selectedItem.Command?.CanExecute(selectedItem) == true)
                    {
                        selectedItem.Command.Execute(parameter);
                    }
                }
            }
        }
Ejemplo n.º 20
0
 private void OnPositionError(object sender, Xamarin.Geolocation.PositionErrorEventArgs e) {
     if (this.PositionError != null) {
         var error = e.Error == GeolocationError.Unauthorized
             ? GeoLocationError.Unauthorized
             : GeoLocationError.PositionUnavailable;
         this.PositionError(this, new PositionErrorEventArgs(error));
     }
 }
Ejemplo n.º 21
0
		protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs<Label> e)
		{
			base.OnElementChanged(e);

			if (e.OldElement != null || this.Element == null)
				return;
			updateLineCount();
		}
 private void OnPushed(object sender, Xamarin.Forms.NavigationEventArgs e)
 {
     var vm = e.Page.BindingContext as IViewModel;
     if (vm != null)
     {
         vm.OnPushed();
     }
 }
 public void SetColor(Xamarin.Forms.Color color)
 {
     drawable.Paint.SetARGB((int)(255 * color.A), 
                            (int)(255 * color.R), 
                            (int)(255 * color.G), 
                            (int)(255 * color.B));
     Invalidate();
 }
 public override UITableViewCell GetCell(Xamarin.Forms.Cell item, UITableView tv)
 {
     var cell = base.GetCell(item, tv);
      cell.ImageView.Layer.CornerRadius = 15.0f;
      cell.ImageView.Layer.MasksToBounds = true;
      cell.ImageView.Layer.BorderColor = UIColor.LightGray.CGColor;
     cell.ImageView.Layer.BorderWidth = 1.0f;
      return cell;
 }
Ejemplo n.º 25
0
		protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs<Entry> e)
		{
			base.OnElementChanged(e);

			if (e.OldElement != null || this.Element == null)
				return;

			this.Control.BorderStyle = UITextBorderStyle.None;
		}
Ejemplo n.º 26
0
		/**
     * {@inheritDoc}
     */
		public override bool OnOptionsItemSelected (Xamarin.ActionbarSherlockBinding.Views.IMenuItem item)
		{
			// If this callback does not handle the item click, onPerformDefaultAction
			// of the ActionProvider is invoked. Hence, the provider encapsulates the
			// complete functionality of the menu item.
			Toast.MakeText (this, "Handling in onOptionsItemSelected avoided",
			               ToastLength.Short).Show ();
			return false;
		}
        private Page GetContainingPage(Xamarin.Forms.Element element)
        {
            Element parentElement = element.ParentView;

            if (typeof(Page).IsAssignableFrom(parentElement.GetType()))
                return (Page)parentElement;
            else
                return GetContainingPage(parentElement);
        }
 private void OnPopped(object sender, Xamarin.Forms.NavigationEventArgs e)
 {
     var vm = e.Page.BindingContext as IViewModel;
     if (vm != null)
     {
         vm.OnPopped();
         Xamarin.Forms.MessagingCenter.Send(this, "IViewModelPopped", vm);
     }
 }
Ejemplo n.º 29
0
		protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs<SearchBar> e)
		{
			base.OnElementChanged(e);

			if (e.OldElement != null || this.Element == null)
				return;
			
			this.Control.InputAccessoryView = InputToolboxView.CreateFromNIB(null, InputAccessoryViewMode.Done);
		}
 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);
     }
 }
Ejemplo n.º 31
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            ViewHolder holder = null;

            if (convertView == null)
            {
                holder = new ViewHolder();

                if (ConfigStyle.DropMode == SupportAutoCompleteDropMode.TitleWithDescription)
                {
                    convertView           = LayoutInflater.From(mContext).Inflate(Resource.Layout.layout_title_and_description, parent, false);
                    holder.txtDescription = convertView.FindViewById <TextView>(Resource.Id.txtDescription);
                }
                else if (ConfigStyle.DropMode == SupportAutoCompleteDropMode.IconAndTitle)
                {
                    convertView    = LayoutInflater.From(mContext).Inflate(Resource.Layout.layout_title_and_icon, parent, false);
                    holder.imgIcon = convertView.FindViewById <ImageView>(Resource.Id.imgIcon);
                }
                else if (ConfigStyle.DropMode == SupportAutoCompleteDropMode.FullTextAndIcon)
                {
                    convertView           = LayoutInflater.From(mContext).Inflate(Resource.Layout.layout_full_text_and_icon, parent, false);
                    holder.txtDescription = convertView.FindViewById <TextView>(Resource.Id.txtDescription);
                    holder.imgIcon        = convertView.FindViewById <ImageView>(Resource.Id.imgIcon);
                }
                else
                {
                    convertView = LayoutInflater.From(mContext).Inflate(Resource.Layout.layout_single_title, parent, false);
                }

                holder.sort_down    = convertView.FindViewById <ImageView>(Resource.Id.sortDown);
                holder.txtTitle     = convertView.FindViewById <TextView>(Resource.Id.txtTitle);
                holder.txtSeperator = convertView.FindViewById <TextView>(Resource.Id.txtSeperator);
                holder.bttClick     = convertView.FindViewById <Button>(Resource.Id.bttClick);
                holder.checkBox     = convertView.FindViewById <CheckBox>(Resource.Id.checkBox);

                convertView.Tag = (holder);
            }
            else
            {
                holder = (ViewHolder)convertView.Tag;
            }

            holder.txtTitle.Text             = string.Join(", ", items.Where(Xamarin => Xamarin.IF_GetChecked()).Select(ita => ita.IF_GetTitle()));
            holder.checkBox.Tag              = (position);
            holder.sort_down.Visibility      = ViewStates.Visible;
            holder.txtDescription.Visibility = ViewStates.Gone;
            holder.checkBox.Visibility       = ViewStates.Gone;
            holder.imgIcon.Visibility        = ViewStates.Gone;
            holder.bttClick.Visibility       = ViewStates.Gone;

            if (Build.VERSION.SdkInt < BuildVersionCodes.JellyBean)
            {
                convertView.SetBackgroundDrawable(gradientDrawable);
            }
            else
            {
                convertView.SetBackground(gradientDrawable);
            }

            return(convertView);
        }
		public void ToggleViewShadow (Xamarin.Forms.View view, bool isOn)
		{
			var renderer = view.GetRenderer ();
			var nativeView = renderer.NativeView;
			nativeView.Layer.ShadowColor = UIColor.Black.CGColor;
			nativeView.Layer.ShadowOpacity = isOn ? 1 : 0;
			nativeView.Layer.ShadowOffset = isOn ? new CGSize (10, 10) : CGSize.Empty;
		}