-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a6d31e
commit 8766d2a
Showing
6 changed files
with
96 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,70 @@ | ||
<Window x:Class="SukiUI.Controls.MessageBox" | ||
xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:content="clr-namespace:SukiUI.Content" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
Width="500" | ||
Height="150" | ||
MaxWidth="500" | ||
MaxHeight="150" | ||
d:DesignHeight="200" | ||
d:DesignWidth="500" | ||
Background="{DynamicResource SukiBackground}" | ||
Classes="NakedWindow" | ||
ExtendClientAreaToDecorationsHint="True" | ||
mc:Ignorable="d"> | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:controls="clr-namespace:SukiUI.Controls" | ||
xmlns:content="clr-namespace:SukiUI.Content" | ||
mc:Ignorable="d" d:DesignWidth="480" Width="480" | ||
x:Class="SukiUI.Controls.MessageBox"> | ||
<Panel> | ||
<Panel.Styles> | ||
<Style Selector="Grid.AnimatedGrid"> | ||
<Style.Animations> | ||
<Animation Duration="0:0:4"> | ||
<KeyFrame Cue="0%"> | ||
<Setter Property="ScaleTransform.ScaleX" Value="1" /> | ||
<Setter Property="ScaleTransform.ScaleY" Value="1" /> | ||
</KeyFrame> | ||
<KeyFrame Cue="80%"> | ||
<Setter Property="ScaleTransform.ScaleX" Value="1" /> | ||
<Setter Property="ScaleTransform.ScaleY" Value="1" /> | ||
</KeyFrame> | ||
<KeyFrame Cue="84%"> | ||
<Setter Property="ScaleTransform.ScaleX" Value="0.99" /> | ||
<Setter Property="ScaleTransform.ScaleY" Value="0.99" /> | ||
</KeyFrame> | ||
<KeyFrame Cue="88%"> | ||
<Setter Property="ScaleTransform.ScaleX" Value="1" /> | ||
<Setter Property="ScaleTransform.ScaleY" Value="1" /> | ||
</KeyFrame> | ||
<KeyFrame Cue="94%"> | ||
<Setter Property="ScaleTransform.ScaleX" Value="0.99" /> | ||
<Setter Property="ScaleTransform.ScaleY" Value="0.99" /> | ||
</KeyFrame> | ||
<KeyFrame Cue="100%"> | ||
<Setter Property="ScaleTransform.ScaleX" Value="1" /> | ||
<Setter Property="ScaleTransform.ScaleY" Value="1" /> | ||
</KeyFrame> | ||
</Animation> | ||
</Style.Animations> | ||
</Style> | ||
</Panel.Styles> | ||
<Panel Background="{DynamicResource SukiBackground}" IsHitTestVisible="False" /> | ||
<Button Width="23" | ||
Height="23" | ||
Margin="12" | ||
Padding="0" | ||
HorizontalAlignment="Right" | ||
VerticalAlignment="Top" | ||
Background="Transparent" | ||
BorderThickness="0" | ||
Classes="ZoomOnHover" | ||
Click="Close"> | ||
<PathIcon Data="{x:Static content:Icons.CircleOutlineClose}" Foreground="DarkRed" /> | ||
</Button> | ||
<Border Background="{DynamicResource SukiCardBackground}" BorderBrush="{DynamicResource SukiBorderBrush}" BorderThickness="1" CornerRadius="25" Margin="0,90,0,0"> | ||
<Border CornerRadius="25" ClipToBounds="True"> | ||
<Panel> | ||
<Panel IsVisible="{DynamicResource IsDark}"> | ||
|
||
<Panel.Background> | ||
<LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%"> | ||
<GradientStop Color="{DynamicResource SukiAccentColor3}" Offset="0"></GradientStop> | ||
<GradientStop Color="{DynamicResource SukiPrimaryColor15}" Offset="1"></GradientStop> | ||
|
||
<Grid Classes="AnimatedGrid"> | ||
<PathIcon Name="InfoIcon" | ||
Width="50" | ||
Height="50" | ||
Margin="25,35,0,0" | ||
HorizontalAlignment="Left" | ||
VerticalAlignment="Top" | ||
Data="{x:Static content:Icons.CircleInformation}" | ||
DockPanel.Dock="Left" | ||
Foreground="{DynamicResource SukiPrimaryColor}" /> | ||
</Grid> | ||
</LinearGradientBrush> | ||
</Panel.Background> | ||
|
||
</Panel> | ||
|
||
<Panel IsVisible="{DynamicResource IsLight}"> | ||
<Panel.Background> | ||
<LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%"> | ||
<GradientStop Color="{DynamicResource SukiAccentColor5}" Offset="0"></GradientStop> | ||
<GradientStop Color="{DynamicResource SukiPrimaryColor7}" Offset="1"></GradientStop> | ||
|
||
<TextBlock Name="Title" | ||
Margin="100,45,0,-45" | ||
HorizontalAlignment="Left" | ||
Classes="h3" | ||
DockPanel.Dock="Top" /> | ||
<ScrollViewer Margin="102,45,14,10" | ||
HorizontalAlignment="Left" | ||
VerticalAlignment="Center"> | ||
<TextBlock Name="Message" | ||
FontWeight="Light" | ||
TextWrapping="Wrap" /> | ||
</ScrollViewer> | ||
</LinearGradientBrush> | ||
</Panel.Background> | ||
</Panel> | ||
<StackPanel> | ||
<TextBlock Margin="0,60,0,0" Text="New Update Available !" FontWeight="DemiBold" FontSize="26" HorizontalAlignment="Center" Foreground="{DynamicResource SukiText}"></TextBlock> | ||
<TextBlock Margin="30,20,30,30" Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur." FontWeight="DemiBold" TextWrapping="Wrap" Foreground="{DynamicResource SukiLowText}"></TextBlock> | ||
<StackPanel Orientation="Horizontal" Spacing="15" Margin="0,0,30,30" HorizontalAlignment="Right"> | ||
|
||
<Button Classes="Flat" Content="Update Now"></Button> | ||
</StackPanel> | ||
</StackPanel> | ||
</Panel> | ||
</Border> | ||
</Border> | ||
|
||
<Border CornerRadius="50" Margin="0,50,0,0" Height="60" Width="70" HorizontalAlignment="Center" VerticalAlignment="Top" BoxShadow="0 0 40 0 blue"></Border> | ||
<Border | ||
Margin="0,20,0,0" Background="#fafafa" Width="100" Height="100" CornerRadius="50" VerticalAlignment="Top" HorizontalAlignment="Center"> | ||
<Border CornerRadius="50" ClipToBounds="True"> | ||
<Panel> | ||
<Panel Opacity="1" > | ||
<Panel.Background> | ||
<LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%"> | ||
<GradientStop Color="{DynamicResource SukiPrimaryColor}" Offset="0"></GradientStop> | ||
<GradientStop Color="{DynamicResource SukiPrimaryColor50}" Offset="1"></GradientStop> | ||
|
||
<Button Width="80" | ||
Margin="0,0,0,7" | ||
HorizontalAlignment="Right" | ||
VerticalAlignment="Bottom" | ||
Classes="Basic" | ||
Click="Close" | ||
DockPanel.Dock="Bottom"> | ||
<TextBlock /> | ||
</Button> | ||
</LinearGradientBrush> | ||
</Panel.Background> | ||
</Panel> | ||
|
||
<PathIcon Width="28" Margin="0,0,0,0" | ||
Height="28" HorizontalAlignment="Center" VerticalAlignment="Center" | ||
Data="{x:Static content:Icons.InformationOutline}" | ||
Foreground="White" /> | ||
|
||
</Panel> | ||
</Border> | ||
</Border> | ||
</Panel> | ||
</Window> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,14 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Interactivity; | ||
using Avalonia.Markup.Xaml; | ||
using Avalonia.Media; | ||
using SukiUI.Content; | ||
using SukiUI.Extensions; | ||
|
||
namespace SukiUI.Controls; | ||
|
||
public partial class MessageBox : Window | ||
namespace SukiUI.Controls | ||
{ | ||
private static readonly SolidColorBrush InfoBrush = new(Color.FromRgb(47, 84, 235)); | ||
|
||
public MessageBox() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
public MessageBox(string title, string message) | ||
{ | ||
InitializeComponent(); | ||
this.FindRequiredControl<TextBlock>("Title").Text = title; | ||
this.FindRequiredControl<TextBlock>("Message").Text = message; | ||
} | ||
|
||
private void InitializeComponent() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
CanResize = false; | ||
} | ||
|
||
public static void Info(Window owner, string title, string message, WindowStartupLocation startupLocation = WindowStartupLocation.CenterScreen) | ||
{ | ||
var mbox = new MessageBox(title, message); | ||
if (mbox.FindControl<PathIcon>("InfoIcon") is not { } icon) return; | ||
icon.Data = Icons.CircleInformation; | ||
icon.Foreground = InfoBrush; | ||
mbox.WindowStartupLocation = startupLocation; | ||
mbox.ShowDialog(owner); | ||
} | ||
|
||
public static void Success(Window owner, string title, string message, WindowStartupLocation startupLocation = WindowStartupLocation.CenterScreen) | ||
{ | ||
var mbox = new MessageBox(title, message); | ||
if (mbox.FindControl<PathIcon>("InfoIcon") is not { } icon) return; | ||
icon.Data = Icons.CircleCheck; | ||
icon.Foreground = Brushes.DarkGreen; | ||
mbox.WindowStartupLocation = startupLocation; | ||
mbox.ShowDialog(owner); | ||
} | ||
|
||
public static void Error(Window owner, string title, string message, WindowStartupLocation startupLocation = WindowStartupLocation.CenterScreen) | ||
{ | ||
var mbox = new MessageBox(title, message); | ||
if (mbox.FindControl<PathIcon>("InfoIcon") is not { } icon) return; | ||
icon.Data = Icons.CircleClose; | ||
icon.Foreground = Brushes.DarkRed; | ||
mbox.WindowStartupLocation = startupLocation; | ||
mbox.ShowDialog(owner); | ||
} | ||
|
||
private void Close(object sender, RoutedEventArgs e) | ||
public partial class MessageBox : UserControl | ||
{ | ||
Close(); | ||
public MessageBox() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters