Skip to content

Commit

Permalink
Merge branch 'tomlm/storageProvider' of https://github.com/jinek/Cons…
Browse files Browse the repository at this point in the history
…olonia into tomlm/storageProvider
  • Loading branch information
tomlm committed Nov 25, 2024
2 parents d083d59 + a0cd574 commit b701be0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/Consolonia.Core/Controls/FileOpenPicker.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public FileOpenPicker(FilePickerOpenOptions options)
}

/// <summary>
/// Gets the view model associated with this picker.
/// Gets the view model associated with this picker.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown when the DataContext is null or not of type FileOpenPickerViewModel.</exception>
public FileOpenPickerViewModel ViewModel =>
DataContext as FileOpenPickerViewModel
public FileOpenPickerViewModel ViewModel =>
DataContext as FileOpenPickerViewModel
?? throw new InvalidOperationException("DataContext is not properly initialized.");

private void InitializeComponent()
Expand Down
14 changes: 7 additions & 7 deletions src/Consolonia.Core/Controls/FileSavePicker.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ public FileSavePicker(FilePickerSaveOptions options)
}

/// <summary>
/// Gets the file picker save options associated with this dialog.
/// Gets the file picker save options associated with this dialog.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown when DataContext is null or of incorrect type.</exception>
public FilePickerSaveOptions Options =>
(DataContext as FileSavePickerViewModel)?.Options
?? throw new InvalidOperationException($"Invalid DataContext. Expected {nameof(FileSavePickerViewModel)}");
(DataContext as FileSavePickerViewModel)?.Options
?? throw new InvalidOperationException($"Invalid DataContext. Expected {nameof(FileSavePickerViewModel)}");

/// <summary>
/// Gets the view model associated with this dialog.
/// Gets the view model associated with this dialog.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown when DataContext is null or of incorrect type.</exception>
public FileSavePickerViewModel ViewModel =>
DataContext as FileSavePickerViewModel
?? throw new InvalidOperationException($"Invalid DataContext. Expected {nameof(FileSavePickerViewModel)}");
public FileSavePickerViewModel ViewModel =>
DataContext as FileSavePickerViewModel
?? throw new InvalidOperationException($"Invalid DataContext. Expected {nameof(FileSavePickerViewModel)}");

private void InitializeComponent()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public Task<IStorageFolder> TryGetWellKnownFolderAsync(WellKnownFolder wellKnown
{
WellKnownFolder.Desktop => Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
WellKnownFolder.Documents => Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
WellKnownFolder.Downloads => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads"),
WellKnownFolder.Downloads => Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads"),
WellKnownFolder.Pictures => Environment.GetFolderPath(Environment.SpecialFolder.MyPictures),
WellKnownFolder.Music => Environment.GetFolderPath(Environment.SpecialFolder.MyMusic),
WellKnownFolder.Videos => Environment.GetFolderPath(Environment.SpecialFolder.MyVideos),
Expand Down
3 changes: 2 additions & 1 deletion src/Tests/Consolonia.Core.Tests/StorageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ public async Task TestWellKnownFolder()

folder = await storageProvider.TryGetWellKnownFolderAsync(WellKnownFolder.Downloads);
if (folder != null)
Assert.AreEqual(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads"),
Assert.AreEqual(
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads"),
folder.Path.LocalPath);

folder = await storageProvider.TryGetWellKnownFolderAsync(WellKnownFolder.Desktop);
Expand Down

0 comments on commit b701be0

Please sign in to comment.