static void Main(string[] args) { TelemClient client = new TelemClient(); Container baselevel = new Container(); client.AddTarget(baselevel); client.OnMeasurementDelta += client_OnMeasurementDelta; for(;;) { Console.Write("tt>"); String command = Console.ReadLine(); if(command == "set") { Console.Write("Enter path>"); string path = Console.ReadLine(); PropertyInfo info; Tuneable tunable; if (client.TuneableExists(path, out info, out tunable)) { TuneRequest req = new TuneRequest(); req.path = path; Type type = info.PropertyType; Console.Write("Enter value ({0})>", type.ToString()); if (type == typeof(string)) { req.value = Console.ReadLine(); } else if (type == typeof(Double)) { req.value = Double.Parse(Console.ReadLine()); } else { Console.WriteLine("Unsupported type"); } client.AddTuneRequest(req); } else { Console.WriteLine("Unknown tuneable \"{0}\"", path); } } else if (command == "run" || command == "") { baselevel.sigGen.DoTimestep(baselevel.Timestep); client.UpdateTune(); client.Timeslice(); } else if (command == "exit") { Console.WriteLine("Bye"); break; } else { Console.WriteLine("Unknown command \"{0}\"", command); } Console.WriteLine(); } }
/// <summary> /// Adds a tune request object to the list. Run UpdateTune to apply the upadates. /// </summary> public void AddTuneRequest( TuneRequest request ) { tunerequests.Add(request); }