mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-29 07:27:36 +08:00
message result sync
This commit is contained in:
+14
-7
@@ -20,22 +20,29 @@ namespace System.Application.Services.Implementation
|
||||
return ShowDialog(messageBoxText, caption, false);
|
||||
}
|
||||
|
||||
public Task<bool> ShowDialog(string messageBoxText, string caption, bool isCancelcBtn)
|
||||
public async Task<bool> ShowDialog(string messageBoxText, string caption, bool isCancelcBtn)
|
||||
{
|
||||
return MainThreadDesktop.InvokeOnMainThreadAsync(() =>
|
||||
return await MainThreadDesktop.InvokeOnMainThreadAsync(async () =>
|
||||
{
|
||||
var dialog = new MessageWindowViewModel
|
||||
var window = new MessageWindow();
|
||||
var dialog = new MessageWindowViewModel<MessageWindow>(window)
|
||||
{
|
||||
Content = messageBoxText,
|
||||
Title = caption
|
||||
};
|
||||
var window = new MessageWindow { DataContext = dialog };
|
||||
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
AppHelper.Current.ShowChildWindow(window);
|
||||
window.DataContext = dialog;
|
||||
//window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
await AppHelper.Current.ShowChildWindow(window);
|
||||
return dialog.DialogResult;
|
||||
});
|
||||
}
|
||||
|
||||
public void CloseWindow(object window)
|
||||
{
|
||||
if (window is Window w)
|
||||
w.Close();
|
||||
}
|
||||
|
||||
static Type GetWindowType(IMessageWindowService.CustomWindow customWindow) => customWindow switch
|
||||
{
|
||||
IMessageWindowService.CustomWindow.MessageBox => typeof(MessageWindow),
|
||||
@@ -53,7 +60,7 @@ namespace System.Application.Services.Implementation
|
||||
window.DataContext = dataContext;
|
||||
}
|
||||
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
AppHelper.Current.ShowChildWindow(window);
|
||||
AppHelper.Current.ShowWindow(window);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<!--<TextBlock Text="{Binding Title}" FontSize="16"/>-->
|
||||
<Border Padding="10">
|
||||
<TextBlock Text="{Binding Source={x:Static service:ToastService.Current},Path=Message,Mode=OneWay}" FontSize="14" Foreground="{DynamicResource HighlightForegroundColorKey}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding Source={x:Static service:ToastService.Current},Path=Message,Mode=OneWay}" FontSize="14" Foreground="{DynamicResource HighlightForegroundColorKey}" VerticalAlignment="Center" HorizontalAlignment="Center" TextWrapping="WrapWithOverflow" MaxWidth="780"/>
|
||||
</Border>
|
||||
<Button Width="40" Height="40" Background="Transparent" Command="{Binding Source={x:Static service:ToastService.Current},Path=CloseBtn_Click}">
|
||||
<Image Width="12">
|
||||
|
||||
+1
@@ -3,6 +3,7 @@
|
||||
<Styles.Resources>
|
||||
<Thickness x:Key="PageMargin">20 0 20 0</Thickness>
|
||||
<Thickness x:Key="PageMargin2">30 0 30 0</Thickness>
|
||||
|
||||
</Styles.Resources>
|
||||
<StyleInclude Source="/Application/UI/Styles/Controls/DrawingSvg.xaml" />
|
||||
<StyleInclude Source="/Application/UI/Styles/Controls/SideBar.xaml" />
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Styling;
|
||||
using System;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace Avalonia.Controls
|
||||
{
|
||||
public class FluentWindow : Window, IStyleable
|
||||
{
|
||||
Type IStyleable.StyleKey => typeof(Window);
|
||||
|
||||
public FluentWindow()
|
||||
{
|
||||
Constructor();
|
||||
}
|
||||
|
||||
public FluentWindow(IWindowImpl impl) : base(impl)
|
||||
{
|
||||
Constructor();
|
||||
}
|
||||
|
||||
void Constructor()
|
||||
{
|
||||
ExtendClientAreaToDecorationsHint = true;
|
||||
ExtendClientAreaTitleBarHeightHint = -1;
|
||||
|
||||
TransparencyLevelHint = WindowTransparencyLevel.AcrylicBlur;
|
||||
|
||||
this.GetObservable(WindowStateProperty)
|
||||
.Subscribe(x =>
|
||||
{
|
||||
PseudoClasses.Set(":maximized", x == WindowState.Maximized);
|
||||
PseudoClasses.Set(":fullscreen", x == WindowState.FullScreen);
|
||||
});
|
||||
|
||||
this.GetObservable(IsExtendedIntoWindowDecorationsProperty)
|
||||
.Subscribe(x =>
|
||||
{
|
||||
if (!x)
|
||||
{
|
||||
SystemDecorations = SystemDecorations.Full;
|
||||
TransparencyLevelHint = WindowTransparencyLevel.Blur;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
ExtendClientAreaChromeHints =
|
||||
ExtendClientAreaChromeHints.PreferSystemChrome |
|
||||
ExtendClientAreaChromeHints.OSXThickTitleBar;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace System.Application.UI.Windows
|
||||
{
|
||||
public class LoginWindow : Window
|
||||
public class LoginWindow : FluentWindow
|
||||
{
|
||||
public LoginWindow()
|
||||
{
|
||||
|
||||
+35
-17
@@ -4,25 +4,43 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="300" d:DesignHeight="200"
|
||||
x:Class="System.Application.UI.Windows.MessageWindow"
|
||||
xmlns:resx="clr-namespace:System.Application.UI.Resx;assembly=System.Application.SteamTools.Client.Desktop"
|
||||
UseLayoutRounding="True"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
SizeToContent="WidthAndHeight"
|
||||
MinWidth="470" MinHeight="100"
|
||||
Padding="0" Background="Transparent"
|
||||
ExtendClientAreaToDecorationsHint="True"
|
||||
ExtendClientAreaChromeHints="NoChrome"
|
||||
ExtendClientAreaTitleBarHeightHint="30"
|
||||
CanResize="False"
|
||||
Title="{Binding Title}">
|
||||
<Grid RowDefinitions="Auto,Auto">
|
||||
<StackPanel Margin="12">
|
||||
<DockPanel>
|
||||
<TextBlock Text="{Binding Content}"
|
||||
Margin="12,0"
|
||||
HorizontalAlignment="Left"
|
||||
TextWrapping="WrapWithOverflow"
|
||||
VerticalAlignment="Center"></TextBlock>
|
||||
</DockPanel>
|
||||
<Border Height="12" />
|
||||
|
||||
<Border Background="{DynamicResource SystemControlHighlightBaseLowBrush}" BorderThickness="1" Margin="10 15"/>
|
||||
<Grid RowDefinitions="1,Auto,*,Auto,1">
|
||||
<DockPanel HorizontalAlignment="Stretch" Grid.RowSpan="5">
|
||||
<ExperimentalAcrylicBorder IsHitTestVisible="False">
|
||||
<ExperimentalAcrylicBorder.Material>
|
||||
<ExperimentalAcrylicMaterial TintColor="{DynamicResource ThemeColorKey}" MaterialOpacity="0.40" TintOpacity="1"/>
|
||||
</ExperimentalAcrylicBorder.Material>
|
||||
</ExperimentalAcrylicBorder>
|
||||
</DockPanel>
|
||||
<StackPanel Grid.Row="1" Margin="10 5 0 5" IsHitTestVisible="False">
|
||||
<TextBlock Text="{Binding Title}" FontSize="16"></TextBlock>
|
||||
</StackPanel>
|
||||
<WrapPanel Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="6,-6,6,6">
|
||||
<Button MinWidth="110" Padding="30,6" Margin="6" IsDefault="True"></Button>
|
||||
<Button MinWidth="110" Padding="30,6" Margin="6" IsCancel="True"></Button>
|
||||
<StackPanel Margin="12 12 12 12" Grid.Row="2" x:Name="content">
|
||||
<DockPanel>
|
||||
<TextBlock Text="{Binding Content}" MaxWidth="500"
|
||||
Margin="12,0" FontSize="14"
|
||||
HorizontalAlignment="Left"
|
||||
TextWrapping="WrapWithOverflow"
|
||||
VerticalAlignment="Center"></TextBlock>
|
||||
</DockPanel>
|
||||
<Border Background="{DynamicResource SystemControlHighlightBaseLowBrush}" BorderThickness="1" Margin="10 15 10 0"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Grid.Row="3"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="10,0,10,6">
|
||||
<Button MinWidth="90" Padding="30,6" Margin="6" IsDefault="True" Content="{Binding Path=Res.Confirm,Mode=OneWay,Source={x:Static resx:R.Current}}" Command="{Binding OK}"></Button>
|
||||
<Button MinWidth="90" Padding="30,6" Margin="6" IsCancel="True" Content="{Binding Path=Res.Cancel,Mode=OneWay,Source={x:Static resx:R.Current}}" Command="{Binding Cancel}"></Button>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace System.Application.UI.Windows
|
||||
{
|
||||
public class MessageWindow : Window
|
||||
public class MessageWindow : FluentWindow
|
||||
{
|
||||
public MessageWindow()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user