public void Cleanup() { if (_model != null) { _model.Cleanup(); _model = null; } }
public ServerInfoControl(ServerInfo serverInfo) { InitializeComponent(); _model = new ServerMonitorModel(serverInfo, new Log()); this.DataContext = _model; //_model.Connect(); Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; }
private static void run(ServerMonitorModel model) { while (true) { if (!model.Connected) { model.Connect(); Console.WriteLine(@"Connectiong to {0}", model.CurrentServer.Name); } Thread.Sleep(123000); } }
private static ServerMonitorModel OpenServerInfo(ServerInfo obj, ILog log) { var model = new ServerMonitorModel(obj, log, true); model.ChatViewModel.ChatMessageEventHandler += (s, e) => { Console.WriteLine(@"{0} {1:t}:{2}", model.CurrentServer.Name, e.Date.ToLocalTime(), e.Message); Console.WriteLine(); }; return model; }