/// <summary> /// Try check and send to other process. <br/> /// Return <see langword="true"/> if other process is exists. <br/> /// </summary> /// <param name="arguments"></param> /// <returns></returns> public async Task <bool> TrySendAsync(string[] arguments) { if (ProcessUtilities.IsFirstProcess(ApplicationName)) { return(false); } try { if (!arguments.Any()) { return(true); } using var source = new CancellationTokenSource(ClientTimeout); await using var client = new PipeClient <string[]>(ApplicationName); client.ExceptionOccurred += (_, args) => { OnExceptionOccurred(args.Exception); }; await client.WriteAsync(arguments, source.Token).ConfigureAwait(false); } catch (OperationCanceledException) { } catch (Exception exception) { OnExceptionOccurred(exception); } return(true); }