コード例 #1
0
 public SchedulerService(ServiceConfiguration serviceConfiguration)
     : base(serviceConfiguration)
 {
     CloudServiceManagementClient = new CloudServiceManagementClient(CertificateCloudCredentials);
     SchedulerManagementClient    = new SchedulerManagementClient(CertificateCloudCredentials);
     try
     {
         System.Diagnostics.Trace.TraceInformation("Registering Schedluer Resource");
         SchedulerManagementClient.RegisterResourceProvider();
     }
     catch (Hyak.Common.CloudException)
     {
         // Probably it is registered before
         // but TODO: do some logging in case it isn't the expected error
         System.Diagnostics.Trace.TraceInformation("Schedluer Resource already registered");
     }
 }
        public static void RegisterScheduleResourceProvider(CertificateCloudCredentials credentials)
        {
            var schedulerServiceClient = new SchedulerManagementClient(credentials);

            try
            {
                var result2 = schedulerServiceClient.RegisterResourceProvider();

                Console.WriteLine("RegisterScheduleResourceProvider :\n" + result2.RequestId);
                Console.WriteLine("RegisterScheduleResourceProvider :\n" + result2.StatusCode);
                Console.ReadLine();
            }
            catch (CloudException exc)
            {
                if (exc.Response.StatusCode != HttpStatusCode.Conflict)
                {
                    Console.WriteLine("RegisterScheduleResourceProvider Exception :\n" + exc.Message);
                    throw;
                }
            }
        }