private void btnDisplayLine_Click(object sender, EventArgs e) { List<SearchLocation> locations = new List<SearchLocation>(); foreach (string line in txtAddresses.Lines) { SearchLocation a = new SearchLocation(); a.Where = line; // where to search for (address) locations.Add(a); } ucVEarth.VE_AddShape(VE_Shape.Polyline, locations, "My Path", "A sample path", "", 10); }
private void btnDisplayPolygon_Click(object sender, EventArgs e) { List<SearchLocation> locations = new List<SearchLocation>(); if (txtAddresses.Lines.Length < 3) { MessageBox.Show("To create a polygon a minimum of 3 points is needed"); } else { foreach (string line in txtAddresses.Lines) { SearchLocation a = new SearchLocation(); a.Where = line; // where to search for (address) locations.Add(a); } ucVEarth.VE_AddShape(VE_Shape.Polygon, locations, "My Polygon", "A sample polygon", "", 10); } }
/// <summary> /// Display pushpins for all adresses in the textbox /// </summary> private void btnDisplayAddresses_Click(object sender, EventArgs e) { // For demo pusposes, add the pushpins to a layer named "Test" ucVEarth.VE_AddShapeLayer("Test", "Test"); // Create a list of locations to search for List<SearchLocation> locations = new List<SearchLocation>(); foreach (string line in txtAddresses.Lines) { SearchLocation a = new SearchLocation(); a.Where = line; // where to search for (address) a.PushPinDescription = line; a.PushPinLayer = "Test"; a.PushPinTitle = line; // Title of the puspin locations.Add(a); } // find and display the locations, during the seacht the latitude and Longitude of each SearchLocation object is // set, so VEarth knows where to place the pushpins ucVEarth.VE_FindLocations(locations, true, true, null); }
/// <summary> /// Vul de default properties in de propertybag. /// </summary> /// <param name="context">The MonoRail request context</param> /// <param name="controller">The controller instance</param> /// <param name="controllerContext">The controller context.</param> /// <returns> /// <c>true</c> if the request should proceed, otherwise <c>false</c> /// </returns> protected override bool OnBeforeAction(IEngineContext context, IController controller, IControllerContext controllerContext) { IList<Project> projecten = new List<Project>(); Gebruiker ingelogdeGebruiker = (Gebruiker)context.CurrentUser; /* TODO:hier moet een lijstje inkomen met jou eigen lijst met projecten */ foreach (SprintGebruiker sprintGebruiker in ingelogdeGebruiker.SprintGebruikers) { if (!projecten.Contains(sprintGebruiker.Sprint.Project)) projecten.Add(sprintGebruiker.Sprint.Project); if(projecten.Count > 3) { break; } } controllerContext.PropertyBag.Add("projects", projecten); return true; }
/// <summary> /// Get the driving directions for the adresses in the listbox (the API has a maximum of 50 addressen) /// </summary> private void btnGetDirections_Click(object sender, EventArgs e) { ucVEarth.VE_DeleteDirections(); // Add the start and end point List<SearchLocation> locations = new List<SearchLocation>(); foreach (string line in txtAddresses.Lines) { SearchLocation a = new SearchLocation(); a.Where = line; // where to search for (address) locations.Add(a); } //Clear current directions lvDirections.Items.Clear(); // Get and display driving directions RouteDirections rd = ucVEarth.VE_GetDirections(locations, true, true, VEarth.ucVEarth.RouteModeEnum.Driving, VEarth.ucVEarth.DistanceUnitEnum.Kilometers, ucVEarth.RouteOptimizeEnum.Distance ); lvDirections.Items.Add(String.Format("Total distance: {0}", rd.TotalDistance)); lvDirections.Items.Add(String.Format("Total duration: {0}", GetDurationAsText(rd.TotalDuration))); lvDirections.Items.Add(""); decimal totalDistance = 0; double totalDuration = 0; // Iterate through all route parts foreach(RouteLeg rl in rd.RouteLegs) { totalDistance += rl.Distance; totalDuration += rl.Duration; ListViewItem direction = new ListViewItem(rl.Description); direction.SubItems.Add(rl.Distance.ToString()); direction.SubItems.Add(GetDurationAsText(rl.Duration)); direction.SubItems.Add(totalDistance.ToString()); direction.SubItems.Add(GetDurationAsText(totalDuration)); lvDirections.Items.Add(direction); } }
/// <summary> /// Constructor used to initialize TheCompany class attributes. /// </summary> public TheCompany() { databaseContainer = new List<Employee>(); databaseFile = new FileIO(); logfile = new Logging(); }
private void AddMessageToPropertyBag(string message, string Type) { List<string> messages = new List<string>(); if (PropertyBag.Contains(Type) && PropertyBag[Type] != null) { messages.AddRange((IEnumerable<string>) PropertyBag[Type]); } if (string.IsNullOrEmpty(message)) return; messages.Add(message); PropertyBag[Type] = messages; }
private void AddMessageToFlashBag(string message, string Type) { List<string> messages = new List<string>(); if (Flash.Contains(Type) && Flash[Type] != null) { messages.AddRange((IEnumerable<string>) Flash[Type]); } if (string.IsNullOrEmpty(message)) return; messages.Add(message); Flash[Type] = messages; }