File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -384,14 +384,16 @@ public void StopRecording()
384384 IsRecordingChanged ? . Invoke ( this , EventArgs . Empty ) ;
385385 }
386386
387- public void RecalculateLastTrackEnd ( )
387+ public Boolean RecalculateLastTrackEnd ( )
388388 {
389389 //Try to recalculate length by recalculating last track
390390 var lastTrack = tracks . LastOrDefault ( ) ;
391391 if ( lastTrack != null )
392392 {
393393 RecalculateTrackProperties ( lastTrack ) ;
394+ return true ;
394395 }
396+ return false ;
395397 }
396398
397399 public override ValidationResult Validate ( string property )
Original file line number Diff line number Diff line change @@ -217,14 +217,11 @@ public bool BulkEdit
217217 public void MergeLastEditWithEdit ( Func < TracedChanges , bool > targetEdit )
218218 {
219219 var edit = undoStack . FirstOrDefault ( targetEdit ) ;
220- if ( edit != null )
220+ if ( ( edit != null ) && ( undoStack . Count > 0 ) )
221221 {
222- if ( undoStack . Count > 0 )
223- {
224- var lastEdits = undoStack . Pop ( ) ;
225- edit . Changes . AddRange ( lastEdits . Changes ) ;
226- UndoDone ? . Invoke ( this , EventArgs . Empty ) ;
227- }
222+ var lastEdits = undoStack . Pop ( ) ;
223+ edit . Changes . AddRange ( lastEdits . Changes ) ;
224+ UndoDone ? . Invoke ( this , EventArgs . Empty ) ;
228225 }
229226 }
230227
Original file line number Diff line number Diff line change @@ -62,12 +62,11 @@ along with Foobar. If not, see
6262 }
6363 }
6464
65- protected override async Task OnAfterRenderAsync ( bool firstRender )
65+ protected override void OnParametersSet ( )
6666 {
67- await base .OnAfterRenderAsync ( firstRender );
68- if (form != null )
67+ base .OnParametersSet ( );
68+ if (form ? . IsTouched == true )
6969 {
70- await form .Validate ();
7170 SetAudiofileValidationText ();
7271 }
7372 }
@@ -83,8 +82,10 @@ along with Foobar. If not, see
8382 {
8483 Cuesheet .Audiofile = await _fileInputManager .CreateAudiofileAsync (fileInputAudiofileId , browserFile , x =>
8584 {
86- Cuesheet .RecalculateLastTrackEnd ();
87- TraceChangeManager .MergeLastEditWithEdit (x => x .Changes .All (y => y .TraceableObject == Cuesheet && y .TraceableChange .PropertyName == nameof (Audiofile )));
85+ if (Cuesheet .RecalculateLastTrackEnd ())
86+ {
87+ TraceChangeManager .MergeLastEditWithEdit (x => x .Changes .All (y => y .TraceableObject == Cuesheet && y .TraceableChange .PropertyName == nameof (Audiofile )));
88+ }
8889 });
8990 }
9091 catch (ArgumentException ae )
You can’t perform that action at this time.
0 commit comments