public SampleOne() { InitializeComponent(); if (File.Exists("sampleone.xls")) { try { ModelOne[] list; using (var factory = new ObjectFactory("sampleone.xls")) { list = factory.SheetToObjects <ModelOne>(); dataGridView1.DataSource = list; } using (var factory = new DrawingFactory(string.Format("{0}.xlsx", DateTime.Now.ToFileTimeUtc()))) { factory.Draw(0, "Sheet0", list); } } catch (Exception e) { MessageBox.Show(e.Message); } } else { MessageBox.Show("no find sampleone.xls file."); } }
private void GenerateMarkers() { var events = FilterEvents(); if (events == null) { return; } for (var i = 0; i < events.Count; i++) { Monitor.AddMarkers(Layers.Eventos, new Marker(i.ToString("#0"), GetIconUrl(events[i]), events[i].InitialLatitude, events[i].InitialLongitude, string.Format("javascript:gMP('{0}','{1}','{2}','{3}','{4:0.00}','{5}','{6}','{7}')", events[i].InitialLatitude.ToString(CultureInfo.InvariantCulture), events[i].InitialLongitude.ToString(CultureInfo.InvariantCulture), string.Concat(events[i].InitialDate.ToDisplayDateTime().ToShortDateString(), " ", events[i].InitialDate.ToDisplayDateTime().TimeOfDay.ToString()), events[i].ElapsedTime, events[i].Distance, events[i].MinimumSpeed, events[i].MaximumSpeed, Convert.ToInt32(events[i].AverageSpeed)), DrawingFactory.GetSize(24, 24), GetMarkerOffset(events[i]))); } var centerIndex = RouteCenterIndex; if (centerIndex == null) { return; } _x = events[centerIndex.Value].InitialLatitude; _y = events[centerIndex.Value].InitialLongitude; Monitor.TriggerEvent(centerIndex.ToString(), Layers.Eventos, PopupEvent); }
protected void AddMarker(EntidadPadre entidad, string style) { if (entidad != null) { var icono = IconDir; if (entidad.ReferenciaGeografica != null && entidad.ReferenciaGeografica.Icono != null) { icono += entidad.ReferenciaGeografica.Icono.PathIcono; } var desc = entidad.Descripcion; var refGeo = entidad.ReferenciaGeografica; var vehiculoAsociado = DAOFactory.CocheDAO.FindMobileByDevice(entidad.Dispositivo.Id); var ultimaPosicion = vehiculoAsociado != null?DAOFactory.LogPosicionDAO.GetLastVehiclesPositions(new List <Coche> { vehiculoAsociado })[vehiculoAsociado.Id] : null; var latitud = ultimaPosicion != null ? ultimaPosicion.Latitud : refGeo != null ? refGeo.Latitude : 0; var longitud = ultimaPosicion != null ? ultimaPosicion.Longitud : refGeo != null ? refGeo.Longitude : 0; var marker = MarkerFactory.CreateLabeledMarker(entidad.Id.ToString("#0"), icono, latitud, longitud, desc, style, GetMovilPopupContent(entidad)); if (refGeo != null && refGeo.Icono != null) { marker.Size = DrawingFactory.GetSize(refGeo.Icono.Width, refGeo.Icono.Height); marker.Offset = DrawingFactory.GetOffset(refGeo.Icono.OffsetX, refGeo.Icono.OffsetY); } Monitor.AddMarkers(LayerEntidades, marker); } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { this.iOSUIAppearance = null; this._iOSDrawingFactory = null; } }
private void Initialize() { this.BackgroundColor = UIColor.Clear; this.HasBorder = true; this.BorderWidth = iOSUIAppearance.GlobaliOSTheme.ButtonBorderWidth; this.HasRoundedCorners = true; this.EnableHold = true; this.AutoApplyUI = true; _iOSDrawingFactory = iOSCoreServiceContainer.Resolve <DrawingFactory>(); }
private void DrawSimulation(Graphics g) { foreach (var item in Simulation.Items) { var draw = DrawingFactory.GetDrawingInstance(item); if (draw != null) { draw.Paint(g); } } }
private void AddFlags(IList <List <RoutePosition> > routes) { var start = routes[0][0]; var end = routes[routes.Count - 1][routes[routes.Count - 1].Count - 1]; var size = DrawingFactory.GetSize(40, 40); var offset = DrawingFactory.GetOffset(-20, -32); Monitor.AddMarkers(Layers.Eventos, new Marker(start.Date.ToDisplayDateTime().ToString(), Images.Start, start.Latitude, start.Longitude, string.Format("javascript:gFP('{0}')", string.Concat(start.Date.ToDisplayDateTime().ToShortDateString(), " ", start.Date.ToDisplayDateTime().TimeOfDay.ToString())), size, offset), new Marker(end.Date.ToDisplayDateTime().ToString(), Images.End, end.Latitude, end.Longitude, string.Format("javascript:gFP('{0}')", string.Concat(end.Date.ToDisplayDateTime().ToShortDateString(), " ", end.Date.ToDisplayDateTime().TimeOfDay.ToString())), size, offset)); }
public FormSample() { InitializeComponent(); TestModel[] locationList; using (var factory = new ObjectFactory("input.xls")) { locationList = factory.SheetToObjects<TestModel>(); dataGridView1.DataSource = locationList; } using (var factory = new DrawingFactory(string.Format("{0}.xls", DateTime.Now.ToFileTimeUtc()))) { factory.Draw(0, "Sheet0", locationList); } }
private static string GetMarkerOffset(RouteEvent routeEvent) { if (routeEvent.MaximumSpeed == 0) { return(DrawingFactory.GetOffset(-12, -12)); } const int desplazamiento = 10; var angulo = (-(routeEvent.Direction - 90) * 2 * Math.PI) / 360; var dx = Math.Cos(angulo) * desplazamiento; var dy = Math.Sin(angulo) * desplazamiento; return(DrawingFactory.GetOffset(-12 + dx, -12 - dy)); }
protected void btMapa_Command(object sender, CommandEventArgs e) { var pos = e.CommandArgument.ToString().Split(','); var lat = Convert.ToDouble(pos[0], CultureInfo.InvariantCulture); var lon = Convert.ToDouble(pos[1], CultureInfo.InvariantCulture); var icn = string.Concat(ImagesDir, "salida.png"); var size = DrawingFactory.GetSize(40, 40); var offset = DrawingFactory.GetOffset(-20, -32); var marker = new Marker("0", icn, lat, lon, size, offset); Monitor1.AddMarkers("Posicion", marker); Monitor1.SetCenter(lat, lon, 12); modalMapa.Show(); ScriptManager.RegisterStartupScript(this, typeof(string), "hidemap", string.Format("$get('{0}').style.visibility = '';", divMapa.ClientID), true); }
protected void AddMarker(EntregaDistribucion item, string imageUrl) { if (item.ReferenciaGeografica == null) { return; } var id = item.Id.ToString("0"); var latitud = item.ReferenciaGeografica.Latitude; var longitud = item.ReferenciaGeografica.Longitude; var label = item.Programado.ToString("HH:mm"); var marker = MarkerFactory.CreateLabeledMarker("m" + id, imageUrl, latitud, longitud, label); marker.Size = DrawingFactory.GetSize(20, 20); marker.Offset = DrawingFactory.GetOffset(-10, -10); Monitor1.AddMarkers(LayerEntregas, marker); }
private void AddMarker() { monitor.ClearLayer(LayerPoi); var dir = DireccionSearch1.Selected; if (dir == null) { return; } var marker = new Marker("1", IconPath, dir.Latitud, dir.Longitud, DrawingFactory.GetSize(IconWidth, IconHeight), DrawingFactory.GetOffset(IconOffsetX, IconOffsetY)); monitor.AddMarkers(LayerPoi, marker); SetCenter(dir.Latitud, dir.Longitud); monitor.ZoomTo(11); }
/// <summary> /// Returns a mark annotation as <see cref="IGraphicsPath"/> in content space. /// </summary> public virtual IGraphicsPath GetAsGraphicsPath(DrawingFactory drawingFactory) { IGraphicsPath path = drawingFactory.CreateGraphicsPath(); PointF[] referencePoints = MarkAnnoData.GetReferencePointsInContentSpace(); switch (MarkAnnoData.MarkType) { case MarkAnnotationType.Tick: path.AddCurve(referencePoints); break; default: path.AddPolygon(referencePoints); break; } return(path); }
private void AddReferenciaGeografica(string layerPoi, string layerArea, ReferenciaGeografica dom, string popupContent) { if (dom.Poligono != null) { var center = dom.Poligono.FirstPoint; var col = StyleFactory.GetPointFromColor(dom.Color.Color); var id = dom.Id + "_GEO"; if (dom.Poligono.Radio > 0) { Monitor.AddGeometries(layerArea, new Point(id, center.X, center.Y, dom.Poligono.Radio, col)); } else { var points = dom.Poligono.ToPointFList(); var poly = new Polygon(id, col); for (var i = 0; i < points.Count; i++) { poly.AddPoint(new Point(id + "_" + i, points[i].X, points[i].Y)); } Monitor.AddGeometries(layerArea, poly); } } if (dom.Direccion == null) { return; } var icono = dom.Icono != null ? IconDir + dom.Icono.PathIcono : string.Empty; var marker = new Marker(dom.Id.ToString("#0"), icono, dom.Direccion.Latitud, dom.Direccion.Longitud, popupContent, DrawingFactory.GetSize(dom.Icono != null ? dom.Icono.Width : 0, dom.Icono != null ? dom.Icono.Height : 0), DrawingFactory.GetOffset(dom.Icono != null ? dom.Icono.OffsetX : 0, dom.Icono != null ? dom.Icono.OffsetY : 0)); Monitor.AddMarkers(layerPoi, marker); }
private void GetCenter(IEnumerable <List <RoutePosition> > routes) { var centerPosition = PosCenterIndex; if (centerPosition == null) { return; } foreach (var position in routes.SelectMany(route => route.Where(position => position.Id.Equals(centerPosition.Value)))) { Monitor.AddMarkers(Layers.Eventos, new Marker(position.Date.ToDisplayDateTime().ToString(), Images.CurrentPosition, position.Latitude, position.Longitude, string.Format("javascript:gCP('{0}', '{1}', '{2}')", GeocoderHelper.GetDescripcionEsquinaMasCercana(position.Latitude, position.Longitude), position.Date.ToDisplayDateTime(), position.Speed), DrawingFactory.GetSize(21, 25), DrawingFactory.GetOffset(-10.5, -25))); _x = position.Latitude; _y = position.Longitude; Monitor.TriggerEvent(position.Date.ToDisplayDateTime().ToString(), Layers.Eventos, PopupEvent); } }
private void Initialize() { this.iOSUIAppearance = iOSCoreServiceContainer.Resolve <iOSUIManager>(); this._iOSDrawingFactory = iOSCoreServiceContainer.Resolve <DrawingFactory>(); this.colorNormalSVGColor = iOSUIAppearance.GlobaliOSTheme.ButtonNormalSVGUIColor.Value; this.colorButtonBGStart = iOSUIAppearance.GlobaliOSTheme.ButtonNormalBGUIColor.Value; this.colorButtonBGEnd = iOSUIAppearance.GlobaliOSTheme.ButtonNormalBGUIColorTransition.Value; this.SetTitleColor(iOSUIAppearance.GlobaliOSTheme.ButtonNormalTitleUIColor.Value, UIControlState.Normal); this.SetTitleColor(iOSUIAppearance.GlobaliOSTheme.ButtonPressedTitleUIColor.Value, UIControlState.Highlighted); this.SetTitleColor(iOSUIAppearance.GlobaliOSTheme.ButtonPressedTitleUIColor.Value, UIControlState.Focused); this.BorderColor = iOSUIAppearance.GlobaliOSTheme.ButtonNormalTitleUIColor.Value.CGColor; this.BorderWidth = iOSUIAppearance.GlobaliOSTheme.ButtonBorderWidth; this.CornerRadius = this.iOSUIAppearance.GlobaliOSTheme.ButtonCornerRadius; this.MenuCornerRadius = this.iOSUIAppearance.GlobaliOSTheme.ButtonMenuCornerRadius; this.BackgroundColor = iOSUIAppearance.GlobaliOSTheme.ButtonNormalBGUIColor.Value; this.EnableHold = true; this.AutoApplyUI = true; }
private void GetReferenciasGeograficas() { var pois = !PoisTypesIds.Contains(0) ? DAOFactory.ReferenciaGeograficaDAO.GetList(new[] { Distrito }, new[] { Location }, PoisTypesIds).Where(x => x.Vigencia == null || x.Vigencia.Vigente(InitialDate, FinalDate)).ToList() : new List <ReferenciaGeografica>(); foreach (var punto in pois) { if (punto.Poligono != null) { DrawGeocerca(punto); } if (punto.Direccion != null) { Monitor.AddMarkers(Layers.PuntosDeInteres, new Marker(punto.Id.ToString("#0"), GetPoiIcon(punto), punto.Direccion.Latitud, punto.Direccion.Longitud, string.Format("javascript:gPOIP('{0}')", punto.Descripcion), DrawingFactory.GetSize(24, 24), DrawingFactory.GetOffset(-12, -12))); } } }
// This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Falling rock style! #region Setup // Setup services and globals for iOS // Create iOSCore globals this._iOSGlobals = new AspyRoad.iOSCore.AspyGlobals(); // Create our appwide user setup settings //this._numeracyUIManager = new NumeracyUIManager(this.iOSGlobals); // Create shared globals this._sharedGlobals = new NathansWay.Numeracy.Shared.SharedGlobal(); // Create our application settings. These are settings that are global to Numbers Application only. this._numberAppSettings = new NathansWay.Numeracy.Shared.NWNumberAppSettings(); // Load our storyboard and setup our UIWindow and first view controller _storyBoard = UIStoryboard.FromName("NathansWay.Numeracy", null); iOSCoreServiceContainer.Register <UIStoryboard> (_storyBoard); // Number factory relies on Storyboard so load it first this._NumletFactory = new Lazy <UINumberFactory>(() => new UINumberFactory()); // Set SharedGlobals for the Shared lib // This must be done for each device being built this._sharedGlobals.GS__RootAppPath = Environment.CurrentDirectory; // Db Name this._sharedGlobals.GS__DatabaseName = "Nathansway.db3"; // Documents folder this._sharedGlobals.GS__DocumentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Library folder this._sharedGlobals.GS__FolderNameLibrary = Path.Combine(this._sharedGlobals.GS__DocumentsPath, "../Library/"); // Full db path this._sharedGlobals.GS__FullDbPath = Path.Combine(this._sharedGlobals.GS__DocumentsPath, this._sharedGlobals.GS__DatabaseName); // Copy the database if needed // For building we ALWAYS copy the db as we need to capture build changes. //this.CopyDb(); this.ExplcitCopyDb(); // Apply user based app settings // Depending on student, teahcer etc some of these will change at log in, but we will set defaults here. // TODO : These will need to be loaded from a database as they will be different for each student // But not all need to be saved? this._numberAppSettings.GA__NumberEditMode = G__NumberEditMode.EditNumPad; //this._numberAppSettings.GA__NumberEditMode = G__NumberEditMode.EditScroll; //this._numberAppSettings.GA__NumberEditMode = G__NumberEditMode.EditUpDown; this._numberAppSettings.GA__NumberDisplaySize = G__DisplaySizeLevels.Level5; this._numberAppSettings.GA__NumberLabelDisplaySize = G__DisplaySizeLevels.Level3; this._numberAppSettings.GA__MoveToNextNumber = true; this._numberAppSettings.GA__ShowAnswerNumlet = true; this._numberAppSettings.GA__SingleDigitErrorUIDisplay = false; this._numberAppSettings.GA__PersistUICorrectStateOnMove = true; this._numberAppSettings.GA__PersistUIInCorrectStateOnMove = true; this._numberAppSettings.GA__ToStringReturnsCurrentValue = false; this._numberAppSettings.GA__FreeFromModeActive = false; this._numberAppSettings.GA__DecimalPrecission = 2; // Set AspyiOSCore global variables here.... this._iOSGlobals.G__ViewAutoResize = UIViewAutoresizing.None; this._iOSGlobals.G__InitializeAllViewOrientation = true; this._iOSGlobals.G__ViewOrientation = G__Orientation.Landscape; this._iOSGlobals.G__ShouldAutorotate = false; this._iOSGlobals.G__SegueingAnimationDuration = 0.8; this._iOSGlobals.G__PrefersStatusBarHidden = true; // Orientation handlers two types depending on iOS version // iOS 6 and above >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> this._iOSGlobals.G__6_SupportedOrientationMasks = UIInterfaceOrientationMask.Landscape; // You can use bitwise operators on these // NOTE : I couldnt get the bitwise versions to compare, not sure why, so I assume that Lanscapeleft and right are the same // Doesnt really matter as its only for iOS5. // in the autorotate function for iOS5 // Eg = UIInterfaceOrientation.LandscapeRight | UIInterfaceOrientation.LandscapeLeft // iOS 5 and below >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> this._iOSGlobals.G__5_SupportedOrientation = UIInterfaceOrientation.LandscapeLeft; // Register any Shared services needed SharedServiceContainer.Register <ISharedGlobal>(this._sharedGlobals); // Set Sqlite db Platform this._iOSSQLitePLatform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(); // Set up a database context this._DbContext = new NumeracyDB(this._iOSSQLitePLatform, this._sharedGlobals.GS__FullDbPath); // Platform lib needed by the constructor for SQLite Shared SharedServiceContainer.Register <ISQLitePlatform>(this._iOSSQLitePLatform); // Register the database connection SharedServiceContainer.Register <INWDatabaseContext>(this._DbContext); // Register any iOS services needed iOSCoreServiceContainer.Register <IAspyGlobals> (this._iOSGlobals); // Register our Numberappwide setings SharedServiceContainer.Register <IAppSettings> (this._numberAppSettings); // Application Services, Factories // Dimensions Class this._numberDimensions = new iOSNumberDimensions(G__DisplaySizeLevels.Level5, this._iOSGlobals); iOSCoreServiceContainer.Register <iOSNumberDimensions> (this._numberDimensions); // Build a ToolBoxFactory this._toolBuilder = new Lazy <ToolFactory> (() => new ToolFactory()); iOSCoreServiceContainer.Register <ToolFactory> (this._toolBuilder.Value); // Build a NumletFactory // Numlets are the most basic workspace, the contain any expression // A workspace is made up of one to [n] numlets iOSCoreServiceContainer.Register <UINumberFactory> (this._NumletFactory.Value); #endregion #region Setup UI // TODO : Remove and insert this into .ctor code for lesson UI startup // // Start a toolfactory // ITool hammer; // hammer = ToolBuilder.CreateNewTool(E__ToolBoxToolz.Hammerz); // // AspyViewController _vcHammer = hammer.MainGame.Services.GetService<AspyViewController>(); // // // Temp workspace setup code. Mormally this will be behind a menu button. // vcWorkSpace _workspace = new vcWorkSpace(); // //vcMainGame _maingame = new vcMainGame(); // vcMainWorkSpace _mainworkspace = new vcMainWorkSpace(); // // ViewContainerController = new AspyViewController(); // ViewContainerController.AddAndDisplayController(_vcHammer); // ViewContainerController.AddAndDisplayController(_mainworkspace); // //ViewContainerController.View.AddSubview(_mainworkspace.ChildViewControllers[0].View); // // window.RootViewController = ViewContainerController; // //window.RootViewController = _mainworkspace; //Setup UIManager this.SetUpUI(); // Setup the window _window = new AspyWindow(UIScreen.MainScreen.Bounds); // _window = new iOSGameWindow(UIScreen.MainScreen.Bounds); // Register our window iOSCoreServiceContainer.Register <AspyWindow> (_window); // Setup view controllers //_mainNavigator = storyboard.InstantiateInitialViewController() as UINavigationController; //_mainController = storyboard.InstantiateViewController("vcMainContainer") as vcMainContainer; _mainContainer = new vcMainContainer(); // Use storyboard ids to create VCs //_menuStart = new vcMenuStart(); //_menuStart = storyboard.InstantiateViewController("vcMenuStart") as vcMenuStart; //_menuStart = storyboard.InstantiateViewController("vcLessonMenu") as vcLessonMenu; //Add our navigation object to the service library iOSCoreServiceContainer.Register <vcMainContainer> (_mainContainer); // The drawing factory needs to know of MainController hence its position here...after maincontainers creation this._drawingFunctions = new DrawingFactory(); iOSCoreServiceContainer.Register <DrawingFactory>(_drawingFunctions); //window.MakeKeyAndVisible(); _window.RootViewController = _mainContainer; //window.RootViewController = _menuStart; _window.MakeKeyAndVisible(); //_mainController.AddAndDisplayController(_menuStart); //window.MakeKeyAndVisible(); #endregion return(true); }
private void GetMessages() { var messages = lbMessages.SelectedStringValues; if (MessagesIds.Count == 0 && messages.Count == 0) { return; } var empresa = DAOFactory.EmpresaDAO.FindById(ddlDistrito.Selected); var maxMonths = empresa != null && empresa.Id > 0 ? empresa.MesesConsultaPosiciones : 3; var events = DAOFactory.LogMensajeDAO.GetByMobilesAndTypes(ddlMovil.SelectedValues, GetSelectedMessagesCodes(messages), InitialDate, FinalDate, maxMonths); for (var i = 0; i < events.Count(); i++) { var el = events.ElementAt(i); if (!el.HasValidLatitudes()) { continue; } var messageIconUrl = el.GetIconUrl(); var iconUrl = string.IsNullOrEmpty(messageIconUrl) ? Images.DefaultMessage : string.Concat(IconDir, messageIconUrl); Monitor.AddMarkers(Layers.Mensajes, new Marker(i.ToString("#0"), iconUrl, el.Latitud, el.Longitud, string.Format("javascript:gMSP({0})", el.Id), DrawingFactory.GetSize(24, 24), DrawingFactory.GetOffset(-12, -12))); //if (el.HasDuration()) AddMessageWithElapsedTime(el); } SetMessagesCenterIndex(events); }
private void GetReferenciasGeograficas() { var pois = !PoisTypesIds.Contains(0) ? DAOFactory.ReferenciaGeograficaDAO.GetList(new[] { Distrito }, new[] { Location }, PoisTypesIds).Where(x => x.Vigencia == null || x.Vigencia.Vigente(InitialDate, FinalDate)).ToList() : new List <ReferenciaGeografica>(); if (pois.Count == 0 && lstTicket.SelectedValue != "") { var value = lstTicket.SelectedValue.Contains("T-") || lstTicket.SelectedValue.Contains("V-") ? Convert.ToInt32((string)lstTicket.SelectedValue.Split('-')[1]) : Convert.ToInt32((string)lstTicket.SelectedValue); if (value > 0 && lstTicket.SelectedValue.Contains("T-")) { var ticket = DAOFactory.TicketDAO.FindById(value); pois.Add(ticket.Linea.ReferenciaGeografica); pois.Add(ticket.PuntoEntrega.ReferenciaGeografica); } if (value > 0 && lstTicket.SelectedValue.Contains("V-")) { var viaje = DAOFactory.ViajeDistribucionDAO.FindById(value); pois.Add(viaje.Linea.ReferenciaGeografica); pois.AddRange(viaje.Detalles.Select(detalle => detalle.ReferenciaGeografica)); } } foreach (var punto in pois) { if (punto.Poligono != null) { DrawGeocerca(punto); } if (punto.Direccion != null) { Monitor.AddMarkers(Layers.PuntosDeInteres, new Marker(punto.Id.ToString("#0"), GetPoiIcon(punto), punto.Direccion.Latitud, punto.Direccion.Longitud, string.Format("javascript:gPOIP('{0}')", punto.Descripcion), DrawingFactory.GetSize(24, 24), DrawingFactory.GetOffset(-12, -12))); } } }
//public virtual void Drawing() //{ //} #endregion #region Public Overrides //public override void Draw(CGRect rect) //{ // base.Draw(rect); // if (this._bEnableDrawing) // { // this.Drawing(); // } //} #endregion #region Private Members private void Initialize() { iOSUIAppearance = iOSCoreServiceContainer.Resolve <iOSUIManager> (); iOSDrawingFactory = iOSCoreServiceContainer.Resolve <DrawingFactory>(); }
/// <summary> /// Displays the last position reported by the givenn mobile or device. /// </summary> /// <param name="lastPosition"></param> private void DisplayPosition(MobilePosition lastPosition) { var id = lastPosition.IdPosicion.ToString(); var latitude = lastPosition.Latitud; var longitude = lastPosition.Longitud; var popup = string.Format("javascript:gPP('{0}','{1}','{2}','{3}','{4}','{5}')", lastPosition.EsquinaCercana, lastPosition.Interno, lastPosition.Responsable, lastPosition.Dispositivo, string.Concat(lastPosition.Fecha.Value.ToShortDateString(), "", lastPosition.Fecha.Value.TimeOfDay.ToString()), lastPosition.Velocidad); var marker = new Marker(id, CurrentPositionImgUrl, latitude, longitude, popup, DrawingFactory.GetSize(21, 25), DrawingFactory.GetOffset(-10.5, -25)); Monitor.AddMarkers(_posicion, marker); Monitor.SetCenter(latitude, longitude); Monitor.SetDefaultCenter(latitude, longitude); Monitor.TriggerEvent(id, _posicion, PopupEvent); }
public void AddMarkers() { var points = Points.Get(); if (points == null || points.Count == 0) { Monitor.ClearLayer(LayerMarkers); return; } var inicio = points.First(); var fin = points.Last(); var markIni = new Marker("inicio", ResolveUrl("~/images/salida.png"), inicio.Y, inicio.X, DrawingFactory.GetSize(32, 32), DrawingFactory.GetOffset(-16, -32)); var markFin = new Marker("fin", ResolveUrl("~/images/llegada.png"), fin.Y, fin.X, DrawingFactory.GetSize(32, 32), DrawingFactory.GetOffset(-16, -32)); Monitor.AddMarkers(LayerMarkers, markIni, markFin); }