improvements to settings page

This commit is contained in:
Enstrayed
2025-02-06 16:30:21 -08:00
parent 5d59bc8ecd
commit a4ea94e269
7 changed files with 149 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
using ABI.System;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
@@ -9,7 +10,10 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http.Json;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text.Json;
using Windows.Foundation;
using Windows.Foundation.Collections;
@@ -26,6 +30,27 @@ namespace APIToolkit
public Settings()
{
this.InitializeComponent();
SettingsVersionLabel.Text = $"Version {GlobalMethods.Version}";
}
private async void SettingsHeadersRefresh(object sender, RoutedEventArgs e)
{
try
{
string SettingsHeadersResponseJSON = await GlobalMethods.WebRequest.GetStringAsync("headers");
APIHeaders SettingsHeadersResponse = JsonSerializer.Deserialize<APIHeaders>(SettingsHeadersResponseJSON);
SettingsHeadersUserAgent.Text = SettingsHeadersResponse.UserAgent;
SettingsHeadersConnectingIp.Text = SettingsHeadersResponse.CfConnectingIp;
SettingsHeadersIpCountry.Text = SettingsHeadersResponse.CfIpCountry;
SettingsHeadersRayId.Text = SettingsHeadersResponse.CfRay;
}
catch (System.Exception Error)
{
UIFunctions.ShowError(Settings_MainGrid.XamlRoot, Error.Message);
}
}
}
}