Skip to content

Commit

Permalink
chore: Optimized the addition of official service links
Browse files Browse the repository at this point in the history
  • Loading branch information
ZGGSONG committed Jan 14, 2024
1 parent 9821b43 commit 5b1ff9b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
12 changes: 10 additions & 2 deletions STranslate/Views/Preference/Service/TextBaiduServicesPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:STranslate.Views.Preference.Service"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:STranslate.ViewModels.Preference.Services"
d:DataContext="{d:DesignInstance Type=vm:TranslatorBaidu}"
Expand Down Expand Up @@ -82,6 +81,15 @@
ItemsSource="{Binding Icons}"
SelectedValue="{Binding Icon}" />
</Grid>

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Other: " />
<TextBlock Grid.Column="1" Margin="10,0" ToolTip="在浏览器中打开"><Hyperlink Click="Hyperlink_Click">进入官网</Hyperlink></TextBlock>
</Grid>
</StackPanel>
</Border>
</UserControl>
</UserControl>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using STranslate.Model;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using STranslate.Model;

namespace STranslate.Views.Preference.Service
{
Expand All @@ -20,5 +22,8 @@ public void UpdateVM(ITranslator vm)
{
DataContext = vm;
}

private void Hyperlink_Click(object sender, RoutedEventArgs e) =>
Process.Start(new ProcessStartInfo { FileName = "https://fanyi-api.baidu.com/", UseShellExecute = true });
}
}
12 changes: 10 additions & 2 deletions STranslate/Views/Preference/Service/TextBingServicesPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:STranslate.Views.Preference.Service"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:STranslate.ViewModels.Preference.Services"
d:DataContext="{d:DesignInstance Type=vm:TranslatorBing}"
Expand Down Expand Up @@ -82,6 +81,15 @@
ItemsSource="{Binding Icons}"
SelectedValue="{Binding Icon}" />
</Grid>

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Other: " />
<TextBlock Grid.Column="1" Margin="10,0" ToolTip="在浏览器中打开"><Hyperlink Click="Hyperlink_Click">进入官网</Hyperlink></TextBlock>
</Grid>
</StackPanel>
</Border>
</UserControl>
</UserControl>
13 changes: 12 additions & 1 deletion STranslate/Views/Preference/Service/TextBingServicesPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using STranslate.Model;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using STranslate.Model;

namespace STranslate.Views.Preference.Service
{
Expand All @@ -20,5 +22,14 @@ public void UpdateVM(ITranslator vm)
{
DataContext = vm;
}

private void Hyperlink_Click(object sender, RoutedEventArgs e) =>
Process.Start(
new ProcessStartInfo
{
FileName = "https://azure.microsoft.com/zh-cn/products/ai-services/ai-translator",
UseShellExecute = true
}
);
}
}

0 comments on commit 5b1ff9b

Please sign in to comment.