Skip to main content

TcxCustomSchedulerStorage.EndUpdate Method

Updates storage and releases a lock on the data controller.

Declaration

procedure EndUpdate;

Remarks

This method is combined with the BeginUpdate method (that acquires the lock) to contain a block of update statements. Since the execution of the block of statements can exit with either a normal or exception state, these statements and the EndUpdate method should be contained within try… finally… blocks following the BeginUpdate method to ensure the lock will be released in all cases.

For clarity a code sample is given below:

//...
var
  I: Integer;
  AEvent: TcxSchedulerEvent;
begin
  cxSchedulerStorage.BeginUpdate;
  try
    for I := 0 to 1 do
    begin
      AEvent := cxScheduler.Storage.CreateEvent;
      AEvent.Start := EncodeDateTime(2004, 7, 7, 10, 0, 0, 0);
      AEvent.Duration := Random(100) / 500;
      AEvent.Message := 'Created on start up';
      AEvent.Caption := 'Event # ' + IntToStr(I);
    end;
  finally
    cxSchedulerStorage.EndUpdate;
  end;
end;
See Also