chore: initial commit of TaskTracker project
Existing ASP.NET API with vanilla JS SPA, WindowWatcher, Chrome extension, and MCP server. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
32
WindowWatcher/Program.cs
Normal file
32
WindowWatcher/Program.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using WindowWatcher;
|
||||
|
||||
var hostCts = new CancellationTokenSource();
|
||||
|
||||
var builder = Host.CreateApplicationBuilder(args);
|
||||
|
||||
builder.Services.Configure<WindowWatcherOptions>(
|
||||
builder.Configuration.GetSection(WindowWatcherOptions.SectionName));
|
||||
|
||||
builder.Services.AddHttpClient("TaskTrackerApi", (sp, client) =>
|
||||
{
|
||||
var config = sp.GetRequiredService<Microsoft.Extensions.Options.IOptions<WindowWatcherOptions>>().Value;
|
||||
client.BaseAddress = new Uri(config.ApiBaseUrl);
|
||||
});
|
||||
|
||||
builder.Services.AddHostedService<Worker>();
|
||||
|
||||
var host = builder.Build();
|
||||
|
||||
// Run the host in a background thread
|
||||
var hostTask = Task.Run(() => host.RunAsync(hostCts.Token));
|
||||
|
||||
// Run WinForms tray icon on the main thread
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new TrayApplicationContext(hostCts));
|
||||
|
||||
// Wait for host to finish
|
||||
await hostTask;
|
||||
Reference in New Issue
Block a user