private static Color GetMessageTextColorFor(NotificationTypeEnum notificationType)
        {
            switch (notificationType)
            {
            case NotificationTypeEnum.Info:
                return(Color.FromHex("#00529B"));

            case NotificationTypeEnum.Success:
                return(Color.FromHex("#4F8A10"));

            case NotificationTypeEnum.Warning:
                return(Color.FromHex("£9F6000"));

            case NotificationTypeEnum.Error:
                return(Color.FromHex("#D8000C"));

            case NotificationTypeEnum.Network:
                return(Color.White);

            default:
                return(Color.Pink);
            }
        }
        private static Color GetBackgroundColorFor(NotificationTypeEnum notificationType)
        {
            switch (notificationType)
            {
            case NotificationTypeEnum.Info:
                return(Color.FromHex("#BDE5F8"));

            case NotificationTypeEnum.Success:
                return(Color.FromHex("#DFF2BF"));

            case NotificationTypeEnum.Warning:
                return(Color.FromHex("#FEEFB3"));

            case NotificationTypeEnum.Error:
                return(Color.FromHex("#FFD2D2"));

            case NotificationTypeEnum.Network:
                return(Color.Black);

            default:
                return(Color.LightPink);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 标注点击时
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnMarkerClick(object sender, BaiduMap.MarkerClickEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(e.P0.Title))
                {
                    var pin = Map.Pins.Find(e.P0);
                    if (pin?.Terminal != null)
                    {
                        var color = pin?.Terminal?.RankColor ?? "#4a89dc";

                        //cardView
                        var cardView = new CardView(Context)
                        {
                            Radius = 15
                        };
                        cardView.SetCardBackgroundColor(Color.FromHex(color).ToAndroid());

                        //布局
                        var layout = new LinearLayout(Context)
                        {
                            Orientation = Orientation.Vertical
                        };
                        layout.SetPadding(10, 10, 10, 10);

                        //Title
                        var tview = new TextView(Context);
                        tview.SetPadding(10, 10, 10, 10);
                        tview.SetTextColor(Color.White.ToAndroid());
                        tview.TextSize = 12;
                        tview.Text     = e.P0.Title;

                        //Button
                        var param = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent)
                        {
                            Height = 45
                        };
                        var button = new Android.Widget.Button(Context);
                        button.Text             = "去拜访";
                        button.TextSize         = 10;
                        button.LayoutParameters = param;
                        button.SetBackgroundResource(Resource.Drawable.roundShape);
                        button.SetTextColor(Color.White.ToAndroid());
                        button.Click += (sender, ar) =>
                        {
                            var pin = Map.Pins.Find(e.P0);
                            pin?.SendClicked(pin?.Terminal);
                        };

                        layout.AddView(tview);
                        layout.AddView(button);

                        cardView.AddView(layout);

                        var window = new InfoWindow(cardView, e.P0.Position, -e.P0.Icon.Bitmap.Height);
                        NativeMap.Map.ShowInfoWindow(window);
                    }
                }
            }
            catch (Exception)
            {
            }
        }