diff --git a/Flow.Launcher/CustomShortcutSetting.xaml b/Flow.Launcher/CustomShortcutSetting.xaml
index 78b392f3e..f0340eead 100644
--- a/Flow.Launcher/CustomShortcutSetting.xaml
+++ b/Flow.Launcher/CustomShortcutSetting.xaml
@@ -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">
@@ -100,8 +100,7 @@
Grid.Row="0"
Grid.Column="1"
Margin="10"
- Text="{Binding Key}"
- />
+ Text="{Binding Key}" />
+ VerticalAlignment="Center"
+ Text="{Binding Value}" />
diff --git a/Flow.Launcher/Images/Error.png b/Flow.Launcher/Images/Error.png
new file mode 100644
index 000000000..74acc5d0e
Binary files /dev/null and b/Flow.Launcher/Images/Error.png differ
diff --git a/Flow.Launcher/Images/Exclamation.png b/Flow.Launcher/Images/Exclamation.png
new file mode 100644
index 000000000..f9fed80ee
Binary files /dev/null and b/Flow.Launcher/Images/Exclamation.png differ
diff --git a/Flow.Launcher/Images/Information.png b/Flow.Launcher/Images/Information.png
new file mode 100644
index 000000000..4043ed98a
Binary files /dev/null and b/Flow.Launcher/Images/Information.png differ
diff --git a/Flow.Launcher/Images/Question.png b/Flow.Launcher/Images/Question.png
new file mode 100644
index 000000000..4cb539230
Binary files /dev/null and b/Flow.Launcher/Images/Question.png differ
diff --git a/Flow.Launcher/MessageBoxEx.xaml b/Flow.Launcher/MessageBoxEx.xaml
index 9528b764d..5869fb4bc 100644
--- a/Flow.Launcher/MessageBoxEx.xaml
+++ b/Flow.Launcher/MessageBoxEx.xaml
@@ -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">
@@ -22,8 +23,9 @@
+
-
+
@@ -37,7 +39,7 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+ Margin="5,0,5,0"
+ Click="Button_Click"
+ Content="{DynamicResource cancel}" />
+
+
+
\ No newline at end of file
diff --git a/Flow.Launcher/MessageBoxEx.xaml.cs b/Flow.Launcher/MessageBoxEx.xaml.cs
index dccf8131b..be3f1fd99 100644
--- a/Flow.Launcher/MessageBoxEx.xaml.cs
+++ b/Flow.Launcher/MessageBoxEx.xaml.cs
@@ -17,46 +17,166 @@ using YamlDotNet.Core.Tokens;
namespace Flow.Launcher
{
- ///
- /// MessageBoxEx.xaml에 대한 상호 작용 논리
- ///
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;
+ }
+
}
}
diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml
index c246db1af..559df1e8d 100644
--- a/Flow.Launcher/SettingWindow.xaml
+++ b/Flow.Launcher/SettingWindow.xaml
@@ -2905,7 +2905,7 @@
Margin="0,0,12,0"
Click="ClearLogFolder"
Content="{Binding CheckLogFolder, UpdateSourceTrigger=PropertyChanged}" />
-
diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs
index 38537f828..f133f5593 100644
--- a/Flow.Launcher/SettingWindow.xaml.cs
+++ b/Flow.Launcher/SettingWindow.xaml.cs
@@ -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)
{