Ejemplo n.º 1
0
        public void DrawPolygon(LocationCollection locations, string msg)
        {
            currentLine = new List <UIElement>();
            Location lastLocation = locations.Last();

            _tag = Common_liby.GetGuidString();

            poly                 = new MapPolygon();
            poly.Locations       = locations;
            poly.StrokeThickness = 2;
            poly.Opacity         = 0.5;
            poly.Stroke          = new SolidColorBrush(Colors.Red);
            poly.Fill            = new SolidColorBrush(Color.FromArgb(200, 253, 128, 68));
            poly.StrokeLineJoin  = PenLineJoin.Round;
            lyr.Children.Add(poly);
            currentLine.Add(poly);

            foreach (Location location in locations)
            {
                AddToMapLayer(CreatePoint(), location, PositionOrigin.Center);
            }

            movePanel = CreatePanel(msg, "");
            AddToMapLayer(movePanel, lastLocation);

            var del = CreateDeleteButton();

            lyr.AddChild(del, lastLocation, new System.Windows.Point(-13, 6));
            currentLine.Add(del);
            dicLines.Add(_tag, currentLine);
        }
Ejemplo n.º 2
0
        public static void Show(string title, string message, MessageBoxIcon messageIcon, MessageBoxButton messageButton, Action okEvent = null, Action cancelEvent = null)
        {
            short icon = (short)messageIcon;

            if (icon < 0)
            {
                icon = 0;
            }

            StringBuilder btn = new StringBuilder("确定");

            if (messageButton == MessageBoxButton.OKCancel)
            {
                btn.AppendFormat(",{0}", "取消");
            }

            string token = null;

            if (okEvent != null || cancelEvent != null)
            {
                Action[] eventActions = new Action[2];
                if (okEvent != null)
                {
                    eventActions[0] = okEvent;
                }
                if (cancelEvent != null)
                {
                    eventActions[1] = cancelEvent;
                }

                token = Common_liby.GetGuidString();
                DicJsEventCallBack.Add(token, eventActions);
            }

            Common_liby.InvokeMethodOnMainThread(() =>
                                                 HtmlPage.Window.Invoke("lalert", title, message, icon, btn.ToString(), token));

            #region 旧版弹窗

            //if (_instance != null)
            //{
            //    _instance.Close();
            //    _instance = null;
            //}
            //Instance.Title = title;
            //Instance.TextMessage.Text = message;
            //Size fontSize = Common.MeasureString(message, Instance.TextMessage.FontFamily, Instance.TextMessage.FontSize);
            //double width = 10 + 50 + fontSize.Width + 22 + 10;
            //if (width < 177)
            //    width = 177;
            //Instance.Width = width;
            //double height = 28 + 13 + fontSize.Height < 30 ? 30 : fontSize.Height + 13 + 42;
            //if (height < 124)
            //    height = 124;
            //Instance.Height = height;
            //string imgurl = string.Format("/Images/icon_{0}.png", ((int)messageIcon).ToString("D2"));
            //Instance.ImageIcon.Source = new BitmapImage(new Uri(imgurl, UriKind.Relative));
            //if (messageButton == MessageBoxButton.OK)
            //{
            //    Instance.CancelButton.Visibility = Visibility.Collapsed;
            //    Instance.OKButton.Margin = Instance.CancelButton.Margin;
            //}
            //Instance.CancelButton.Focus();

            //Instance.Closed += (x, y) =>
            //{
            //    if (Instance.DialogResult == true)
            //    {
            //        Instance = null;
            //        if (okEvent != null)
            //            okEvent();
            //    }
            //    else
            //    {
            //        Instance = null;
            //        if (cancelEvent != null)
            //            cancelEvent();
            //    }
            //};
            //Instance.Show();

            #endregion
        }