private void Button2_Click(object sender, RoutedEventArgs e) { byte[] data = byteEditor2.GetAllBytes(); if (data.Length <= 0 || data == null) { labelStatus.Content = "Insert data!"; MessageBox.Show("Please type something!", "Warning!", MessageBoxButton.OK, MessageBoxImage.Information); return; } CustomProtocol cp = new CustomProtocol(Command.SetEnginePattern, data); cp.AddAttribute("DataLength", data.Length.ToString()); cp.AddAttribute("Engine", comboBox.SelectedValue as String); UART.Send(cp); cp = UART.Receive(); if (cp.response == Response.Ok) { labelStatus.Content = "Engine " + comboBox.SelectedValue + " set!"; } }
private void Button2_Copy_Click(object sender, RoutedEventArgs e) { CustomProtocol cp = new CustomProtocol(Command.GetEnginePattern); cp.AddAttribute("Engine", comboBox.SelectedValue as String); UART.Send(cp); cp = UART.Receive(); if (cp.response == Response.Ok) { byteEditor2.Stream = new MemoryStream(cp.Data); } }