Esempio n. 1
0
        /// <summary>
        /// Displays the job using the output format.
        /// </summary>
        /// <param name="job">The job.</param>
        /// <param name="format">The output format.</param>
        /// <exception cref="ArgumentOutOfRangeException">Thrown if the output format is invalid.</exception>
        private static void DisplayJob(IQuantumMachineJob job, OutputFormat format)
        {
            switch (format)
            {
            case OutputFormat.FriendlyUri:
                try
                {
                    Console.WriteLine(job.Uri);
                }
                catch (Exception ex)
                {
                    DisplayWithColor(
                        ConsoleColor.Yellow,
                        Console.Error,
                        $"The friendly URI for viewing job results could not be obtained.{System.Environment.NewLine}" +
                        $"Error details: {ex.Message}" +
                        $"Showing the job ID instead.");

                    Console.WriteLine(job.Id);
                }
                break;

            case OutputFormat.Id:
                Console.WriteLine(job.Id);
                break;

            default:
                throw new ArgumentOutOfRangeException($"Invalid output format '{format}'.");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Displays the job using the output format.
        /// </summary>
        /// <param name="job">The job.</param>
        /// <param name="format">The output format.</param>
        /// <exception cref="ArgumentOutOfRangeException">Thrown if the output format is invalid.</exception>
        private static void DisplayJob(IQuantumMachineJob job, OutputFormat format)
        {
            switch (format)
            {
            case OutputFormat.FriendlyUri:
                // TODO:
                DisplayWithColor(ConsoleColor.Yellow, Console.Error,
                                 "The friendly URI for viewing job results is not available yet. Showing the job ID instead.");
                Console.WriteLine(job.Id);
                break;

            case OutputFormat.Id:
                Console.WriteLine(job.Id);
                break;

            default:
                throw new ArgumentOutOfRangeException($"Invalid output format '{format}'.");
            }
        }