mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add Images / Adjust Layouts
This commit is contained in:
parent
9e5cfd2f1c
commit
3c647e0078
9 changed files with 213 additions and 63 deletions
|
|
@ -6,12 +6,12 @@
|
|||
Title="{DynamicResource customeQueryShortcutTitle}"
|
||||
Width="530"
|
||||
Background="{DynamicResource PopuBGColor}"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||
Foreground="{DynamicResource PopupTextColor}"
|
||||
Icon="Images\app.png"
|
||||
ResizeMode="NoResize"
|
||||
SizeToContent="Height"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}">
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
|
||||
</WindowChrome.WindowChrome>
|
||||
|
|
@ -100,8 +100,7 @@
|
|||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="10"
|
||||
Text="{Binding Key}"
|
||||
/>
|
||||
Text="{Binding Key}" />
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
|
|
@ -126,8 +125,8 @@
|
|||
x:Name="tbExpand"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="{Binding Value}"
|
||||
VerticalAlignment="Center" />
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Value}" />
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
|
|
|||
BIN
Flow.Launcher/Images/Error.png
Normal file
BIN
Flow.Launcher/Images/Error.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
BIN
Flow.Launcher/Images/Exclamation.png
Normal file
BIN
Flow.Launcher/Images/Exclamation.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
BIN
Flow.Launcher/Images/Information.png
Normal file
BIN
Flow.Launcher/Images/Information.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
BIN
Flow.Launcher/Images/Question.png
Normal file
BIN
Flow.Launcher/Images/Question.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
|
|
@ -5,10 +5,11 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Flow.Launcher"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="MessageBoxEx"
|
||||
Width="800"
|
||||
Height="450"
|
||||
x:Name="MessageBoxWindow"
|
||||
Width="420"
|
||||
Height="Auto"
|
||||
ResizeMode="NoResize"
|
||||
SizeToContent="Height"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<WindowChrome.WindowChrome>
|
||||
|
|
@ -22,8 +23,9 @@
|
|||
</Window.CommandBindings>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="80" />
|
||||
<RowDefinition MinHeight="68" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0">
|
||||
<StackPanel>
|
||||
|
|
@ -37,7 +39,7 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
Grid.Column="4"
|
||||
Click="BtnCancel_OnClick"
|
||||
Click="Button_Cancel"
|
||||
Style="{StaticResource TitleBarCloseButtonStyle}">
|
||||
<Path
|
||||
Width="46"
|
||||
|
|
@ -58,48 +60,77 @@
|
|||
</Button>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="26,0,26,0">
|
||||
<StackPanel Grid.Row="0" Margin="0,0,0,12">
|
||||
<TextBlock
|
||||
x:Name="TitleTextBlock"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,0,0"
|
||||
FontFamily="Segoe UI"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
TextAlignment="Left" />
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
x:Name="DescTextBlock"
|
||||
FontSize="14"
|
||||
TextAlignment="Left"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Margin="0,0,0,24">
|
||||
<Grid Grid.Column="0" Margin="0,0,0,12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image
|
||||
Name="Img"
|
||||
Grid.Column="0"
|
||||
Width="18"
|
||||
Height="18"
|
||||
Margin="30,0,10,0"
|
||||
HorizontalAlignment="Left"
|
||||
Visibility="Collapsed" />
|
||||
<TextBlock
|
||||
x:Name="TitleTextBlock"
|
||||
Grid.Column="1"
|
||||
MaxWidth="400"
|
||||
Margin="26,0,26,0"
|
||||
FontFamily="Segoe UI"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
TextAlignment="Left"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
<TextBlock
|
||||
x:Name="DescTextBlock"
|
||||
Grid.Column="1"
|
||||
MaxWidth="400"
|
||||
Margin="26,0,26,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
FontSize="14"
|
||||
TextAlignment="Left"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Margin="0,14,0,0"
|
||||
Grid.Row="2"
|
||||
Margin="0,0,0,0"
|
||||
Background="{DynamicResource PopupButtonAreaBGColor}"
|
||||
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
|
||||
BorderThickness="0,1,0,0">
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
<WrapPanel
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
MinWidth="140"
|
||||
Margin="10,0,5,0"
|
||||
Click="BtnCancel_OnClick"
|
||||
Margin="5,0,5,0"
|
||||
Click="Button_Click"
|
||||
Content="{DynamicResource cancel}" />
|
||||
<Button
|
||||
x:Name="btnAdd"
|
||||
x:Name="btnNo"
|
||||
MinWidth="140"
|
||||
Margin="5,0,10,0"
|
||||
Click="BtnAdd_OnClick"
|
||||
Style="{StaticResource AccentButtonStyle}">
|
||||
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
Margin="5,0,5,0"
|
||||
Click="Button_Click"
|
||||
Content="{DynamicResource cancel}" />
|
||||
<Button
|
||||
x:Name="btnOk"
|
||||
MinWidth="140"
|
||||
Margin="5,0,5,0"
|
||||
Click="Button_Click"
|
||||
Content="{DynamicResource done}" />
|
||||
<Button
|
||||
x:Name="btnYes"
|
||||
MinWidth="140"
|
||||
Margin="5,0,5,0"
|
||||
Click="Button_Click"
|
||||
Content="{DynamicResource done}" />
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
@ -17,46 +17,166 @@ using YamlDotNet.Core.Tokens;
|
|||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
/// <summary>
|
||||
/// MessageBoxEx.xaml에 대한 상호 작용 논리
|
||||
/// </summary>
|
||||
public partial class MessageBoxEx : Window
|
||||
{
|
||||
static MessageBoxEx msgBox;
|
||||
static string Button_id;
|
||||
public MessageBoxEx()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public enum MessageBoxType
|
||||
{
|
||||
ConfirmationWithYesNo = 0,
|
||||
ConfirmationWithYesNoCancel,
|
||||
Information,
|
||||
Error,
|
||||
Warning
|
||||
}
|
||||
|
||||
public static string Show(string txtMessage, string txtTitle)
|
||||
public enum MessageBoxImage
|
||||
{
|
||||
Warning = 0,
|
||||
Question,
|
||||
Information,
|
||||
Error,
|
||||
None
|
||||
}
|
||||
|
||||
static MessageBoxEx msgBox;
|
||||
static MessageBoxResult _result = MessageBoxResult.No;
|
||||
|
||||
|
||||
/// 1 parameter
|
||||
public static MessageBoxResult Show(string msg)
|
||||
{
|
||||
return Show(string.Empty, msg, MessageBoxButton.OK, MessageBoxImage.None);
|
||||
}
|
||||
|
||||
// 2 parameter
|
||||
public static MessageBoxResult Show(string caption, string text)
|
||||
{
|
||||
return Show(caption, text, MessageBoxButton.OK, MessageBoxImage.None);
|
||||
}
|
||||
|
||||
/// 3 parameter
|
||||
public static MessageBoxResult Show(string caption, string msg, MessageBoxType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MessageBoxType.ConfirmationWithYesNo:
|
||||
return Show(caption, msg, MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
case MessageBoxType.ConfirmationWithYesNoCancel:
|
||||
return Show(caption, msg, MessageBoxButton.YesNoCancel,
|
||||
MessageBoxImage.Question);
|
||||
case MessageBoxType.Information:
|
||||
return Show(caption, msg, MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
case MessageBoxType.Error:
|
||||
return Show(caption, msg, MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
case MessageBoxType.Warning:
|
||||
return Show(caption, msg, MessageBoxButton.OK,
|
||||
MessageBoxImage.Warning);
|
||||
default:
|
||||
return MessageBoxResult.No;
|
||||
}
|
||||
}
|
||||
|
||||
// 4 parameter, Final Display Message.
|
||||
public static MessageBoxResult Show(string caption, string text, MessageBoxButton button, MessageBoxImage image)
|
||||
{
|
||||
msgBox = new MessageBoxEx();
|
||||
msgBox.TitleTextBlock.Text = txtTitle;
|
||||
msgBox.DescTextBlock.Text = txtMessage;
|
||||
//msgBox.label1.Text = txtMessage;
|
||||
//msgBox.Text = txtTitle;
|
||||
msgBox.TitleTextBlock.Text = text;
|
||||
msgBox.DescTextBlock.Text = caption;
|
||||
msgBox.Title = text;
|
||||
SetVisibilityOfButtons(button);
|
||||
SetImageOfMessageBox(image);
|
||||
msgBox.ShowDialog();
|
||||
return Button_id;
|
||||
return _result;
|
||||
}
|
||||
|
||||
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
Close();
|
||||
if (sender == btnOk)
|
||||
_result = MessageBoxResult.OK;
|
||||
else if (sender == btnYes)
|
||||
_result = MessageBoxResult.Yes;
|
||||
else if (sender == btnNo)
|
||||
_result = MessageBoxResult.No;
|
||||
else if (sender == btnCancel)
|
||||
_result = MessageBoxResult.Cancel;
|
||||
else
|
||||
_result = MessageBoxResult.None;
|
||||
msgBox.Close();
|
||||
msgBox = null;
|
||||
}
|
||||
|
||||
private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
|
||||
private static void SetVisibilityOfButtons(MessageBoxButton button)
|
||||
{
|
||||
|
||||
Close();
|
||||
switch (button)
|
||||
{
|
||||
case MessageBoxButton.OK:
|
||||
msgBox.btnCancel.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnNo.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnYes.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnOk.Focus();
|
||||
break;
|
||||
case MessageBoxButton.OKCancel:
|
||||
msgBox.btnNo.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnYes.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnCancel.Focus();
|
||||
break;
|
||||
case MessageBoxButton.YesNo:
|
||||
msgBox.btnOk.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnCancel.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnNo.Focus();
|
||||
break;
|
||||
case MessageBoxButton.YesNoCancel:
|
||||
msgBox.btnOk.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnCancel.Focus();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
private static void SetImageOfMessageBox(MessageBoxImage image)
|
||||
{
|
||||
switch (image)
|
||||
{
|
||||
case MessageBoxImage.Warning:
|
||||
msgBox.SetImage("Warning.png");
|
||||
break;
|
||||
case MessageBoxImage.Question:
|
||||
msgBox.SetImage("Question.png");
|
||||
break;
|
||||
case MessageBoxImage.Information:
|
||||
msgBox.SetImage("Information.png");
|
||||
break;
|
||||
case MessageBoxImage.Error:
|
||||
msgBox.SetImage("Error.png");
|
||||
break;
|
||||
default:
|
||||
msgBox.Img.Visibility = Visibility.Collapsed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void SetImage(string imageName)
|
||||
{
|
||||
string uri = string.Format("/Images/{0}", imageName);
|
||||
var uriSource = new Uri(uri, UriKind.RelativeOrAbsolute);
|
||||
Img.Source = new BitmapImage(uriSource);
|
||||
}
|
||||
|
||||
private void cmdEsc_OnPress(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Button_Cancel(object sender, RoutedEventArgs e)
|
||||
{
|
||||
msgBox.Close();
|
||||
msgBox = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2905,7 +2905,7 @@
|
|||
Margin="0,0,12,0"
|
||||
Click="ClearLogFolder"
|
||||
Content="{Binding CheckLogFolder, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button
|
||||
<Button Name="TestBtn"
|
||||
Margin="0,0,12,0"
|
||||
Click="OpenTestBtn"
|
||||
Content="Open Test" />
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ namespace Flow.Launcher
|
|||
}
|
||||
private void OpenTestBtn(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var messageBoxResult = MessageBoxEx.Show("Message Box Title", "Are you sure?");
|
||||
var messageBoxResult = MessageBoxEx.Show("The TitleBarBackground property can be used to set the background for the Title bar. ... The following screen shots illustrate the title bar background changes.", "This is Title Part This is Title Part This is Title Part This is Title Part");
|
||||
}
|
||||
private void OpenLogFolder(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue