public MainWindowController() { ClientTCP client = ClientTCP.getInstance(); try { client.connectionStatusUpdated += delegate(object sender, PropertyChangedEventArgs args) { App.Current.Dispatcher.Invoke(delegate { if (args.PropertyName == "disconnected") { backgroundColor = Brushes.Gray; } else { backgroundColor = Brushes.Turquoise; } }); }; if (client.isConnected) { client.isConnected = true; } else { client.isConnected = false; } } catch (Exception e) { Console.WriteLine(e.Message); } }
public LogModel() { logList = new ObservableCollection <LogEntry>(); ClientTCP client = ClientTCP.getInstance(); if (client.isConnected) { ClientTCP.OnMessageReceived += UpdateLogs; client.sendCommand(CommandEnum.LogCommand.ToString()); } }
public static ClientTCP getInstance() { if (instance == null) { lock (locker) { if (instance == null) { instance = new ClientTCP(); } } } return(instance); }
public SettingsModel() { client = ClientTCP.getInstance(); if (client.isConnected) { ClientTCP.OnMessageReceived += UpdateHandlers; ClientTCP.OnMessageReceived += UpdateSettingsMap; outputDirectory = new SettingsEntry(null); sourceName = new SettingsEntry(null); logName = new SettingsEntry(null); thumbnailSize = new SettingsEntry(null); client.sendCommand(CommandEnum.GetConfigCommand.ToString()); } }