public RecordViewModel(IObd2Connection connection) { PlotViewModel = new PlotViewModel(); Start = new DelegateCommand(StartRecording, () => this.state == RecordingState.NotStarted).ObservesProperty(() => State); Pause = new DelegateCommand(PauseRecording, () => this.state == RecordingState.Recording).ObservesProperty(() => State); Resume = new DelegateCommand(ResumeRecording, () => this.state == RecordingState.Paused).ObservesProperty(() => State); Finish = new DelegateCommand(CompleteRecording, () => this.state == RecordingState.Paused).ObservesProperty(() => State); this.obd2interface = new Obd2Interface(connection); }
public ResponseType Send(IObd2Connection connection) { byte[] query = this.ToBytes(); connection.Write(query); byte[] response = connection.Read(Response.ResponseNumberOfBytes); ResponseType r = new ResponseType(); r.Bytes = response; if (r.NumberOfAdditionalDataBytes != 0) { Debug.WriteLine("Need to read more bytes"); } return(r); }
partial void ConnectClicked(Foundation.NSObject sender) { this.ConnectionProgressIndicator.StartAnimation(this); this.ConnectionStatus.StringValue = "Connecting..."; this.ConnectionStatus.TextColor = NSColor.Black; Task.Run(() => { this.connection = new Obd2TcpConnection(); }).ContinueWith(t => { //this.ConnectionStatus.StringValue = "Connected"; //this.ConnectionStatus.TextColor = NSColor.Green; //this.ConnectionProgressIndicator.StopAnimation(this); }, TaskContinuationOptions.NotOnFaulted).ContinueWith(t => { //this.ConnectionStatus.StringValue = "Could not connect"; //this.ConnectionStatus.TextColor = NSColor.Red; //this.ConnectionProgressIndicator.StopAnimation(this); }, TaskContinuationOptions.OnlyOnFaulted); }
public abstract void Refresh(IObd2Connection connection);
public Obd2Interface(IObd2Connection connection) { this.connection = connection; }