Commit 9c59bf6a authored by 潘栩锋's avatar 潘栩锋 🚴

添加 Prompt 提示输入框

parent 88b4c13d
...@@ -120,6 +120,9 @@ ...@@ -120,6 +120,9 @@
<Compile Include="UI.OSK\WdNumKeyboard.xaml.cs"> <Compile Include="UI.OSK\WdNumKeyboard.xaml.cs">
<DependentUpon>WdNumKeyboard.xaml</DependentUpon> <DependentUpon>WdNumKeyboard.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Prompt.xaml.cs">
<DependentUpon>Prompt.xaml</DependentUpon>
</Compile>
<Compile Include="WindowBigClose.cs" /> <Compile Include="WindowBigClose.cs" />
<Compile Include="Window_Tip.xaml.cs"> <Compile Include="Window_Tip.xaml.cs">
<DependentUpon>Window_Tip.xaml</DependentUpon> <DependentUpon>Window_Tip.xaml</DependentUpon>
...@@ -238,6 +241,10 @@ ...@@ -238,6 +241,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Prompt.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Window_Tip.xaml"> <Page Include="Window_Tip.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
......
<flyctrllib:WindowBigClose
x:Class="FLY.ControlLibrary.Prompt"
xmlns:flyctrllib="clr-namespace:FLY.ControlLibrary"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
SizeToContent="WidthAndHeight">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid TextBlock.FontSize="24" TextBlock.FontStyle="Normal" Background="WhiteSmoke">
<StackPanel Orientation="Vertical" Margin="5" MinWidth="400">
<TextBlock x:Name="textblock_message" Text="message" FontSize="40" Margin="10,40,10,10" />
<TextBox x:Name="textbox_input" Style="{StaticResource TextBoxStyle_FieldContent}" Tag="Full" Width="auto" Margin="10,10,10,40" />
<Button Style="{StaticResource ButtonStyle_apply}" Click="button_ok_Click"/>
</StackPanel>
</Grid>
</flyctrllib:WindowBigClose >
using System.Windows;
namespace FLY.ControlLibrary
{
/// <summary>
/// 提示输入文本框
/// </summary>
public partial class Prompt : WindowBigClose
{
public Prompt()
{
InitializeComponent();
}
public static bool Show(string message, ref string input)
{
Prompt mb = new Prompt();
mb.textblock_message.Text = message;
mb.textbox_input.Text = input;
mb.Owner = Application.Current.MainWindow;
if (mb.ShowDialog() == true)
{
input = mb.textbox_input.Text;
return true;
}
else
{
return false;
}
}
private void button_ok_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
this.Close();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment