/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { instance = this; // this sets the static Instance property to this instance. Plugins = new ObservableCollection<PluginBase>(); Devices = new ObservableCollection<Device>(); Motors = new ObservableCollection<MotorViewModel>(); Plugins.CollectionChanged += Plugins_CollectionChanged; Controllers = new ObservableCollection<ControllerViewModel>(); Controllers.CollectionChanged += Controllers_CollectionChanged; Robot = new Robot(); // This lets us know what's going on with the Robot's internal Joint collection. Robot.Controllers.CollectionChanged += RobotControllers_CollectionChanged; //InputSignalRegistry = new ViewModel.SignalSinkRegistryViewModel(); InputSignalRegistry = new ObservableDictionary<string, string>(); Messenger.Default.Register<Messages.RemoveController>(this, (message) => { Controllers.Remove(message.ControllerToRemove); com = this.Robot.Com; } ); }
static void Main(string[] args) { _robot = new Robot(); _tmr = new Timer(TmrOnElapsed, null, Timeout.Infinite, Timeout.Infinite); TcpListener listen = new TcpListener(13); listen.Start(); while (true) { Console.WriteLine("Warte auf Verbindung auf Port " + listen.LocalEndpoint + "..."); TcpClient client = listen.AcceptTcpClient(); Console.WriteLine("Verbindung zu " + client.Client.RemoteEndPoint); _tmr.Change(3000, Timeout.Infinite); _robot.RobotConsole[Leds.Led1].LedEnabled = true; StreamWriter sw = new StreamWriter(client.GetStream()); sw.Write(DateTime.Now.ToString(CultureInfo.InvariantCulture)); sw.Flush(); client.Close(); } }