public static string DocConvertionUrl = "https://xxx.com/doc2pdf";
private Task AttemptToOpenAsync(string filepath) { return Task.Factory.StartNew(() => { bool available = false; while (!available) { available = IsAvailable(filepath); Log($"IsAvailable: {available}"); if (!available) { Thread.Sleep(1000); } } return available; }); } private bool IsAvailable(string filepath) { bool result = false; try { using (FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.None)) { result = true; } } catch (FileNotFoundException ex) { // Log(ex.Message); } catch (IOException ex) { // Log(ex.Message); } return result; }
serialPort1.Write("02(hex)B03(hex)");