private void UpdateTrackSource(VehicleStateService source) { foreach (ToolStripMenuItem item in buttonTrackSource.DropDownItems) { item.Checked = item.Tag == source; } }
private void InitializeServices() { Services.MapService = drawingSurface; Services.RunControlService.RunModeChanged += new EventHandler(RunControlService_RunModeChanged); VehicleStateService posteriorPoseService = new VehicleStateService("posterior pose", OperationalInterface.Dataset.ItemAs<double>("posterior heading"), OperationalInterface.Dataset.ItemAs<Coordinates>("posterior pose")); VehicleStateService poseService = new VehicleStateService("pose", OperationalInterface.Dataset.ItemAs<double>("heading"), OperationalInterface.Dataset.ItemAs<Coordinates>("xy")); stateServices = new List<VehicleStateService>(); stateServices.Add(posteriorPoseService); stateServices.Add(poseService); foreach (VehicleStateService stateService in stateServices) { ToolStripMenuItem item = new ToolStripMenuItem(stateService.Name, null, trackService_Click); item.Tag = stateService; buttonTrackSource.DropDownItems.Add(item); } // initialize state service to posterior pose Services.VehicleStateService = posteriorPoseService; UpdateTrackSource(posteriorPoseService); }