mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2025-07-15 23:51:01 +03:00
Compare commits
2 Commits
8002236c1f
...
6d3db23f80
Author | SHA1 | Date | |
---|---|---|---|
|
6d3db23f80 | ||
|
4bc9626013 |
@ -9,7 +9,8 @@
|
|||||||
Icon="avares://DiscordHistoryTracker/Resources/icon.ico"
|
Icon="avares://DiscordHistoryTracker/Resources/icon.ico"
|
||||||
Width="800" Height="500"
|
Width="800" Height="500"
|
||||||
MinWidth="480" MinHeight="240"
|
MinWidth="480" MinHeight="240"
|
||||||
WindowStartupLocation="CenterScreen">
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Closed="OnClosed">
|
||||||
|
|
||||||
<Design.DataContext>
|
<Design.DataContext>
|
||||||
<main:MainWindowModel />
|
<main:MainWindowModel />
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
@ -24,5 +25,11 @@ namespace DHT.Desktop.Main {
|
|||||||
this.AttachDevTools();
|
this.AttachDevTools();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnClosed(object? sender, EventArgs e) {
|
||||||
|
if (DataContext is IDisposable disposable) {
|
||||||
|
disposable.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ using DHT.Server.Database;
|
|||||||
using DHT.Utils.Models;
|
using DHT.Utils.Models;
|
||||||
|
|
||||||
namespace DHT.Desktop.Main {
|
namespace DHT.Desktop.Main {
|
||||||
sealed class MainWindowModel : BaseModel {
|
sealed class MainWindowModel : BaseModel, IDisposable {
|
||||||
private const string DefaultTitle = "Discord History Tracker";
|
private const string DefaultTitle = "Discord History Tracker";
|
||||||
|
|
||||||
public string Title { get; private set; } = DefaultTitle;
|
public string Title { get; private set; } = DefaultTitle;
|
||||||
@ -104,5 +104,10 @@ namespace DHT.Desktop.Main {
|
|||||||
private void MainContentScreenModelOnDatabaseClosed(object? sender, EventArgs e) {
|
private void MainContentScreenModelOnDatabaseClosed(object? sender, EventArgs e) {
|
||||||
WelcomeScreenModel.CloseDatabase();
|
WelcomeScreenModel.CloseDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose() {
|
||||||
|
MainContentScreenModel?.Dispose();
|
||||||
|
db?.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
namespace DHT.Server.Service {
|
namespace DHT.Server.Service {
|
||||||
public static class ServerLauncher {
|
public static class ServerLauncher {
|
||||||
private static readonly Log Log = Log.ForType(typeof(ServerLauncher));
|
private static readonly Log Log = Log.ForType(typeof(ServerLauncher));
|
||||||
|
|
||||||
private static IWebHost? Server { get; set; } = null;
|
private static IWebHost? Server { get; set; } = null;
|
||||||
|
|
||||||
public static bool IsRunning { get; private set; }
|
public static bool IsRunning { get; private set; }
|
||||||
@ -29,6 +29,7 @@ namespace DHT.Server.Service {
|
|||||||
try {
|
try {
|
||||||
if (ManagementThread == null) {
|
if (ManagementThread == null) {
|
||||||
ManagementThread = new Thread(RunManagementThread) {
|
ManagementThread = new Thread(RunManagementThread) {
|
||||||
|
Name = "DHT server management thread",
|
||||||
IsBackground = true
|
IsBackground = true
|
||||||
};
|
};
|
||||||
ManagementThread.Start();
|
ManagementThread.Start();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user