void TryApply() { if (NeedsSelection && !State.HasSelection) { throw new Exception("Cannot apply without selection!"); } int done = 0; foreach (Photo photo in State.Items) { LoadPhoto(photo, out var input, out var input_profile); var edited = Process(input, input_profile); input.Dispose(); bool createVersion = photo.DefaultVersion.IsProtected; photo.SaveVersion(edited, createVersion); photo.Changes.DataChanged = true; App.Instance.Database.Photos.Commit(photo); done++; ProcessingStep?.Invoke(done); } Reset(); }
/// <summary> /// Processing state constructor /// </summary> /// <param name="StartStep"> /// First step of the request processing pipeline /// </param> public RequestProcessingState(ProcessingStep StartStep) { NextStep = StartStep; }
/// <summary> /// Processing state constructor /// </summary> /// <param name="StartStep"> /// First step of the request processing pipeline /// </param> public RequestProcessingState(ProcessingStep StartStep) { NextStep = StartStep; }