public ConnectionViewModel() { _connection = new BbsfwConnection(); _connection.Connected += OnConnected; _connection.Disconnected += OnDisconnected; _connection.EventLog += (e) => { EventLogReceived?.Invoke(e); }; ComPorts = BbsfwConnection.GetComPorts(); }
public override void ResponseReceived(byte[] parameter) { switch ((EventLogCommunication)parameter[0]) { case EventLogCommunication.ResponseEventLogEntries: var serializer = new Serializer(typeof(List <EventLogEntry>)); var entries = serializer.Deserialize <List <EventLogEntry> >(parameter, 5); var index = BitConverter.ToInt32(parameter, 1); EventLogReceived?.Invoke(this, new EventLogReceivedEventArgs(entries, index)); LogService.Receive(string.Format((string)Application.Current.Resources["ReceivedEventLog"], entries.Count)); break; case EventLogCommunication.ResponseNoAdministratorRights: LogService.Error((string)Application.Current.Resources["NoAdminPrivileges"]); break; default: throw new ArgumentOutOfRangeException(); } }