Skip to content

Commit 9e5cfd2

Browse files
committed
Add messageBoxEx prototype
1 parent 9ac5d42 commit 9e5cfd2

File tree

4 files changed

+178
-3
lines changed

4 files changed

+178
-3
lines changed

Flow.Launcher/MessageBoxEx.xaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<Window
2+
x:Class="Flow.Launcher.MessageBoxEx"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:Flow.Launcher"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
Title="MessageBoxEx"
9+
Width="800"
10+
Height="450"
11+
ResizeMode="NoResize"
12+
WindowStartupLocation="CenterScreen"
13+
mc:Ignorable="d">
14+
<WindowChrome.WindowChrome>
15+
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
16+
</WindowChrome.WindowChrome>
17+
<Window.InputBindings>
18+
<KeyBinding Key="Escape" Command="Close" />
19+
</Window.InputBindings>
20+
<Window.CommandBindings>
21+
<CommandBinding Command="Close" Executed="cmdEsc_OnPress" />
22+
</Window.CommandBindings>
23+
<Grid>
24+
<Grid.RowDefinitions>
25+
<RowDefinition />
26+
<RowDefinition Height="80" />
27+
</Grid.RowDefinitions>
28+
<StackPanel Grid.Row="0">
29+
<StackPanel>
30+
<Grid>
31+
<Grid.ColumnDefinitions>
32+
<ColumnDefinition Width="Auto" />
33+
<ColumnDefinition Width="*" />
34+
<ColumnDefinition Width="Auto" />
35+
<ColumnDefinition Width="Auto" />
36+
<ColumnDefinition Width="Auto" />
37+
</Grid.ColumnDefinitions>
38+
<Button
39+
Grid.Column="4"
40+
Click="BtnCancel_OnClick"
41+
Style="{StaticResource TitleBarCloseButtonStyle}">
42+
<Path
43+
Width="46"
44+
Height="32"
45+
Data="M 18,11 27,20 M 18,20 27,11"
46+
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
47+
StrokeThickness="1">
48+
<Path.Style>
49+
<Style TargetType="Path">
50+
<Style.Triggers>
51+
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="False">
52+
<Setter Property="Opacity" Value="0.5" />
53+
</DataTrigger>
54+
</Style.Triggers>
55+
</Style>
56+
</Path.Style>
57+
</Path>
58+
</Button>
59+
</Grid>
60+
</StackPanel>
61+
<StackPanel Margin="26,0,26,0">
62+
<StackPanel Grid.Row="0" Margin="0,0,0,12">
63+
<TextBlock
64+
x:Name="TitleTextBlock"
65+
Grid.Column="0"
66+
Margin="0,0,0,0"
67+
FontFamily="Segoe UI"
68+
FontSize="20"
69+
FontWeight="SemiBold"
70+
TextAlignment="Left" />
71+
</StackPanel>
72+
<StackPanel>
73+
<TextBlock
74+
x:Name="DescTextBlock"
75+
FontSize="14"
76+
TextAlignment="Left"
77+
TextWrapping="WrapWithOverflow" />
78+
</StackPanel>
79+
</StackPanel>
80+
</StackPanel>
81+
<Border
82+
Grid.Row="1"
83+
Margin="0,14,0,0"
84+
Background="{DynamicResource PopupButtonAreaBGColor}"
85+
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
86+
BorderThickness="0,1,0,0">
87+
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
88+
<Button
89+
x:Name="btnCancel"
90+
MinWidth="140"
91+
Margin="10,0,5,0"
92+
Click="BtnCancel_OnClick"
93+
Content="{DynamicResource cancel}" />
94+
<Button
95+
x:Name="btnAdd"
96+
MinWidth="140"
97+
Margin="5,0,10,0"
98+
Click="BtnAdd_OnClick"
99+
Style="{StaticResource AccentButtonStyle}">
100+
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
101+
</Button>
102+
</StackPanel>
103+
</Border>
104+
</Grid>
105+
</Window>

Flow.Launcher/MessageBoxEx.xaml.cs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Forms;
11+
using System.Windows.Input;
12+
using System.Windows.Media;
13+
using System.Windows.Media.Imaging;
14+
using System.Windows.Shapes;
15+
using Flow.Launcher.Core.Resource;
16+
using YamlDotNet.Core.Tokens;
17+
18+
namespace Flow.Launcher
19+
{
20+
/// <summary>
21+
/// MessageBoxEx.xaml에 대한 상호 작용 논리
22+
/// </summary>
23+
public partial class MessageBoxEx : Window
24+
{
25+
static MessageBoxEx msgBox;
26+
static string Button_id;
27+
public MessageBoxEx()
28+
{
29+
InitializeComponent();
30+
}
31+
32+
33+
public static string Show(string txtMessage, string txtTitle)
34+
{
35+
msgBox = new MessageBoxEx();
36+
msgBox.TitleTextBlock.Text = txtTitle;
37+
msgBox.DescTextBlock.Text = txtMessage;
38+
//msgBox.label1.Text = txtMessage;
39+
//msgBox.Text = txtTitle;
40+
msgBox.ShowDialog();
41+
return Button_id;
42+
}
43+
44+
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
45+
{
46+
DialogResult = false;
47+
Close();
48+
}
49+
50+
private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
51+
{
52+
53+
Close();
54+
}
55+
56+
private void cmdEsc_OnPress(object sender, ExecutedRoutedEventArgs e)
57+
{
58+
DialogResult = false;
59+
Close();
60+
}
61+
}
62+
}

Flow.Launcher/SettingWindow.xaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@
4848
<scm:SortDescription PropertyName="Source" />
4949
</CollectionViewSource.SortDescriptions>
5050
</CollectionViewSource>
51-
<CollectionViewSource x:Key="PluginStoreCollectionView"
52-
Source="{Binding ExternalPlugins}">
51+
<CollectionViewSource x:Key="PluginStoreCollectionView" Source="{Binding ExternalPlugins}">
5352
<CollectionViewSource.GroupDescriptions>
54-
<PropertyGroupDescription PropertyName="Category"></PropertyGroupDescription>
53+
<PropertyGroupDescription PropertyName="Category" />
5554
</CollectionViewSource.GroupDescriptions>
5655
</CollectionViewSource>
5756

@@ -2906,7 +2905,12 @@
29062905
Margin="0,0,12,0"
29072906
Click="ClearLogFolder"
29082907
Content="{Binding CheckLogFolder, UpdateSourceTrigger=PropertyChanged}" />
2908+
<Button
2909+
Margin="0,0,12,0"
2910+
Click="OpenTestBtn"
2911+
Content="Open Test" />
29092912
<Button Click="OpenLogFolder" Content="{DynamicResource logfolder}" />
2913+
29102914
</StackPanel>
29112915
<TextBlock Style="{StaticResource Glyph}">
29122916
&#xec7a;

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,10 @@ private void OpenWelcomeWindow(object sender, RoutedEventArgs e)
278278
var WelcomeWindow = new WelcomeWindow(settings);
279279
WelcomeWindow.ShowDialog();
280280
}
281+
private void OpenTestBtn(object sender, RoutedEventArgs e)
282+
{
283+
var messageBoxResult = MessageBoxEx.Show("Message Box Title", "Are you sure?");
284+
}
281285
private void OpenLogFolder(object sender, RoutedEventArgs e)
282286
{
283287
PluginManager.API.OpenDirectory(Path.Combine(DataLocation.DataDirectory(), Constant.Logs, Constant.Version));

0 commit comments

Comments
 (0)