mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Improve title display experience & Fix three button dialog display issue & Improve close button behaviour
This commit is contained in:
parent
32c138b9fd
commit
7cb17ab404
2 changed files with 30 additions and 14 deletions
|
|
@ -75,7 +75,7 @@
|
|||
Grid.Column="0"
|
||||
Width="18"
|
||||
Height="18"
|
||||
Margin="0 0 0 0"
|
||||
Margin="0 0 10 0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
RenderOptions.BitmapScalingMode="Fant"
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
x:Name="TitleTextBlock"
|
||||
Grid.Column="1"
|
||||
MaxWidth="400"
|
||||
Margin="10 0 26 0"
|
||||
Margin="0 0 26 0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Segoe UI"
|
||||
FontSize="20"
|
||||
|
|
@ -112,7 +112,8 @@
|
|||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
TextAlignment="Left"
|
||||
TextWrapping="Wrap" />
|
||||
TextWrapping="Wrap"
|
||||
Visibility="Collapsed" />
|
||||
</Grid>
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
|
|
@ -126,25 +127,25 @@
|
|||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnOk"
|
||||
MinWidth="140"
|
||||
MinWidth="120"
|
||||
Margin="5 0 5 0"
|
||||
Click="Button_Click"
|
||||
Content="{DynamicResource commonOK}" />
|
||||
<Button
|
||||
x:Name="btnYes"
|
||||
MinWidth="140"
|
||||
MinWidth="120"
|
||||
Margin="5 0 5 0"
|
||||
Click="Button_Click"
|
||||
Content="{DynamicResource commonYes}" />
|
||||
<Button
|
||||
x:Name="btnNo"
|
||||
MinWidth="140"
|
||||
MinWidth="120"
|
||||
Margin="5 0 5 0"
|
||||
Click="Button_Click"
|
||||
Content="{DynamicResource commonNo}" />
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
MinWidth="140"
|
||||
MinWidth="120"
|
||||
Margin="5 0 5 0"
|
||||
Click="Button_Click"
|
||||
Content="{DynamicResource commonCancel}" />
|
||||
|
|
|
|||
|
|
@ -8,14 +8,16 @@ namespace Flow.Launcher.Core
|
|||
{
|
||||
public partial class MessageBoxEx : Window
|
||||
{
|
||||
public MessageBoxEx()
|
||||
private static MessageBoxEx msgBox;
|
||||
private static MessageBoxResult _result = MessageBoxResult.None;
|
||||
private static MessageBoxButton _button;
|
||||
|
||||
private MessageBoxEx(MessageBoxButton button)
|
||||
{
|
||||
_button = button;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
static MessageBoxEx msgBox;
|
||||
static MessageBoxResult _result = MessageBoxResult.No;
|
||||
|
||||
/// 1 parameter
|
||||
public static MessageBoxResult Show(string messageBoxText)
|
||||
{
|
||||
|
|
@ -43,17 +45,18 @@ namespace Flow.Launcher.Core
|
|||
// 5 parameter, Final Display Message.
|
||||
public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult)
|
||||
{
|
||||
msgBox = new MessageBoxEx();
|
||||
msgBox = new MessageBoxEx(button);
|
||||
if (caption == string.Empty && button == MessageBoxButton.OK && icon == MessageBoxImage.None)
|
||||
{
|
||||
msgBox.DescOnlyTextBlock.Text = messageBoxText;
|
||||
msgBox.Title = messageBoxText;
|
||||
msgBox.DescOnlyTextBlock.Visibility = Visibility.Visible;
|
||||
msgBox.DescOnlyTextBlock.Text = messageBoxText;
|
||||
}
|
||||
else
|
||||
{
|
||||
msgBox.Title = caption;
|
||||
msgBox.TitleTextBlock.Text = caption;
|
||||
msgBox.DescTextBlock.Text = messageBoxText;
|
||||
msgBox.Title = caption;
|
||||
SetImageOfMessageBox(icon);
|
||||
}
|
||||
SetVisibilityOfButtons(button, defaultResult);
|
||||
|
|
@ -136,6 +139,12 @@ namespace Flow.Launcher.Core
|
|||
|
||||
private void KeyEsc_OnPress(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
if (_button == MessageBoxButton.YesNo)
|
||||
return;
|
||||
else if (_button == MessageBoxButton.OK)
|
||||
_result = MessageBoxResult.OK;
|
||||
else
|
||||
_result = MessageBoxResult.Cancel;
|
||||
DialogResult = false;
|
||||
Close();
|
||||
}
|
||||
|
|
@ -158,6 +167,12 @@ namespace Flow.Launcher.Core
|
|||
|
||||
private void Button_Cancel(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_button == MessageBoxButton.YesNo)
|
||||
return;
|
||||
else if (_button == MessageBoxButton.OK)
|
||||
_result = MessageBoxResult.OK;
|
||||
else
|
||||
_result = MessageBoxResult.Cancel;
|
||||
msgBox.Close();
|
||||
msgBox = null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue