public async Task ModifySortWayAsync(string Path, SortTarget?SortTarget = null, SortDirection?SortDirection = null, bool BypassSaveAndNotification = false) { if (SortTarget == Class.SortTarget.OriginPath || SortTarget == Class.SortTarget.Path) { throw new NotSupportedException("SortTarget.Path and SortTarget.OriginPath is not allow in this method"); } bool IsModified = false; if (SortTarget.HasValue && this.SortTarget != SortTarget) { this.SortTarget = SortTarget.Value; IsModified = true; } if (SortDirection.HasValue && this.SortDirection != SortDirection) { this.SortDirection = SortDirection.Value; IsModified = true; } if (IsModified && !BypassSaveAndNotification) { await SQLite.Current.SetPathConfiguration(new PathConfiguration(Path, this.SortTarget, this.SortDirection)).ConfigureAwait(true); SortWayChanged?.Invoke(this, Path); } }
public static async Task SavePathSortWayAsync(string Path, SortTarget Target, SortDirection Direction) { if (Target == SortTarget.OriginPath || Target == SortTarget.Path) { throw new NotSupportedException("SortTarget.Path and SortTarget.OriginPath is not allowed in this method"); } PathConfiguration CurrentConfiguration = await SQLite.Current.GetPathConfigurationAsync(Path); if (CurrentConfiguration.Target != Target || CurrentConfiguration.Direction != Direction) { await SQLite.Current.SetPathConfigurationAsync(new PathConfiguration(Path, Target, Direction)); SortWayChanged?.Invoke(null, new SortWayChangedEventArgs(Path, Target, Direction)); } }