Skip to content

Commit

Permalink
coderabbit changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlm committed Nov 25, 2024
1 parent dcb3c1a commit e83a7cb
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Consolonia.Core/Controls/DialogWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public virtual void CloseDialog(object result = null)
public async Task ShowDialogAsync(Control parent)
{
if (_taskCompletionSource != null)
throw new NotImplementedException();
throw new InvalidOperationException("Dialog is already shown.");

_taskCompletionSource = new TaskCompletionSource<object>();
ShowDialogInternal(parent);
Expand All @@ -176,7 +176,7 @@ public async Task ShowDialogAsync(Control parent)
public async Task<T> ShowDialogAsync<T>(Control parent)
{
if (_taskCompletionSource != null)
throw new NotImplementedException();
throw new InvalidOperationException("Dialog is already shown.");

_taskCompletionSource = new TaskCompletionSource<object>();
ShowDialogInternal(parent);
Expand Down
1 change: 1 addition & 0 deletions src/Consolonia.Core/Controls/FileOpenPicker.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
Expand Down
2 changes: 1 addition & 1 deletion src/Consolonia.Core/Controls/FileSavePickerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected override bool FilterItem(IStorageItem item)
if (item is IStorageFolder) return true;
if (item is IStorageFile file)
{
if (SelectedFileType.Patterns == null || SelectedFileType.Patterns.Count == 0)
if (SelectedFileType?.Patterns == null || SelectedFileType.Patterns.Count == 0)

Check warning on line 27 in src/Consolonia.Core/Controls/FileSavePickerViewModel.cs

View workflow job for this annotation

GitHub Actions / build

"[ConstantConditionalAccessQualifier] Conditional access qualifier expression is known to be not null" on /home/runner/work/Consolonia/Consolonia/src/Consolonia.Core/Controls/FileSavePickerViewModel.cs(27,37)
return true;

foreach (string pattern in SelectedFileType.Patterns)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public Task<IStorageFolder> TryGetWellKnownFolderAsync(WellKnownFolder wellKnown
{
WellKnownFolder.Desktop => Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
WellKnownFolder.Documents => Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
WellKnownFolder.Downloads => Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
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
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private async void OnSaveFile(object sender, Avalonia.Interactivity.RoutedEventA
if (lifetime != null)
{
var storageProvider = lifetime.MainWindow.StorageProvider;
if (storageProvider.CanOpen)
if (storageProvider.CanSave)
{
var file = await storageProvider.SaveFilePickerAsync(new FilePickerSaveOptions()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Consolonia.NUnit/UnitTestConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ public async Task StringInput(string input)
// todo: check why Yield is not enough: https://github.com/jinek/Consolonia/runs/7055199426?check_suite_focus=true
const ulong interval = 50;
KeyEvent?.Invoke(key, c, RawInputModifiers.None, true, timestamp);
await Task.Delay((int)interval);
await Task.Delay((int)interval).ConfigureAwait(false);
KeyEvent?.Invoke(key, c, RawInputModifiers.None, false, timestamp + interval);
await Task.Delay((int)interval);
await Task.Delay((int)interval).ConfigureAwait(false);
}

await WaitRendered().ConfigureAwait(true);
Expand Down

0 comments on commit e83a7cb

Please sign in to comment.