C# には、最初に GUI DateTimePicker オブジェクトの値を今日の日付 (時刻 = 真夜中) に設定してから、他の処理を行う関数があります。GUI ボタンから実行すると、関数 (DBIO_Morning) は正常に動作します。ただし、時限アクションを介して実行されます。
private void SetupTimedActions()
{
...
DateTime ref_morning = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 8, 16, 0);
if (DateTime.Now < ref_morning)
At.Do(() => DBIO_Morning(), ref_morning);
...
}
2行目で失敗します:
private void DBIO_Morning()
{
DateTime date_current = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 0, 0, 0);
DTPicker_start.Value = date_current;
...
}
( At.Do オブジェクトは 3 番目の回答からのものです: C# execute action after X seconds )