refactor: renomeia VideoStudy.Linux -> VideoStudy.App (cross-platform)
- OutputType WinExe -> Exe (funciona em Windows, Linux e macOS) - Namespace VideoStudy.Linux -> VideoStudy.App - Remove IPdfSaver (nunca injetado, PDF salvo pelo PersistenceService) - Remove Platforms AnyCPU;x64 (desnecessário para Photino cross-platform) - Simplifica Program.cs removendo código morto Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
222a30d658
commit
b765543e1c
33
VideoStudy.App/Program.cs
Normal file
33
VideoStudy.App/Program.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Photino.Blazor;
|
||||
using VideoStudy.UI;
|
||||
|
||||
namespace VideoStudy.App;
|
||||
|
||||
class Program
|
||||
{
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var builder = PhotinoBlazorAppBuilder.CreateDefault(args);
|
||||
|
||||
builder.Services.AddVideoStudyUI();
|
||||
|
||||
builder.Services.AddScoped(sp => new HttpClient
|
||||
{
|
||||
BaseAddress = new Uri("http://localhost:5000"),
|
||||
Timeout = TimeSpan.FromMinutes(10)
|
||||
});
|
||||
|
||||
builder.RootComponents.Add<VideoStudy.UI.App>("#app");
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MainWindow
|
||||
.SetTitle("VideoStudy")
|
||||
.SetSize(1280, 800)
|
||||
.Center();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<RootNamespace>VideoStudy.App</RootNamespace>
|
||||
<!-- Cross-platform: Windows, Linux, macOS -->
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -1,65 +0,0 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Photino.Blazor;
|
||||
using VideoStudy.UI;
|
||||
using VideoStudy.Shared;
|
||||
|
||||
namespace VideoStudy.Linux;
|
||||
|
||||
class Program
|
||||
{
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var ComponentsApp = typeof(VideoStudy.UI.App);
|
||||
|
||||
var builder = PhotinoBlazorAppBuilder.CreateDefault(args);
|
||||
|
||||
// Registro de serviços da UI Unificada
|
||||
builder.Services.AddVideoStudyUI();
|
||||
|
||||
// Configurar HttpClient para a API
|
||||
builder.Services.AddScoped(sp => new HttpClient
|
||||
{
|
||||
BaseAddress = new Uri("http://localhost:5000"),
|
||||
Timeout = TimeSpan.FromMinutes(10)
|
||||
});
|
||||
|
||||
// Registrar um IPdfSaver dummy ou específico para Linux se necessário
|
||||
// No Linux, o Photino pode usar o explorador de arquivos nativo ou salvar direto na pasta Downloads
|
||||
builder.Services.AddSingleton<IPdfSaver, LinuxPdfSaver>();
|
||||
|
||||
builder.RootComponents.Add(ComponentsApp, "#app");
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MainWindow
|
||||
.SetTitle("VideoStudy - Study Smarter with AI")
|
||||
.SetSize(1200, 800)
|
||||
.SetIconFile("wwwroot/favicon.ico") // Se houver
|
||||
.Center();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
|
||||
// Implementação básica de salvamento para Linux
|
||||
public class LinuxPdfSaver : IPdfSaver
|
||||
{
|
||||
public async Task<string?> SavePdfAsync(byte[] pdfData, string suggestedFileName)
|
||||
{
|
||||
// No Linux, por simplicidade inicial, vamos salvar na pasta Downloads do usuário
|
||||
var downloadsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
|
||||
var filePath = Path.Combine(downloadsPath, suggestedFileName);
|
||||
|
||||
await File.WriteAllBytesAsync(filePath, pdfData);
|
||||
|
||||
// No Linux, podemos tentar abrir o arquivo usando 'xdg-open'
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Process.Start("xdg-open", filePath);
|
||||
}
|
||||
catch { }
|
||||
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
@ -9,7 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoStudy.API", "VideoStud
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoStudy.UI", "VideoStudy.UI\VideoStudy.UI.csproj", "{CE82389C-E484-4EAC-8F78-0FB5C6EB63A4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoStudy.Linux", "VideoStudy.Linux\VideoStudy.Linux.csproj", "{D6ABA32E-D5C0-4E94-8E1C-2E6B2C83519E}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoStudy.App", "VideoStudy.App\VideoStudy.App.csproj", "{D6ABA32E-D5C0-4E94-8E1C-2E6B2C83519E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
Loading…
Reference in New Issue
Block a user