Fix compilation: restore clean RC1 codebase
- Restore clean BindableProperty.Create syntax from RC1 commit - Remove decompiler artifacts with mangled delegate types - Add Svg.Skia package reference for icon support - Fix duplicate type definitions - Library now compiles successfully (0 errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,77 +1,85 @@
|
||||
using System;
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Maui.ApplicationModel;
|
||||
using Microsoft.Maui.Storage;
|
||||
|
||||
namespace Microsoft.Maui.Platform.Linux.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Linux launcher service for opening URLs and files.
|
||||
/// </summary>
|
||||
public class LauncherService : ILauncher
|
||||
{
|
||||
public Task<bool> CanOpenAsync(Uri uri)
|
||||
{
|
||||
return Task.FromResult(result: true);
|
||||
}
|
||||
public Task<bool> CanOpenAsync(Uri uri)
|
||||
{
|
||||
// On Linux, we can generally open any URI using xdg-open
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
public Task<bool> OpenAsync(Uri uri)
|
||||
{
|
||||
return Task.Run(delegate
|
||||
{
|
||||
try
|
||||
{
|
||||
using Process process = Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = "xdg-open",
|
||||
Arguments = uri.ToString(),
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
CreateNoWindow = true
|
||||
});
|
||||
if (process == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
public Task<bool> OpenAsync(Uri uri)
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = "xdg-open",
|
||||
Arguments = uri.ToString(),
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
public Task<bool> OpenAsync(OpenFileRequest request)
|
||||
{
|
||||
if (request.File == null)
|
||||
{
|
||||
return Task.FromResult(result: false);
|
||||
}
|
||||
return Task.Run(delegate
|
||||
{
|
||||
try
|
||||
{
|
||||
string fullPath = ((FileBase)request.File).FullPath;
|
||||
using Process process = Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = "xdg-open",
|
||||
Arguments = "\"" + fullPath + "\"",
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
CreateNoWindow = true
|
||||
});
|
||||
return process != null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
using var process = Process.Start(psi);
|
||||
if (process == null)
|
||||
return false;
|
||||
|
||||
public Task<bool> TryOpenAsync(Uri uri)
|
||||
{
|
||||
return OpenAsync(uri);
|
||||
}
|
||||
// Don't wait for the process to exit - xdg-open may spawn another process
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Task<bool> OpenAsync(OpenFileRequest request)
|
||||
{
|
||||
if (request.File == null)
|
||||
return Task.FromResult(false);
|
||||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var filePath = request.File.FullPath;
|
||||
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = "xdg-open",
|
||||
Arguments = $"\"{filePath}\"",
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
using var process = Process.Start(psi);
|
||||
return process != null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Task<bool> TryOpenAsync(Uri uri)
|
||||
{
|
||||
return OpenAsync(uri);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user