Csharpier format

This commit is contained in:
Matthew Parker [SSW]
2024-01-21 15:00:38 +10:00
parent 22af01dc48
commit 57ec0b85d7
5 changed files with 27 additions and 31 deletions

View File

@@ -5,4 +5,4 @@ public class LocalStateDto
public string SolutionFolderPath { get; set; } = string.Empty;
public string SolutionFilePath { get; set; } = string.Empty;
public string CsprojFilePath { get; set; } = string.Empty;
}
}

View File

@@ -8,8 +8,7 @@ class Program
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) =>
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
public static void Main(string[] args) => BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp() =>

View File

@@ -6,36 +6,34 @@ namespace DotNetSolutionTools.App.Services;
public class FileService
{
private readonly FilePickerFileType _csprojFileType = new("C# Project File")
{
Patterns = new[] { "*.csproj" }
};
private readonly FilePickerFileType _slnFileType = new("C# Solution File")
{
Patterns = new[] { "*.sln" }
};
private readonly FilePickerFileType _csprojFileType = new("C# Project File") { Patterns = new[] { "*.csproj" } };
private readonly FilePickerFileType _slnFileType = new("C# Solution File") { Patterns = new[] { "*.sln" } };
public async Task<IStorageFile?> DoOpenFilePickerCsprojAsync()
{
return await DoOpenFilePickerAsync(_csprojFileType);
}
public async Task<IStorageFile?> DoOpenFilePickerSlnAsync()
{
return await DoOpenFilePickerAsync(_slnFileType);
}
public async Task<IStorageFile?> DoOpenFilePickerAsync(FilePickerFileType fileType)
{
if (
Application.Current?.ApplicationLifetime
is not IClassicDesktopStyleApplicationLifetime desktop
Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop
|| desktop.MainWindow?.StorageProvider is not { } provider
)
throw new NullReferenceException("Missing StorageProvider instance.");
var files = await provider.OpenFilePickerAsync(
new FilePickerOpenOptions() { Title = "Open File", AllowMultiple = false, FileTypeFilter = [fileType] }
new FilePickerOpenOptions()
{
Title = "Open File",
AllowMultiple = false,
FileTypeFilter = [fileType]
}
);
return files?.Count >= 1 ? files[0] : null;
@@ -44,8 +42,7 @@ public class FileService
public async Task<IStorageFolder?> DoOpenFolderPickerAsync()
{
if (
Application.Current?.ApplicationLifetime
is not IClassicDesktopStyleApplicationLifetime desktop
Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop
|| desktop.MainWindow?.StorageProvider is not { } provider
)
throw new NullReferenceException("Missing StorageProvider instance.");

View File

@@ -4,8 +4,5 @@ namespace DotNetSolutionTools.App.ViewModels;
public partial class ViewModelBase : ObservableObject
{
protected ViewModelBase()
{
}
protected ViewModelBase() { }
}