Code formatting and renamed DBCommandExecutingArguments to DbCommandExecutingArguments

This commit is contained in:
2024-02-24 23:22:02 +02:00
parent cc355d7d4f
commit 196fb6d3d1
19 changed files with 31 additions and 155 deletions

View File

@@ -5,11 +5,12 @@ namespace PluginManager.UX.Linux;
internal class KDE : IOutputModel
{
internal string KdeDialogApplication { get; } = "kdialog";
public async Task ShowMessageBox(string title, string message, MessageBoxType type)
{
var process = new Process();
process.StartInfo.FileName = "kdialog";
process.StartInfo.FileName = KdeDialogApplication;
string typeStr = type switch
{
@@ -27,9 +28,10 @@ internal class KDE : IOutputModel
public async Task<string> ShowInputBox(string title, string message)
{
var process = new Process();
process.StartInfo.FileName = "kdialog";
process.StartInfo.FileName = KdeDialogApplication;
process.StartInfo.Arguments = $"--title \"{title}\" --inputbox \"{message}\"";
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardInput = true;
process.Start();
await process.WaitForExitAsync();
@@ -39,7 +41,7 @@ internal class KDE : IOutputModel
public async Task ShowMessageBox(string message)
{
var process = new Process();
process.StartInfo.FileName = "kdialog";
process.StartInfo.FileName = KdeDialogApplication;
process.StartInfo.Arguments = $"--msgbox \"{message}\"";
process.Start();
await process.WaitForExitAsync();
@@ -48,7 +50,7 @@ internal class KDE : IOutputModel
public async Task<int> ShowMessageBox(string title, string message, MessageBoxButtons buttons, bool isWarning)
{
var process = new Process();
process.StartInfo.FileName = "kdialog";
process.StartInfo.FileName = KdeDialogApplication;
string buttonsStr = buttons switch
{
@@ -67,7 +69,7 @@ internal class KDE : IOutputModel
public async Task ShowNotification(string title, string message, int timeout_seconds = 5)
{
var process = new Process();
process.StartInfo.FileName = "kdialog";
process.StartInfo.FileName = KdeDialogApplication;
process.StartInfo.Arguments = $"--title \"{title}\" --passivepopup \"{message}\" {timeout_seconds}";
process.Start();
await process.WaitForExitAsync();

View File

@@ -19,33 +19,29 @@ internal class Console : IOutputModel
public Task<string> ShowInputBox(string title, string message)
{
AnsiConsole.Markup(title);
AnsiConsole.Markup(message);
AnsiConsole.MarkupLine(title);
string input = AnsiConsole.Ask<string>("Please enter the value:");
string input = AnsiConsole.Ask<string>(message);
return Task.FromResult(input);
}
public Task ShowMessageBox(string message)
{
AnsiConsole.Markup(message);
AnsiConsole.MarkupLine(message);
return Task.CompletedTask;
}
public Task<int> ShowMessageBox(string title, string message,MessageBoxButtons buttons, bool isWarning)
{
AnsiConsole.Markup(title);
AnsiConsole.Markup(message);
AnsiConsole.MarkupLine(title);
AnsiConsole.MarkupLine(message);
return Task.FromResult(0);
}
public Task ShowNotification(string title, string message, int timeout_seconds = 5)
{
AnsiConsole.Markup(title);
AnsiConsole.Markup(message);
return Task.CompletedTask;
}
}

View File

@@ -4,15 +4,15 @@ namespace PluginManager.UX;
public static class UxHandler
{
private static IOutputModel _model;
private static IOutputModel? _model;
public static void Init()
{
_model = Config.AppSettings["UI"] switch
{
"KDE" => new Linux.KDE(),
"Console" => new Other.Console(),
_ => _model
"CONSOLE" => new Other.Console(),
_ => null
};
}