Merge pull request #344 from HandyOrg/pr/339

Pr/339
This commit is contained in:
NaBian authored and GitHub committed 2020-03-29 23:59:17 +08:00
commit 62190db4bc
11 files changed
+86 -45

No files matched your search

@@ -46,5 +46,7 @@
public static readonly string NavigationWindow = nameof(NavigationWindow);
public static readonly string DialogContainer = nameof(DialogContainer);
}
}
@@ -25,7 +25,8 @@ var messageList = new List<string>
"QQGroupView",
"GlowWindow",
"NativeCommonWindow",
"NavigationWindow"
"NavigationWindow",
"DialogContainer"
};
#>
namespace HandyControlDemo.Data
@@ -1725,6 +1725,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 文本对话框(控件中) 的本地化字符串。
/// </summary>
public static string TextDialogInControl {
get {
return ResourceManager.GetString("TextDialogInControl", resourceCulture);
}
}
/// <summary>
/// 查找类似 文本对话框,带计时器 的本地化字符串。
/// </summary>
@@ -744,4 +744,7 @@
<data name="Screenshot" xml:space="preserve">
<value>Screenshot</value>
</data>
<data name="TextDialogInControl" xml:space="preserve">
<value>TextDialog(In control)</value>
</data>
</root>
@@ -744,4 +744,7 @@
<data name="Screenshot" xml:space="preserve">
<value>Screenshot</value>
</data>
<data name="TextDialogInControl" xml:space="preserve">
<value>TextDialog(In control)</value>
</data>
</root>
@@ -744,4 +744,7 @@
<data name="Screenshot" xml:space="preserve">
<value>Screenshot</value>
</data>
<data name="TextDialogInControl" xml:space="preserve">
<value>TextDialog(In control)</value>
</data>
</root>
@@ -744,4 +744,7 @@
<data name="Screenshot" xml:space="preserve">
<value>Screenshot</value>
</data>
<data name="TextDialogInControl" xml:space="preserve">
<value>TextDialog(In control)</value>
</data>
</root>
@@ -744,4 +744,7 @@
<data name="Screenshot" xml:space="preserve">
<value>截图</value>
</data>
<data name="TextDialogInControl" xml:space="preserve">
<value>文本对话框(控件中)</value>
</data>
</root>
@@ -3,16 +3,23 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:data="clr-namespace:HandyControlDemo.Data"
hc:Dialog.Token="{x:Static data:MessageToken.DialogContainer}"
Background="{DynamicResource RegionBrush}"
MinWidth="300"
MinWidth="500"
DataContext="{Binding DialogDemo,Source={StaticResource Locator}}">
<hc:TransitioningContentControl>
<StackPanel Margin="32" VerticalAlignment="Center">
<Button Content="{x:Static langs:Lang.TextDialog}" Command="{Binding ShowTextCmd}" />
<Button Margin="0,32,0,0" Content="{x:Static langs:Lang.TextDialogWithTimer}" Command="{Binding ShowInteractiveDialogCmd}" CommandParameter="True"/>
<TextBox Margin="0,32,0,0" Text="{Binding DialogResult,UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource TextBoxExtend}" hc:InfoElement.Placeholder="{x:Static langs:Lang.PleaseInput}"/>
<Button Margin="0,10,0,0" Content="{x:Static langs:Lang.InteractiveDialog}" Command="{Binding ShowInteractiveDialogCmd}"/>
<Button Margin="0,32,0,0" Content="{x:Static langs:Lang.NewWindow}" Command="{Binding NewWindowCmd}"/>
</StackPanel>
</hc:TransitioningContentControl>
<AdornerDecorator>
<hc:TransitioningContentControl>
<hc:SimplePanel>
<StackPanel Margin="32" VerticalAlignment="Center">
<Button Content="{x:Static langs:Lang.TextDialog}" Command="{Binding ShowTextCmd}" />
<Button Margin="0,32,0,0" Content="{x:Static langs:Lang.TextDialogInControl}" Command="{Binding ShowTextCmd}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType=UserControl}}"/>
<Button Margin="0,32,0,0" Content="{x:Static langs:Lang.TextDialogWithTimer}" Command="{Binding ShowInteractiveDialogCmd}" CommandParameter="True"/>
<TextBox Margin="0,32,0,0" Text="{Binding DialogResult,UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource TextBoxExtend}" hc:InfoElement.Placeholder="{x:Static langs:Lang.PleaseInput}"/>
<Button Margin="0,10,0,0" Content="{x:Static langs:Lang.InteractiveDialog}" Command="{Binding ShowInteractiveDialogCmd}"/>
<Button Margin="0,32,0,0" Content="{x:Static langs:Lang.NewWindow}" Command="{Binding NewWindowCmd}"/>
</StackPanel>
</hc:SimplePanel>
</hc:TransitioningContentControl>
</AdornerDecorator>
</UserControl>
@@ -29,12 +29,19 @@ namespace HandyControlDemo.ViewModel
#endif
}
public RelayCommand ShowTextCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(ShowText)).Value;
public RelayCommand<FrameworkElement> ShowTextCmd => new Lazy<RelayCommand<FrameworkElement>>(() =>
new RelayCommand<FrameworkElement>(ShowText)).Value;
private void ShowText()
private void ShowText(FrameworkElement element)
{
Dialog.Show(new TextDialog());
if (element == null)
{
Dialog.Show(new TextDialog());
}
else
{
Dialog.Show(new TextDialog(), MessageToken.DialogContainer);
}
}
#if netle40