public static void CloseMsg() { Common_liby.InvokeMethodOnMainThread(() => { HtmlPage.Window.Invoke("closemsg"); }); }
public static void Msg(string message, MessageBoxIcon messageIcon = MessageBoxIcon.None, int durtime = 3000) { short icon = (short)messageIcon; Common_liby.InvokeMethodOnMainThread(() => { HtmlPage.Window.Invoke("msg", message, icon, durtime); }); }
/// <summary> /// 数据绑定方法 /// </summary> public void Bind(List <UNIT> units, List <SLCar> cars, bool isOilWell = false) { if (units != null && cars != null) { _checkedCars.Clear(); SelectedCar = null; //var t= cars.First(x => string.IsNullOrWhiteSpace(x.LICENSE)); //调试用 找错误数据 IEnumerable <SLCar> carlist = null; if (isOilWell) { carlist = cars.Where(x => x.IS_POLL_OIL_SPOT == 1); } else { carlist = cars.Where(x => x.IS_POLL_OIL_SPOT != 1); } List <UNIT> unitlist = units; _rootUnitData.BrowseMode = BrowseMode; //浏览模式赋值 _rootUnitData.gwcMode = gwcMode; //DateTime time = DateTime.Now; _rootUnitData.FillData(unitlist, carlist); //double mis = (DateTime.Now - time).TotalMilliseconds; Common_liby.InvokeMethodOnMainThread(() => { tv.Items.Clear(); tv.ItemsSource = _rootUnitData.Items; //数据源设置 tv.Loaded += (sender, e) => { if (_rootUnitData.Items.Count == 1) //子节点只有一个 { tv.ExpandToDepth(1); //展开子节点 } }; }); } }
/// <summary> /// 历史回放模式 /// </summary> //public bool HistoryMode { get; set; } bool RefreshState(NEWTRACK gps, string fieldName = null, bool noWeb = false) { if (gps == null) { return(false); } CarStatus.RefreshStatus(gps.STATUS, gps.STOPTIME); //车辆状态 OnPropertyChanged(nameof(CarStatus), true); AlarmStatus.RefreshAlarmStatus(gps.ALARM); OnPropertyChanged(nameof(AlarmStatus), true); if (gps.IsRealTime || _isCopy || (!gps.IsRealTime && !_isCopy)) { //在线或者历史回放状态刷新 if (!_isCopy && (CarStatus.offline == true || !gps.IsRealTime)) { //车辆下线 CarState = CarState.OffLine; } else { //在线状态下 if (AlarmStatus.HasAlarm) { //报警状态 CarState = CarState.Alarm; if (!_isCopy) { OnHaveNewAlarm(AlarmType.Normal); //新的报警 } } else if (gps.LOCATE != 1) //不定位 { CarState = CarState.NoGps; } else if (gps.SPEED >= 3) //行驶中 { CarState = CarState.Run; } else { //速度小于3km/h 认定为停车(可去除部分漂移) CarState = CarState.Stop; } } } else { //不在线状态判断 CarState = CarState.OffLine; } if (noWeb) { return(true); } if (!gps.IsRealTime) { return(true); } if (CarStatus.blindarea_status) { return(true); } if (!NEWTRACK.IsWebPosition) { return(true); } if (!IsInView) { return(true); } if (!GPSTool.CheckLaLo(gps.LATITUDE, gps.LONGITUDE)) { return(true); } GeoLatLng geo = GPSTool.wgs84togcj02(gps.LONGITUDE, gps.LATITUDE); geo.longitude = Math.Round(geo.longitude, 6); geo.latitude = Math.Round(geo.latitude, 6); Common_liby.InvokeMethodOnMainThread(() => { HtmlPage.Window.Invoke("GetWebPosition", geo.longitude, geo.latitude, MAC); }); return(false); }
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 }