mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-29 07:27:36 +08:00
fix
This commit is contained in:
@@ -52,11 +52,19 @@ namespace System.Net.WebSocket
|
||||
|
||||
readonly CancellationTokenSource tokenSource = new();
|
||||
|
||||
private bool isStarted;
|
||||
public async Task StartAsync()
|
||||
bool isStarted;
|
||||
public void Start()
|
||||
{
|
||||
if (isStarted) return;
|
||||
isStarted = true;
|
||||
Task.Factory.StartNew(StartCore,
|
||||
tokenSource.Token,
|
||||
TaskCreationOptions.LongRunning,
|
||||
TaskScheduler.Default);
|
||||
}
|
||||
|
||||
async void StartCore()
|
||||
{
|
||||
listener.Start();
|
||||
RunState = true;
|
||||
try
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace System.Properties
|
||||
{
|
||||
switch (DI.Platform)
|
||||
{
|
||||
case Platform.Windows:
|
||||
return DI.IsDesktopBridge ? Version + alpha : Version;
|
||||
case Platform.Linux:
|
||||
return Version + alpha;
|
||||
case Platform.Android:
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
|
||||
IgnorableNamespaces="uap rescap">
|
||||
|
||||
<Identity
|
||||
@@ -50,7 +51,10 @@
|
||||
<uap:LockScreen BadgeLogo="Images\BadgeLogo.png" Notification="badgeAndTileText"/>
|
||||
</uap:VisualElements>
|
||||
<Extensions>
|
||||
<desktop:Extension xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" Category="windows.fullTrustProcess" Executable="Launcher\Steam++.Launcher.exe" />
|
||||
<desktop:Extension Category="windows.fullTrustProcess" Executable="Launcher\Steam++.Launcher.exe" />
|
||||
<desktop:Extension Category="windows.startupTask" Executable="Launcher\Steam++.Launcher.exe" EntryPoint="Windows.FullTrustApplication">
|
||||
<desktop:StartupTask TaskId="BootAutoStartTask" Enabled="true" DisplayName="Steam++ System Boot Run" />
|
||||
</desktop:Extension>
|
||||
</Extensions>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
@@ -295,11 +295,17 @@ namespace System.Application.UI
|
||||
|
||||
void Desktop_Startup(object? sender, ControlledApplicationLifetimeStartupEventArgs e)
|
||||
{
|
||||
|
||||
var isOfficialChannelPackage = IsNotOfficialChannelPackageDetectionHelper.Check(Program.IsMainProcess);
|
||||
|
||||
#if StartupTrace
|
||||
StartupTrace.Restart("Desktop_Startup.Start");
|
||||
#endif
|
||||
#if WINDOWS
|
||||
VisualStudioAppCenterSDK.Init();
|
||||
if (isOfficialChannelPackage)
|
||||
{
|
||||
VisualStudioAppCenterSDK.Init();
|
||||
}
|
||||
#endif
|
||||
#if StartupTrace
|
||||
StartupTrace.Restart("AppCenterSDK.Init");
|
||||
|
||||
@@ -25,13 +25,36 @@ namespace System.Application.Services
|
||||
async Task ShowDialogWindow(Window window)
|
||||
{
|
||||
var owner = GetActiveWindow();
|
||||
await window.ShowDialog(owner);
|
||||
if (owner != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
await window.ShowDialog(owner);
|
||||
return;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
}
|
||||
}
|
||||
window.Show();
|
||||
}
|
||||
|
||||
void ShowWindow(Window window)
|
||||
{
|
||||
var owner = GetActiveWindow();
|
||||
window.Show(owner);
|
||||
if (owner != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
window.Show(owner);
|
||||
return;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
window.Show();
|
||||
}
|
||||
|
||||
void ShowWindowNoParent(Window window)
|
||||
|
||||
+48
-15
@@ -57,10 +57,11 @@ namespace System.Application.Services.Implementation
|
||||
{
|
||||
return;
|
||||
}
|
||||
var window = (Window)Activator.CreateInstance(windowType);
|
||||
var window = (Window?)Activator.CreateInstance(windowType);
|
||||
if (window == null) return;
|
||||
if (viewModel == null && typeWindowViewModel != typeof(object))
|
||||
{
|
||||
viewModel = (WindowViewModel)Activator.CreateInstance(typeWindowViewModel);
|
||||
viewModel = (WindowViewModel?)Activator.CreateInstance(typeWindowViewModel);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(title) && viewModel != null)
|
||||
{
|
||||
@@ -92,14 +93,14 @@ namespace System.Application.Services.Implementation
|
||||
}
|
||||
if (viewModel == null)
|
||||
{
|
||||
void Window_DataContextChanged(object _, EventArgs __)
|
||||
void Window_DataContextChanged(object? _, EventArgs __)
|
||||
{
|
||||
if (window.DataContext is DialogWindowViewModel dialogWindowViewModel)
|
||||
{
|
||||
BindingDialogWindowViewModel(window, dialogWindowViewModel, actionDialogWindowViewModel);
|
||||
}
|
||||
}
|
||||
void Window_Closed(object _, EventArgs __)
|
||||
void Window_Closed(object? _, EventArgs __)
|
||||
{
|
||||
window.DataContextChanged -= Window_DataContextChanged;
|
||||
window.Closed -= Window_Closed;
|
||||
@@ -113,16 +114,24 @@ namespace System.Application.Services.Implementation
|
||||
}
|
||||
}
|
||||
if (viewModel != null) window.DataContext = viewModel;
|
||||
if (isDialog)
|
||||
try
|
||||
{
|
||||
await IDesktopAvaloniaAppService.Instance.ShowDialogWindow(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isParent)
|
||||
IDesktopAvaloniaAppService.Instance.ShowWindow(window);
|
||||
if (isDialog)
|
||||
{
|
||||
await IDesktopAvaloniaAppService.Instance.ShowDialogWindow(window);
|
||||
}
|
||||
else
|
||||
IDesktopAvaloniaAppService.Instance.ShowWindowNoParent(window);
|
||||
{
|
||||
if (isParent)
|
||||
IDesktopAvaloniaAppService.Instance.ShowWindow(window);
|
||||
else
|
||||
IDesktopAvaloniaAppService.Instance.ShowWindowNoParent(window);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(nameof(ShowWindowServiceImpl), e,
|
||||
"Show fail, windowType: {0}", window?.GetType().Name);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -173,17 +182,41 @@ namespace System.Application.Services.Implementation
|
||||
|
||||
public void CloseWindow(WindowViewModel vm)
|
||||
{
|
||||
IDesktopAvaloniaAppService.Instance.CloseWindow(vm);
|
||||
try
|
||||
{
|
||||
IDesktopAvaloniaAppService.Instance.CloseWindow(vm);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(nameof(ShowWindowServiceImpl), e,
|
||||
"CloseWindow fail, vmType: {0}", vm.GetType().Name);
|
||||
}
|
||||
}
|
||||
|
||||
public void HideWindow(WindowViewModel vm)
|
||||
{
|
||||
IDesktopAvaloniaAppService.Instance.HideWindow(vm);
|
||||
try
|
||||
{
|
||||
IDesktopAvaloniaAppService.Instance.HideWindow(vm);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(nameof(ShowWindowServiceImpl), e,
|
||||
"HideWindow fail, vmType: {0}", vm.GetType().Name);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowWindow(WindowViewModel vm)
|
||||
{
|
||||
IDesktopAvaloniaAppService.Instance.ShowWindowNoParent(vm);
|
||||
try
|
||||
{
|
||||
IDesktopAvaloniaAppService.Instance.ShowWindowNoParent(vm);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(nameof(ShowWindowServiceImpl), e,
|
||||
"ShowWindowNoParent fail, vmType: {0}", vm.GetType().Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -124,6 +124,9 @@ namespace System.Application.Services.Implementation
|
||||
|
||||
public void SetBootAutoStart(bool isAutoStart, string name)
|
||||
{
|
||||
global::Windows.ApplicationModel.AppInstance.GetActivatedEventArgs()
|
||||
global::Windows.UI.ap
|
||||
//global::Windows.ApplicationModel.app
|
||||
// 开机启动使用 taskschd.msc 实现
|
||||
try
|
||||
{
|
||||
|
||||
@@ -7,7 +7,12 @@ namespace System.Application.Security
|
||||
{
|
||||
public static class IsNotOfficialChannelPackageDetectionHelper
|
||||
{
|
||||
public static bool Check()
|
||||
/// <summary>
|
||||
/// <see cref="AppSettings.IsOfficialChannelPackage"/>
|
||||
/// </summary>
|
||||
/// <param name="showMessageBox"></param>
|
||||
/// <returns></returns>
|
||||
public static bool Check(bool showMessageBox = true)
|
||||
{
|
||||
var value = AppSettings.IsOfficialChannelPackage;
|
||||
if (!value)
|
||||
@@ -18,7 +23,7 @@ namespace System.Application.Security
|
||||
var title = AppResources.Warning;
|
||||
MessageBoxCompat.Show(text, title, MessageBoxButtonCompat.OK, MessageBoxImageCompat.Warning);
|
||||
}
|
||||
IsNotOfficialChannelPackageWarning();
|
||||
if (showMessageBox) IsNotOfficialChannelPackageWarning();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace System.Application.UI.ViewModels
|
||||
vm.ServerWebSocketListenerPort = port;
|
||||
vm.ServerWebSocket.OnClientReceived += e => vm.OnClientReceived(e);
|
||||
}
|
||||
await vm.ServerWebSocket.StartAsync();
|
||||
vm.ServerWebSocket.Start();
|
||||
var conn_helper = DI.Get<IApiConnectionPlatformHelper>();
|
||||
var apiBaseUrl = "https://127.0.0.1:28110"; //ICloudServiceClient.Instance.ApiBaseUrl;
|
||||
vm.TempAes.RemoveTo(vm);
|
||||
|
||||
@@ -373,7 +373,7 @@
|
||||
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatImageView" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
@@ -394,6 +394,22 @@
|
||||
android:textColor="@color/text_secondary"
|
||||
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatTextView" />
|
||||
</LinearLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/swOSAppNotificationSettings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
tools:checked="true"
|
||||
xamarin:managedType="Google.Android.Material.SwitchMaterial.SwitchMaterial" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using Binding;
|
||||
using ReactiveUI;
|
||||
using System.Application.Models;
|
||||
using System.Application.Models.Settings;
|
||||
using System.Application.Services;
|
||||
using System.Application.UI.Resx;
|
||||
using System.Application.UI.ViewModels;
|
||||
using System.Collections.Generic;
|
||||
@@ -104,6 +105,12 @@ namespace System.Application.UI.Activities
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnResume()
|
||||
{
|
||||
base.OnResume();
|
||||
binding!.swOSAppNotificationSettings.Enabled = INotificationService.Instance.AreNotificationsEnabled();
|
||||
}
|
||||
|
||||
protected override void OnClick(View view)
|
||||
{
|
||||
foreach (var item in comboBoxs)
|
||||
|
||||
Reference in New Issue
Block a user