public async Task <IActionResult> Get() { var updateJob = new ScheduleUpdate(_settings); await updateJob.Update(); return(await Task.Run(() => Ok())); }
public Startup(IConfiguration configuration) { Configuration = configuration; //Thread thread = new Thread(new ThreadStart(Function)); //thread.IsBackground = true; //thread.Name = "Function"; //thread.Start(); ScheduleUpdate.Update(); }
public static WorkJsonResult Update(string accessTokenOrAppKey, ScheduleUpdate schedule, int timeOut = Config.TIME_OUT) { return(ApiHandlerWapper.TryCommonApi(accessToken => { var url = Config.ApiWorkHost + "/cgi-bin/oa/schedule/update?access_token={0}"; var data = new { schedule }; return Senparc.Weixin.CommonAPIs.CommonJsonSend.Send <WorkJsonResult>(accessToken, url, data, CommonJsonSendType.POST, timeOut); }, accessTokenOrAppKey)); }
private static void Update() { if (ScheduleUpdate == null) { return; } System.Delegate[] _scheduledUpdates = ScheduleUpdate.GetInvocationList(); int _totalCount = _scheduledUpdates.Length; for (int _iter = 0; _iter < _totalCount; _iter++) { if (_scheduledUpdates[_iter] != null) { _scheduledUpdates[_iter].Method.Invoke(null, null); } } }
public static async Task <WorkJsonResult> UpdateAsync(string accessTokenOrAppKey, ScheduleUpdate schedule, int timeOut = Config.TIME_OUT) { return(await ApiHandlerWapper.TryCommonApiAsync(async accessToken => { var url = Config.ApiWorkHost + "/cgi-bin/oa/schedule/update?access_token={0}"; var data = new { schedule }; return await Weixin.CommonAPIs.CommonJsonSend.SendAsync <WorkJsonResult>(accessToken, url, data, CommonJsonSendType.POST, timeOut).ConfigureAwait(false); }, accessTokenOrAppKey).ConfigureAwait(false)); }
/// <summary> /// Update a lab schedule. /// </summary> /// <remarks> /// Operation to update a lab schedule. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='body'> /// The request body. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. The name is case insensitive. /// </param> /// <param name='labName'> /// The name of the lab that uniquely identifies it within containing lab /// account. Used in resource URIs. /// </param> /// <param name='scheduleName'> /// The name of the schedule that uniquely identifies it within containing lab. /// Used in resource URIs. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Schedule> UpdateAsync(this ISchedulesOperations operations, ScheduleUpdate body, string resourceGroupName, string labName, string scheduleName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(body, resourceGroupName, labName, scheduleName, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Update a lab schedule. /// </summary> /// <remarks> /// Operation to update a lab schedule. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='body'> /// The request body. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. The name is case insensitive. /// </param> /// <param name='labName'> /// The name of the lab that uniquely identifies it within containing lab /// account. Used in resource URIs. /// </param> /// <param name='scheduleName'> /// The name of the schedule that uniquely identifies it within containing lab. /// Used in resource URIs. /// </param> public static Schedule Update(this ISchedulesOperations operations, ScheduleUpdate body, string resourceGroupName, string labName, string scheduleName) { return(operations.UpdateAsync(body, resourceGroupName, labName, scheduleName).GetAwaiter().GetResult()); }