private void TransportAscii(string portName, int baudRate, int dataBits, Parity parity, StopBits stopBits) { Comm.Serial.TransportSerialAscii transportSerialAscii = new TransportSerialAscii(portName, baudRate, dataBits, parity, stopBits); string sendString = InputTextBlock.Text; transportSerialAscii.Transport(ref sendString, out var receiveData); OutputTextBlock.AppendText(receiveData + "\n"); }
public void FindTags(String fileContent) { // Pase URL's froms Site Map List <String> urlsList = parseUrls(fileContent); // Parse html pages ParseHtml(urlsList); OutputTextBlock.AppendText("Finished!\n Your file: " + FILE_LOCATION + "\nCount empty alt attributes = " + COUNT_EMPTY_TAGS); }
private void TransportRtu(string portName, int baudRate, int dataBits, Parity parity, StopBits stopBits) { Comm.Serial.TransportSerialByte transportSerialByte = new TransportSerialByte(portName, baudRate, dataBits, parity, stopBits); string sendString = InputTextBlock.Text; byte[] sendBytes = Comm.Convert.ConvertHexStringToBytes(sendString); transportSerialByte.Transport(ref sendBytes, out var receiveData); string receiveString = Comm.Convert.ConvertBytesToHexString(receiveData); OutputTextBlock.AppendText(receiveString + "\n"); }
private void updateJobOutputTextBlock(JobStreamGetResponse stream) { String streamText = stream.JobStream.Properties.StreamText; OutputTextBlockParagraph.Inlines.Add("\r\n"); if (stream.JobStream.Properties.StreamType == "Output") { OutputTextBlockParagraph.Inlines.Add(streamText); } else if (stream.JobStream.Properties.StreamType == "Verbose") { streamText = "VERBOSE: " + streamText; OutputTextBlockParagraph.Inlines.Add(new Run(streamText) { Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom(VerboseForegroundColorCode)), Background = (SolidColorBrush)(new BrushConverter().ConvertFrom(VerboseBackgroundColorCode)) }); } else if (stream.JobStream.Properties.StreamType == "Error") { streamText = "ERROR: " + streamText; OutputTextBlockParagraph.Inlines.Add(new Run(streamText) { Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom(ErrorForegroundColorCode)), Background = (SolidColorBrush)(new BrushConverter().ConvertFrom(ErrorBackgroundColorCode)) }); } else if (stream.JobStream.Properties.StreamType == "Warning") { streamText = "WARNING: " + streamText; OutputTextBlockParagraph.Inlines.Add(new Run(streamText) { Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom(WarningForegroundColorCode)), Background = (SolidColorBrush)(new BrushConverter().ConvertFrom(WarningBackgroundColorCode)) }); } else { Debug.WriteLine("Unknown stream type couldn't be colored properly: " + stream.JobStream.Properties.StreamType); OutputTextBlockParagraph.Inlines.Add(stream.JobStream.Properties.StreamType.ToUpper() + ": " + streamText); } OutputTextBlock.ScrollToEnd(); }
public void CreateFile(String fileLocation) { try { // Check if file already exists. If yes, delete it. if (File.Exists(fileLocation)) { File.Delete(fileLocation); } // Create a new file using (StreamWriter sw = File.CreateText(fileLocation)) { sw.WriteLine("New file created: {0}", DateTime.Now.ToString()); } } catch (Exception Ex) { OutputTextBlock.AppendText(Ex.ToString() + "\n"); } }