コード例 #1
0
        /// <summary>
        /// The main method.
        /// </summary>
        /// <param name="args">Command line arguments - see ShowUsage for options</param>
        private static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                ShowUsage();
                return;
            }

            Console.WriteLine("Authorized Buyers AdExchange Buyer API DotNet Sample");
            Console.WriteLine("====================");

            // Create a new service instance for v1 and v2 of AdExchangeBuyer.
            // Note: This is where security configuration takes place and will need to be
            // configured before the code will work!
            AdExchangeBuyerService   v1Service = Utilities.GetV1Service();
            AdExchangeBuyerIIService v2Service = Utilities.GetV2Service();

            // If --all is passed run all the examples
            string[] examplesToRun = (args[0].ToLower() == "--all")
                ? examples.Keys.ToArray() : args;

            foreach (string exampleName in examplesToRun)
            {
                if (examples.ContainsKey(exampleName))
                {
                    ExampleBase example = examples[exampleName];
                    Console.WriteLine(example.Description);

                    if (example.getClientType() == ExampleBase.ClientType.ADEXCHANGEBUYER)
                    {
                        example.Run(v1Service);
                    }
                    else if (example.getClientType() == ExampleBase.ClientType.ADEXCHANGEBUYERII)
                    {
                        example.Run(v2Service);
                    }
                }
                else
                {
                    Console.WriteLine("Unrecognised argument " + exampleName);
                    ShowUsage();
                    break;
                }
            }

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
コード例 #2
0
        /// <summary>
        /// The main method.
        /// </summary>
        /// <param name="args">Command line arguments - see ShowUsage for options</param>
        private static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                ShowUsage();
                return;
            }

            Console.WriteLine("AdExchange Buyer DotNet API Sample");
            Console.WriteLine("====================");

            // Create a new AdExchangeBuyerService instance.
            // Note: This is where security configuration takes place and will
            // need to be configured before the code will work!
            AdExchangeBuyerService service = Utilities.GetService();

            // If --all is passed run all the examples
            string[] examplesToRun = (args[0].ToLower() == "--all")
                ? examples.Keys.ToArray() : args;

            foreach (string exampleName in examplesToRun)
            {
                if (examples.ContainsKey(exampleName))
                {
                    ExampleBase example = examples[exampleName];
                    Console.WriteLine(example.Description);
                    example.Run(service);
                }
                else
                {
                    Console.WriteLine("Unrecognised argument " + exampleName);
                    ShowUsage();
                    break;
                }
            }

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }