Compare commits
2
Commits
master
..
71b163e268
@@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using WinWARP.Core.Models.Entities;
|
||||||
|
|
||||||
|
namespace WinWARP.Core.Data;
|
||||||
|
|
||||||
|
public class AppDbContext : DbContext
|
||||||
|
{
|
||||||
|
public DbSet<Subscription> Subscriptions => Set<Subscription>();
|
||||||
|
|
||||||
|
|
||||||
|
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity<Subscription>()
|
||||||
|
.HasKey(s => s.Id);
|
||||||
|
|
||||||
|
modelBuilder.Entity<Subscription>()
|
||||||
|
.HasMany(s => s.Servers)
|
||||||
|
.WithOne(s => s.Subscription)
|
||||||
|
.OnDelete(DeleteBehavior.SetNull);
|
||||||
|
|
||||||
|
modelBuilder.Entity<StandaloneServer>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WinWARP.Core.Models.Entities;
|
||||||
|
|
||||||
|
public abstract class Server
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StringLength(100)]
|
||||||
|
public string CustomName
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
} = string.Empty;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WinWARP.Core.Models.Entities;
|
||||||
|
|
||||||
|
public class StandaloneServer : Server
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public string FilePath
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WinWARP.Core.Models.Entities;
|
||||||
|
|
||||||
|
public class Subscription
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[StringLength(100)]
|
||||||
|
public string Link
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StringLength(100)]
|
||||||
|
public string WebPage
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
} = string.Empty;
|
||||||
|
|
||||||
|
[StringLength(100)]
|
||||||
|
public string DefaultTitle
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
} = string.Empty;
|
||||||
|
|
||||||
|
public int DefaultUpdateInterval
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
} = 1;
|
||||||
|
|
||||||
|
[StringLength(100)]
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
} = string.Empty;
|
||||||
|
|
||||||
|
public int UpdateInterval
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
} = 1;
|
||||||
|
|
||||||
|
[StringLength(100)]
|
||||||
|
public string SupportURL
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
} = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
public List<SubscriptionServer> Servers
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
} = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WinWARP.Core.Models.Entities;
|
||||||
|
|
||||||
|
public class SubscriptionServer : Server
|
||||||
|
{
|
||||||
|
public Subscription Subscription
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Region
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
} = string.Empty;
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using WinWARP.Core.Data;
|
||||||
|
using WinWARP.Core.Models.Entities;
|
||||||
|
using WinWARP.Core.Services.Interfaces;
|
||||||
|
|
||||||
|
namespace WinWARP.Core.Services.Implementations;
|
||||||
|
|
||||||
|
public class SubscriptionDbService : ISubscriptionDbService
|
||||||
|
{
|
||||||
|
private IDbContextFactory<AppDbContext> _dbContextFactory;
|
||||||
|
|
||||||
|
public SubscriptionDbService(IDbContextFactory<AppDbContext> dbContextFactory)
|
||||||
|
{
|
||||||
|
_dbContextFactory = dbContextFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<Subscription>> GetSubscriptionsAsync()
|
||||||
|
{
|
||||||
|
using var dbContext = await _dbContextFactory.CreateDbContextAsync();
|
||||||
|
return await dbContext.Subscriptions.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task AddSubscriptionAsync(Subscription subscription)
|
||||||
|
{
|
||||||
|
using var dbContext = await _dbContextFactory.CreateDbContextAsync();
|
||||||
|
dbContext.Subscriptions.Add(subscription);
|
||||||
|
await dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace WinWARP.Core.Services;
|
namespace WinWARP.Core.Services.Interfaces;
|
||||||
|
|
||||||
public interface ILocalizationService
|
public interface ILocalizationService
|
||||||
{
|
{
|
||||||
+1
-1
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace WinWARP.Core.Services;
|
namespace WinWARP.Core.Services.Interfaces;
|
||||||
|
|
||||||
public interface INavigationService
|
public interface INavigationService
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using WinWARP.Core.Models.Entities;
|
||||||
|
|
||||||
|
namespace WinWARP.Core.Services.Interfaces;
|
||||||
|
|
||||||
|
public interface ISubscriptionDbService
|
||||||
|
{
|
||||||
|
public Task<List<Subscription>> GetSubscriptionsAsync();
|
||||||
|
public Task AddSubscriptionAsync(Subscription subscription);
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using WinWARP.Core.Services;
|
using WinWARP.Core.Services.Interfaces;
|
||||||
|
|
||||||
namespace WinWARP.Core.ViewModels;
|
namespace WinWARP.Core.ViewModels;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.ComponentModel;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using WinWARP.Core.Services;
|
using WinWARP.Core.Services.Interfaces;
|
||||||
|
|
||||||
namespace WinWARP.Core.ViewModels;
|
namespace WinWARP.Core.ViewModels;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using WinWARP.Core.Services;
|
using WinWARP.Core.Services.Interfaces;
|
||||||
|
|
||||||
namespace WinWARP.Core.ViewModels;
|
namespace WinWARP.Core.ViewModels;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
|
||||||
|
|
||||||
namespace WinWARP.Core.ViewModels;
|
|
||||||
|
|
||||||
public class SubsSettingsViewModel : ObservableObject
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Text;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using WinWARP.Core.Models.Entities;
|
||||||
|
using WinWARP.Core.Services.Interfaces;
|
||||||
|
|
||||||
|
namespace WinWARP.Core.ViewModels;
|
||||||
|
|
||||||
|
public partial class SubsSettingsViewModel(ISubscriptionDbService dbService) : ObservableObject
|
||||||
|
{
|
||||||
|
private readonly ISubscriptionDbService _dbService = dbService;
|
||||||
|
|
||||||
|
public ObservableCollection<Subscription> Subscriptions { get; } = [];
|
||||||
|
|
||||||
|
public async Task LoadSubscriptionsAsync()
|
||||||
|
{
|
||||||
|
Subscriptions.Clear();
|
||||||
|
var data = await _dbService.GetSubscriptionsAsync();
|
||||||
|
foreach (var subscription in data)
|
||||||
|
{
|
||||||
|
Subscriptions.Add(subscription);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
[NotifyCanExecuteChangedFor(nameof(AddSubscriptionCommand))]
|
||||||
|
public partial string NewSubscriptionLink { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[RelayCommand(CanExecute = nameof(CanAddSubscription))]
|
||||||
|
public async Task AddSubscriptionAsync()
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(NewSubscriptionLink))
|
||||||
|
{
|
||||||
|
var subscription = new Subscription
|
||||||
|
{
|
||||||
|
Link = NewSubscriptionLink,
|
||||||
|
Title = "New Subscription",
|
||||||
|
UpdateInterval = 60 // Default update interval
|
||||||
|
};
|
||||||
|
await _dbService.AddSubscriptionAsync(subscription);
|
||||||
|
Subscriptions.Add(subscription);
|
||||||
|
NewSubscriptionLink = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CanAddSubscription()
|
||||||
|
{
|
||||||
|
return !string.IsNullOrWhiteSpace(NewSubscriptionLink);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using WinWARP.Core.Models.Entities;
|
||||||
|
|
||||||
|
namespace WinWARP.Core.ViewModels.Wrappers;
|
||||||
|
|
||||||
|
public partial class SubscriptionViewModel : ObservableValidator
|
||||||
|
{
|
||||||
|
private readonly Subscription _subscription;
|
||||||
|
|
||||||
|
public SubscriptionViewModel(Subscription subscription)
|
||||||
|
{
|
||||||
|
_subscription = subscription;
|
||||||
|
Link = subscription.Link;
|
||||||
|
WebPage = subscription.WebPage;
|
||||||
|
DefaultTitle = subscription.DefaultTitle;
|
||||||
|
DefaultUpdateInterval = subscription.DefaultUpdateInterval;
|
||||||
|
Title = subscription.Title;
|
||||||
|
UpdateInterval = subscription.UpdateInterval;
|
||||||
|
SupportURL = subscription.SupportURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial string Link { get; set; }
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial string WebPage { get; set; }
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial string DefaultTitle { get; set; }
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial int DefaultUpdateInterval { get; set; }
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial string Title { get; set; }
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial int UpdateInterval { get; set; }
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
public partial string SupportURL { get; set; }
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
[NotifyCanExecuteChangedFor(nameof(SaveCommand))]
|
||||||
|
public partial bool IsDirty { get; private set; }
|
||||||
|
|
||||||
|
[RelayCommand(CanExecute = nameof(CanSave))]
|
||||||
|
private void Save()
|
||||||
|
{
|
||||||
|
ValidateAllProperties();
|
||||||
|
|
||||||
|
if (!HasErrors)
|
||||||
|
{
|
||||||
|
// Save logic here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CanSave()
|
||||||
|
{
|
||||||
|
return IsDirty && !HasErrors;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,11 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.11" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.11">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="SingBoxLib" Version="1.2.1" />
|
<PackageReference Include="SingBoxLib" Version="1.2.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
+43
-20
@@ -4,6 +4,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices.WindowsRuntime;
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
@@ -12,20 +13,22 @@ using Microsoft.UI.Xaml.Data;
|
|||||||
using Microsoft.UI.Xaml.Input;
|
using Microsoft.UI.Xaml.Input;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
using Microsoft.UI.Xaml.Navigation;
|
using Microsoft.UI.Xaml.Navigation;
|
||||||
using Microsoft.UI.Xaml.Shapes;
|
|
||||||
using Windows.ApplicationModel;
|
using Windows.ApplicationModel;
|
||||||
using Windows.ApplicationModel.Activation;
|
using Windows.ApplicationModel.Activation;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.Foundation.Collections;
|
using Windows.Foundation.Collections;
|
||||||
using Windows.UI.ApplicationSettings;
|
using Windows.UI.ApplicationSettings;
|
||||||
using WinUI3Localizer;
|
using WinUI3Localizer;
|
||||||
using WinWARP.Core.Services;
|
|
||||||
using WinWARP.Core.ViewModels;
|
using WinWARP.Core.ViewModels;
|
||||||
using WinWARP.Core.ViewModels.ConfigSettings;
|
using WinWARP.Core.ViewModels.ConfigSettings;
|
||||||
using WinWARP.Core.ViewModels.Settings;
|
using WinWARP.Core.ViewModels.Settings;
|
||||||
|
using WinWARP.Core.Data;
|
||||||
using WinWARP.Ui.Services;
|
using WinWARP.Ui.Services;
|
||||||
using WinWARP.Ui.Views;
|
using WinWARP.Ui.Views;
|
||||||
using WinWARP.Ui.Views.Settings;
|
using WinWARP.Ui.Views.Settings;
|
||||||
|
using WinWARP.Core.Services.Implementations;
|
||||||
|
using WinWARP.Core.Services.Interfaces;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
// To learn more about WinUI, the WinUI project structure,
|
// To learn more about WinUI, the WinUI project structure,
|
||||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||||
@@ -52,34 +55,34 @@ public partial class App : Application
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Services = ConfigureServices();
|
Services = ConfigureServices();
|
||||||
|
|
||||||
|
using var context = Services.GetRequiredService<IDbContextFactory<AppDbContext>>().CreateDbContext();
|
||||||
|
context.Database.EnsureCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Configures the services for dependency injection.
|
/// Configures the services for dependency injection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static IServiceProvider ConfigureServices()
|
private static ServiceProvider ConfigureServices()
|
||||||
{
|
{
|
||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
var navigationService = new NavigationService();
|
// DB
|
||||||
navigationService.Configure(typeof(HomeViewModel), typeof(HomePage));
|
Debug.WriteLine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "WinWARP", "app.db"));
|
||||||
navigationService.Configure(typeof(SettingsViewModel), typeof(SettingsPage));
|
services.AddDbContextFactory<AppDbContext>(options =>
|
||||||
navigationService.Configure(typeof(SubsSettingsViewModel), typeof(SubsSettingsPage));
|
{
|
||||||
navigationService.Configure(typeof(ConfigSettingsViewModel), typeof(ConfigSettingsPage));
|
var folder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "WinWARP");
|
||||||
|
|
||||||
navigationService.Configure(typeof(GeneralSettingsViewModel), typeof(GeneralSettingsPage));
|
if (!Directory.Exists(folder))
|
||||||
navigationService.Configure(typeof(UpdateSettingsViewModel), typeof(UpdateSettingsPage));
|
{
|
||||||
|
Directory.CreateDirectory(folder);
|
||||||
|
}
|
||||||
|
|
||||||
navigationService.Configure(typeof(InboundSettingsViewModel), typeof(InboundSettingsPage));
|
var dbPath = Path.Combine(folder, "app.db");
|
||||||
navigationService.Configure(typeof(RoutingSettingsViewModel), typeof(RoutingSettingsPage));
|
options.UseSqlite($"Data Source={dbPath}");
|
||||||
navigationService.Configure(typeof(DnsSettingsViewModel), typeof(DnsSettingsPage));
|
});
|
||||||
navigationService.Configure(typeof(TlsSettingsViewModel), typeof(TlsSettingsPage));
|
services.AddTransient<ISubscriptionDbService, SubscriptionDbService>();
|
||||||
navigationService.Configure(typeof(WarpSettingsViewModel), typeof(WarpSettingsPage));
|
|
||||||
|
|
||||||
services.AddSingleton<ILocalizationService, LocalizationService>();
|
|
||||||
|
|
||||||
services.AddSingleton<INavigationService>(navigationService);
|
|
||||||
|
|
||||||
// ViewModels
|
// ViewModels
|
||||||
services.AddTransient<HomeViewModel>();
|
services.AddTransient<HomeViewModel>();
|
||||||
@@ -97,6 +100,26 @@ public partial class App : Application
|
|||||||
|
|
||||||
// Views
|
// Views
|
||||||
services.AddTransient<MainWindow>();
|
services.AddTransient<MainWindow>();
|
||||||
|
|
||||||
|
// UI services
|
||||||
|
var navigationService = new NavigationService();
|
||||||
|
navigationService.Configure(typeof(HomeViewModel), typeof(HomePage));
|
||||||
|
navigationService.Configure(typeof(SettingsViewModel), typeof(SettingsPage));
|
||||||
|
navigationService.Configure(typeof(SubsSettingsViewModel), typeof(SubsSettingsPage));
|
||||||
|
navigationService.Configure(typeof(ConfigSettingsViewModel), typeof(ConfigSettingsPage));
|
||||||
|
|
||||||
|
navigationService.Configure(typeof(GeneralSettingsViewModel), typeof(GeneralSettingsPage));
|
||||||
|
navigationService.Configure(typeof(UpdateSettingsViewModel), typeof(UpdateSettingsPage));
|
||||||
|
|
||||||
|
navigationService.Configure(typeof(InboundSettingsViewModel), typeof(InboundSettingsPage));
|
||||||
|
navigationService.Configure(typeof(RoutingSettingsViewModel), typeof(RoutingSettingsPage));
|
||||||
|
navigationService.Configure(typeof(DnsSettingsViewModel), typeof(DnsSettingsPage));
|
||||||
|
navigationService.Configure(typeof(TlsSettingsViewModel), typeof(TlsSettingsPage));
|
||||||
|
navigationService.Configure(typeof(WarpSettingsViewModel), typeof(WarpSettingsPage));
|
||||||
|
|
||||||
|
services.AddSingleton<INavigationService>(navigationService);
|
||||||
|
|
||||||
|
services.AddSingleton<ILocalizationService, LocalizationService>();
|
||||||
|
|
||||||
return services.BuildServiceProvider();
|
return services.BuildServiceProvider();
|
||||||
}
|
}
|
||||||
@@ -109,7 +132,7 @@ public partial class App : Application
|
|||||||
{
|
{
|
||||||
|
|
||||||
var stringsFolderPath = System.IO.Path.Combine(AppContext.BaseDirectory, "Strings");
|
var stringsFolderPath = System.IO.Path.Combine(AppContext.BaseDirectory, "Strings");
|
||||||
ILocalizer localizer = await new LocalizerBuilder()
|
var localizer = await new LocalizerBuilder()
|
||||||
.AddStringResourcesFolderForLanguageDictionaries(stringsFolderPath)
|
.AddStringResourcesFolderForLanguageDictionaries(stringsFolderPath)
|
||||||
.SetOptions(options =>
|
.SetOptions(options =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using Microsoft.UI.Xaml.Media;
|
|||||||
using Microsoft.UI.Xaml.Navigation;
|
using Microsoft.UI.Xaml.Navigation;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.Foundation.Collections;
|
using Windows.Foundation.Collections;
|
||||||
using WinWARP.Core.Services;
|
using WinWARP.Core.Services.Interfaces;
|
||||||
using WinWARP.Core.ViewModels;
|
using WinWARP.Core.ViewModels;
|
||||||
using WinWARP.Ui.Services;
|
using WinWARP.Ui.Services;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using WinUI3Localizer;
|
using WinUI3Localizer;
|
||||||
using WinWARP.Core.Services;
|
using WinWARP.Core.Services.Interfaces;
|
||||||
|
|
||||||
namespace WinWARP.Ui.Services;
|
namespace WinWARP.Ui.Services;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Navigation;
|
using Microsoft.UI.Xaml.Navigation;
|
||||||
using WinWARP.Core.Services;
|
using WinWARP.Core.Services.Interfaces;
|
||||||
|
|
||||||
namespace WinWARP.Ui.Services;
|
namespace WinWARP.Ui.Services;
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,10 @@
|
|||||||
xmlns:local="using:WinWARP.Ui.Views"
|
xmlns:local="using:WinWARP.Ui.Views"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:m="using:WinWARP.Core.Models.Entities"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices.WindowsRuntime;
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||||
@@ -12,6 +13,7 @@ using Microsoft.UI.Xaml.Media;
|
|||||||
using Microsoft.UI.Xaml.Navigation;
|
using Microsoft.UI.Xaml.Navigation;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.Foundation.Collections;
|
using Windows.Foundation.Collections;
|
||||||
|
using WinWARP.Core.ViewModels;
|
||||||
|
|
||||||
// To learn more about WinUI, the WinUI project structure,
|
// To learn more about WinUI, the WinUI project structure,
|
||||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||||
@@ -22,8 +24,14 @@ namespace WinWARP.Ui.Views;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed partial class SubsSettingsPage : Page
|
public sealed partial class SubsSettingsPage : Page
|
||||||
{
|
{
|
||||||
|
public SubsSettingsViewModel ViewModel { get; }
|
||||||
|
|
||||||
public SubsSettingsPage()
|
public SubsSettingsPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
ViewModel = App.Services.GetRequiredService<SubsSettingsViewModel>();
|
||||||
|
DataContext = ViewModel;
|
||||||
|
ViewModel.LoadSubscriptionsAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<WindowsAppSdkBootstrapInitialize>true</WindowsAppSdkBootstrapInitialize>
|
<WindowsAppSdkBootstrapInitialize>true</WindowsAppSdkBootstrapInitialize>
|
||||||
<EnableMsixTooling>true</EnableMsixTooling>
|
<EnableMsixTooling>true</EnableMsixTooling>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Views\HomePage.xaml" />
|
<None Remove="Views\HomePage.xaml" />
|
||||||
@@ -55,12 +56,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.2.251219" />
|
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.2.251219" />
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.2.251219" />
|
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.2.251219" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.10" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.11" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.10" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.10" />
|
|
||||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.28000.2526" />
|
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.28000.2526" />
|
||||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="2.3.1" />
|
<PackageReference Include="Microsoft.WindowsAppSDK" Version="2.4.0" />
|
||||||
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3" Version="3.53.3" />
|
|
||||||
<PackageReference Include="WinUI3Localizer" Version="2.3.0" />
|
<PackageReference Include="WinUI3Localizer" Version="2.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user