修改账号切换ui错位问题

修改账号切换操作交互
添加关于内手动更新检测
修改更新弹窗为不绑定父窗口弹窗
This commit is contained in:
rmbgame
2021-05-06 15:21:26 +08:00
parent 51fdc5a841
commit e5ddc46deb
17 changed files with 112 additions and 90 deletions
@@ -394,9 +394,9 @@ namespace System.Application.UI
mainWindow.ActivateWorkaround(); // Extension method hack because of https://github.com/AvaloniaUI/Avalonia/issues/2975
mainWindow.Focus();
// Again, ugly hack because of https://github.com/AvaloniaUI/Avalonia/issues/2994
mainWindow.Width += 0.1;
mainWindow.Width -= 0.1;
//// Again, ugly hack because of https://github.com/AvaloniaUI/Avalonia/issues/2994
//mainWindow.Width += 0.1;
//mainWindow.Width -= 0.1;
}
public bool HasActiveWindow()
@@ -1,4 +1,4 @@
using Avalonia.Controls;
using Avalonia.Controls;
using System.Threading.Tasks;
using AvaloniaApplication = Avalonia.Application;
@@ -30,5 +30,11 @@ namespace System.Application.Services
var owner = GetActiveWindow();
window.Show(owner);
}
void ShowWindowNoParent(Window window)
{
var owner = GetActiveWindow();
window.Show();
}
}
}
@@ -20,7 +20,7 @@ namespace System.Application.Services.Implementation
var hasActiveWindow = IDesktopAppService.Instance.HasActiveWindow();
if (hasActiveWindow)
{
await IShowWindowService.Instance.Show(typeof(object), CustomWindow.NewVersion);
await IShowWindowService.Instance.Show(typeof(object), CustomWindow.NewVersion, isParent: false);
}
}
@@ -1,4 +1,4 @@
using Avalonia.Controls;
using Avalonia.Controls;
using ReactiveUI;
using System.Application.UI.ViewModels;
using System.Threading.Tasks;
@@ -31,6 +31,7 @@ namespace System.Application.Services.Implementation
string title,
WindowViewModel? viewModel,
ResizeModeCompat resizeMode,
bool isParent = true,
Action<DialogWindowViewModel>? actionDialogWindowViewModel = null)
=> MainThreadDesktop.InvokeOnMainThreadAsync(async () =>
{
@@ -97,7 +98,10 @@ namespace System.Application.Services.Implementation
}
else
{
IDesktopAvaloniaAppService.Instance.ShowWindow(window);
if (isParent)
IDesktopAvaloniaAppService.Instance.ShowWindow(window);
else
IDesktopAvaloniaAppService.Instance.ShowWindowNoParent(window);
}
});
@@ -106,17 +110,19 @@ namespace System.Application.Services.Implementation
TWindowViewModel? viewModel = null,
string title = "",
ResizeModeCompat resizeMode = ResizeModeCompat.NoResize,
bool isDialog = false)
bool isDialog = false,
bool isParent = true)
where TWindowViewModel : WindowViewModel, new() => Show(typeof(TWindowViewModel),
customWindow, viewModel, title, resizeMode, isDialog);
customWindow, viewModel, title, resizeMode, isDialog, isParent);
public Task Show(Type typeWindowViewModel,
CustomWindow customWindow,
WindowViewModel? viewModel = null,
string title = "",
ResizeModeCompat resizeMode = ResizeModeCompat.NoResize,
bool isDialog = false) => Show(typeWindowViewModel, isDialog, customWindow,
title, viewModel, resizeMode);
bool isDialog = false,
bool isParent = true) => Show(typeWindowViewModel, isDialog, customWindow,
title, viewModel, resizeMode, isParent);
public async Task<bool> ShowDialog<TWindowViewModel>(
CustomWindow customWindow,
@@ -128,7 +134,7 @@ namespace System.Application.Services.Implementation
{
DialogWindowViewModel? dialogWindowViewModel = null;
await Show(typeof(TWindowViewModel), isDialog, customWindow,
title, viewModel, resizeMode, dwvm =>
title, viewModel, resizeMode, true, dwvm =>
{
dialogWindowViewModel = dwvm;
});
@@ -94,6 +94,10 @@
VerticalAlignment="Center"/>
<TextBox Classes="Content readonlybox"
Text="{Binding VersionDisplay,Mode=OneTime}"/>
<Button Classes="plain" Command="{Binding CheckUpdateCommand}"
VerticalAlignment="Center" VerticalContentAlignment="Center">
<TextBlock Text="{ReflectionBinding Path=Res.CheckUpdate,Source={x:Static resx:R.Current},Mode=OneWay}" Classes="Hyperlink" />
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="5">
<TextBlock Classes="Header light"
@@ -57,22 +57,22 @@
<ia:ChangePropertyAction TargetObject="{ReflectionBinding #delete_btn}" PropertyName="IsVisible" Value="False"/>
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>
<Grid Width="{ReflectionBinding #card.Width}" Height="184"
ColumnDefinitions="Auto,Auto,*,Auto">
<Panel>
<gif:Image2 x:Name="avatar"
<Grid Height="184"
ColumnDefinitions="Auto,*,Auto">
<Panel x:Name="avatar" Cursor="Hand"
ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_OpenUserUrl,Mode=OneWay,Source={x:Static resx:R.Current}}">
<!--OpenUserProfileUrl-->
<i:Interaction.Behaviors>
<ia:EventTriggerBehavior EventName="Tapped" SourceObject="{ReflectionBinding #avatar}">
<ia:InvokeCommandAction Command="{ReflectionBinding #u.DataContext.OpenUserProfileUrl}" CommandParameter="{Binding}"/>
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>
<gif:Image2
Width="184"
AutoStart="true"
Stretch="Uniform"
Source="{Binding AvatarStream^}">
<!--<i:Interaction.Behaviors>
<ia:DataTriggerBehavior Binding="{Binding AvatarStream,Converter={StaticResource IsNullConverter},ConverterParameter=invert}" ComparisonCondition="Equal" Value="True">
<ia:ChangePropertyAction TargetObject="{ReflectionBinding #avatar}" PropertyName="Source" Value="{Binding AvatarStream}"/>
</ia:DataTriggerBehavior>
<ia:DataTriggerBehavior Binding="{Binding AvatarStream,Converter={StaticResource IsNullConverter},ConverterParameter=invert}" ComparisonCondition="Equal" Value="False">
<ia:ChangePropertyAction TargetObject="{ReflectionBinding #avatar}" PropertyName="Source" Value="avares://System.Application.SteamTools.Client.Desktop.Avalonia/Application/UI/Assets/AppResources/avater.jpg"/>
</ia:DataTriggerBehavior>
</i:Interaction.Behaviors>-->
</gif:Image2>
<Image Width="184" Stretch="Uniform" IsVisible="{Binding AvatarStream^,Converter={StaticResource IsNullConverter}}"
Source="avares://System.Application.SteamTools.Client.Desktop.Avalonia/Application/UI/Assets/AppResources/avater.jpg">
@@ -97,11 +97,10 @@
</ia:DataTriggerBehavior>
</i:Interaction.Behaviors>
</Ellipse>
<controls:ScrollingTextBlock x:Name="nickname" Text="{Binding SteamNickName}" FontSize="24" Foreground="{DynamicResource HighlightForegroundBrushKey}" Cursor="Hand" ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_OpenUserUrl,Mode=OneWay,Source={x:Static resx:R.Current}}">
<!--OpenUserProfileUrl-->
<controls:ScrollingTextBlock x:Name="nickname" Text="{Binding SteamNickName}" FontSize="24" Foreground="{DynamicResource HighlightForegroundBrushKey}" Cursor="Hand" ToolTip.Tip="{ReflectionBinding Path=Res.UserChange_BtnTootlip,Mode=OneWay,Source={x:Static resx:R.Current}}">
<i:Interaction.Behaviors>
<ia:EventTriggerBehavior EventName="Tapped" SourceObject="{ReflectionBinding #nickname}">
<ia:InvokeCommandAction Command="{ReflectionBinding #u.DataContext.OpenUserProfileUrl}" CommandParameter="{Binding}"/>
<ia:InvokeCommandAction Command="{ReflectionBinding #u.DataContext.SteamId_Click}" CommandParameter="{Binding}"/>
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>
</controls:ScrollingTextBlock>
@@ -41,28 +41,16 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.999-cibuild0013932-beta" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.999-cibuild0013932-beta" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.999-cibuild0013932-beta" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.999-cibuild0013932-beta" />
<PackageReference Include="Avalonia" Version="0.10.999-cibuild0013977-beta" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.999-cibuild0013977-beta" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.999-cibuild0013977-beta" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.999-cibuild0013977-beta" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="0.10.0" />
<!--<PackageReference Include="CefNet.Avalonia" Version="88.1.21022.1657" />-->
<PackageReference Include="LibVLCSharp.Avalonia" Version="3.5.0" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Debug'">
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.999-cibuild0013932-beta" />
</ItemGroup>
<ItemGroup>
<Compile Update="Application\UI\Views\Pages\About\About_SoftwarePage.axaml.cs">
<DependentUpon>About_SoftwarePage.axaml</DependentUpon>
</Compile>
<Compile Update="Application\UI\Views\Pages\Settings\Settings_General.axaml.cs">
<DependentUpon>Settings_General.axaml</DependentUpon>
</Compile>
<Compile Update="Application\UI\Views\Windows\GameListPage\EditAppInfoWindow.axaml.cs">
<DependentUpon>EditAppInfoWindow.axaml</DependentUpon>
</Compile>
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.999-cibuild0013977-beta" />
</ItemGroup>
</Project>
@@ -1,4 +1,4 @@
using System.Application.UI.ViewModels;
using System.Application.UI.ViewModels;
using System.Threading.Tasks;
using System.Windows;
@@ -26,7 +26,8 @@ namespace System.Application.Services
TWindowViewModel? viewModel = null,
string title = "",
ResizeModeCompat resizeMode = ResizeModeCompat.NoResize,
bool isDialog = false)
bool isDialog = false,
bool isParent = true)
where TWindowViewModel : WindowViewModel, new();
/// <inheritdoc cref="Show{TWindowViewModel}(CustomWindow, TWindowViewModel?, string, ResizeModeCompat, bool)"/>
@@ -35,7 +36,8 @@ namespace System.Application.Services
WindowViewModel? viewModel = null,
string title = "",
ResizeModeCompat resizeMode = ResizeModeCompat.NoResize,
bool isDialog = false);
bool isDialog = false,
bool isParent = true);
/// <summary>
/// 显示一个弹窗,返回 <see langword="true"/> 确定(仅当ViewModel继承自<see cref="DialogWindowViewModel"/>时生效),<see langword="false"/> 取消
@@ -64,7 +64,7 @@ namespace System.Application.Services.Implementation
{
get
{
return Process.GetProcessesByName(steamProcess[0])?.Length > 0;
return Process.GetProcessesByName(steamProcess[0]).Any_Nullable();
}
}
+10 -1
View File
@@ -413,6 +413,15 @@ namespace System.Application.UI.Resx {
}
}
/// <summary>
/// 查找类似 检查更新 的本地化字符串。
/// </summary>
public static string CheckUpdate {
get {
return ResourceManager.GetString("CheckUpdate", resourceCulture);
}
}
/// <summary>
/// 查找类似 云同步 的本地化字符串。
/// </summary>
@@ -2017,7 +2026,7 @@ namespace System.Application.UI.Resx {
}
/// <summary>
/// 查找类似 基本设置 的本地化字符串。
/// 查找类似 通用设置 的本地化字符串。
/// </summary>
public static string Settings_General {
get {
@@ -236,6 +236,9 @@
<data name="Cancel" xml:space="preserve">
<value>取消</value>
</data>
<data name="CheckUpdate" xml:space="preserve">
<value>检查更新</value>
</data>
<data name="CloudSync" xml:space="preserve">
<value>云同步</value>
</data>
@@ -776,7 +779,7 @@
<value>字体</value>
</data>
<data name="Settings_General" xml:space="preserve">
<value>基本设置</value>
<value>通用设置</value>
</data>
<data name="Settings_General_AutoCheckUpdate" xml:space="preserve">
<value>启动时自动检查更新</value>
@@ -1,4 +1,4 @@
using ReactiveUI;
using ReactiveUI;
using StatefulModel.EventListeners;
using System.Application.UI.Resx;
using System.Collections.Generic;
@@ -77,7 +77,7 @@ namespace System.Application.UI.ViewModels
AddTabItem<LocalAuthPageViewModel>();
//AddTabItem<SteamIdlePageViewModel>();
//AddTabItem<ArchiSteamFarmPlusPageViewModel>();
//AddTabItem<GameRelatedPageViewModel>();
AddTabItem<GameRelatedPageViewModel>();
//AddTabItem<OtherPlatformPageViewModel>();
AddTabItem(() => SettingsPageViewModel.Instance);
@@ -24,7 +24,13 @@ namespace System.Application.UI.ViewModels
OpenBrowserCommand = ReactiveCommand.Create<string>(BrowserOpen);
CopyLinkCommand = ReactiveCommand.Create<string>(IDesktopAppService.Instance.SetClipboardText);
CheckUpdateCommand = ReactiveCommand.Create(() =>
{
IAppUpdateService.Instance.CheckUpdate(showIsExistUpdateFalse: true);
});
}
public ReactiveCommand<Unit, Unit> CheckUpdateCommand { get; }
public ReactiveCommand<string, Unit> OpenBrowserCommand { get; }
@@ -27,7 +27,7 @@ namespace System.Application.UI.ViewModels
public ReactiveCommand<Unit, Unit> OpenCertificateDirCommand { get; }
public ReactiveCommand<Unit, Unit> EditHostsFileCommand { get; }
public ReactiveCommand<Unit, Unit> AutoRunProxyCommand { get; }
public ReactiveCommand<Unit, Unit> EnableProxyScriptCommand { get; }
//public ReactiveCommand<Unit, Unit> EnableProxyScriptCommand { get; }
public MenuItemViewModel AutoRunProxy { get; }
//public MenuItemViewModel EnableProxyScript { get; }
@@ -25,7 +25,6 @@ namespace System.Application.UI.ViewModels
internal override void Activation()
{
if (IsFirstActivation)
if (ProxySettings.IsAutoCheckScriptUpdate)
ProxyService.Current.CheckUpdate();
@@ -184,7 +183,7 @@ namespace System.Application.UI.ViewModels
}
else
{
DeleteNoFileScriptItemButton(script);
DeleteNoFileScriptItemButton(script);
}
}
@@ -399,43 +399,48 @@ namespace System.Application.Services.Implementation
//proxyServer.ServerCertificateValidationCallback += OnCertificateValidation;
//proxyServer.ClientCertificateSelectionCallback += OnCertificateSelection;
var explicitProxyEndPoint = new ExplicitProxyEndPoint(ProxyIp, GetRandomUnusedPort(), true)
try
{
// 通过不启用为每个http的域创建证书来优化性能
//GenericCertificate = proxyServer.CertificateManager.RootCertificate
};
if (IsWindowsProxy)
{
//explicit endpoint 是客户端知道代理存在的地方
proxyServer.AddEndPoint(explicitProxyEndPoint);
}
else
{
//if (PortInUse(443))
//{
// return false;
//}
proxyServer.AddEndPoint(new TransparentProxyEndPoint(ProxyIp, 443, true)
var explicitProxyEndPoint = new ExplicitProxyEndPoint(ProxyIp, GetRandomUnusedPort(), true)
{
// 通过不启用为每个http的域创建证书来优化性能
//GenericCertificate = proxyServer.CertificateManager.RootCertificate
};
if (IsWindowsProxy)
{
//explicit endpoint 是客户端知道代理存在的地方
proxyServer.AddEndPoint(explicitProxyEndPoint);
}
else
{
//if (PortInUse(443))
//{
// return false;
//}
proxyServer.AddEndPoint(new TransparentProxyEndPoint(ProxyIp, 443, true)
{
// 通过不启用为每个http的域创建证书来优化性能
//GenericCertificate = proxyServer.CertificateManager.RootCertificate
});
if (PortInUse(80) == false)
proxyServer.AddEndPoint(new TransparentProxyEndPoint(ProxyIp, 80, false));
}
proxyServer.ExceptionFunc = ((Exception exception) =>
{
Log.Error("Proxy", exception, "ProxyServer ExceptionFunc");
});
if (PortInUse(80) == false)
proxyServer.AddEndPoint(new TransparentProxyEndPoint(ProxyIp, 80, false));
}
proxyServer.ExceptionFunc = ((Exception exception) =>
{
Log.Error("Proxy", exception, "ProxyServer ExceptionFunc");
});
try
{
proxyServer.Start();
if (IsWindowsProxy)
{
proxyServer.SetAsSystemHttpProxy(explicitProxyEndPoint);
proxyServer.SetAsSystemHttpsProxy(explicitProxyEndPoint);
}
}
catch (Exception ex)
{
@@ -443,11 +448,6 @@ namespace System.Application.Services.Implementation
return false;
}
if (IsWindowsProxy)
{
proxyServer.SetAsSystemHttpProxy(explicitProxyEndPoint);
proxyServer.SetAsSystemHttpsProxy(explicitProxyEndPoint);
}
#endregion
#if DEBUG
foreach (var endPoint in proxyServer.ProxyEndPoints)