fix: copy cmd notify delay problem

dev_without_third_libraries
DESKTOP-3BO4HSG\ksat 2 years ago
parent c286988a74
commit 0750b8072e

@ -22,6 +22,9 @@
<Window.DataContext> <Window.DataContext>
<vm:MainVM /> <vm:MainVM />
</Window.DataContext> </Window.DataContext>
<Window.Resources>
<hc:String2VisibilityConverter x:Key="String2VisibilityConverter"/>
</Window.Resources>
<Border BorderThickness="0" <Border BorderThickness="0"
Background="#fff" Background="#fff"
CornerRadius="10"> CornerRadius="10">
@ -107,6 +110,7 @@
Margin="5,0,0,5" Margin="5,0,0,5"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
Visibility="{Binding InputTxt,Converter={StaticResource String2VisibilityConverter}}"
Command="{Binding CopyInputCmd}"> Command="{Binding CopyInputCmd}">
<Image Source="/Images/copy2.png"/> <Image Source="/Images/copy2.png"/>
</Button> </Button>
@ -182,6 +186,7 @@
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
ToolTip="直接复制" ToolTip="直接复制"
Visibility="{Binding OutputTxt,Converter={StaticResource String2VisibilityConverter}}"
Command="{Binding CopyResultCmd}"> Command="{Binding CopyResultCmd}">
<Image Source="/Images/copy2.png"/> <Image Source="/Images/copy2.png"/>
</Button> </Button>
@ -191,6 +196,7 @@
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
ToolTip="蛇形" ToolTip="蛇形"
Visibility="{Binding SnakeRet,Converter={StaticResource String2VisibilityConverter}}"
Command="{Binding CopySnakeResultCmd}"> Command="{Binding CopySnakeResultCmd}">
<Image Source="/Images/copy_s.png"/> <Image Source="/Images/copy_s.png"/>
</Button> </Button>
@ -199,6 +205,7 @@
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
ToolTip="小驼峰" ToolTip="小驼峰"
Visibility="{Binding SmallHumpRet,Converter={StaticResource String2VisibilityConverter}}"
Command="{Binding CopySmallHumpResultCmd}"> Command="{Binding CopySmallHumpResultCmd}">
<Image Source="/Images/copy_h.png"/> <Image Source="/Images/copy_h.png"/>
</Button> </Button>
@ -207,6 +214,7 @@
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
ToolTip="大驼峰" ToolTip="大驼峰"
Visibility="{Binding LargeHumpRet,Converter={StaticResource String2VisibilityConverter}}"
Command="{Binding CopyLargeHumpResultCmd}"> Command="{Binding CopyLargeHumpResultCmd}">
<Image Source="/Images/copy_h2.png"/> <Image Source="/Images/copy_h2.png"/>
</Button> </Button>

@ -37,42 +37,27 @@ namespace STranslate.ViewModel
config = ConfigUtil.ReadConfig(ConfigPath); config = ConfigUtil.ReadConfig(ConfigPath);
//复制输入 //复制输入
CopyInputCmd = new RelayCommand((_) => CopyInputCmd = new RelayCommand((_) => true, (_) =>
{
return string.IsNullOrEmpty(InputTxt) ? false : true;
}, (_) =>
{ {
Clipboard.SetText(InputTxt); Clipboard.SetText(InputTxt);
}); });
//复制翻译结果 //复制翻译结果
CopyResultCmd = new RelayCommand((_) => CopyResultCmd = new RelayCommand((_) => true, (_) =>
{
return string.IsNullOrEmpty(OutputTxt) ? false : true;
}, (_) =>
{ {
Clipboard.SetText(OutputTxt); Clipboard.SetText(OutputTxt);
}); });
//复制蛇形结果 //复制蛇形结果
CopySnakeResultCmd = new RelayCommand((_) => CopySnakeResultCmd = new RelayCommand((_) => true, (_) =>
{
return string.IsNullOrEmpty(SnakeRet) ? false : true;
}, (_) =>
{ {
Clipboard.SetText(SnakeRet); Clipboard.SetText(SnakeRet);
}); });
//复制小驼峰结果 //复制小驼峰结果
CopySmallHumpResultCmd = new RelayCommand((_) => CopySmallHumpResultCmd = new RelayCommand((_) => true, (_) =>
{
return string.IsNullOrEmpty(SmallHumpRet) ? false : true;
}, (_) =>
{ {
Clipboard.SetText(SmallHumpRet); Clipboard.SetText(SmallHumpRet);
}); });
//复制大驼峰结果 //复制大驼峰结果
CopyLargeHumpResultCmd = new RelayCommand((_) => CopyLargeHumpResultCmd = new RelayCommand((_) => true, (_) =>
{
return string.IsNullOrEmpty(LargeHumpRet) ? false : true;
}, (_) =>
{ {
Clipboard.SetText(LargeHumpRet); Clipboard.SetText(LargeHumpRet);
}); });

Loading…
Cancel
Save