imradv3 / src /WpfEditor /OCRResultWindow.xaml.cs
fasdfsa's picture
增加 Naverja 右键查询
b355108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace WpfEditor
{
/// <summary>
/// OCRResultWindow.xaml 的交互逻辑
/// </summary>
public partial class OCRResultWindow : Window
{
private string selectText = "";
public OCRResultWindow(string text="")
{
InitializeComponent();
if (text.Length > 0)
{
richTextBox.AppendText(text);
}
richTextBox.PreviewMouseRightButtonUp += RichTextBox_PreviewMouseRightButtonUp;
}
private void RichTextBox_PreviewMouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
var selected = richTextBox.Selection.Text;
if (selectText != selected)
{
selectText = selected;
}
}
private void CutMenuItem_Click(object sender, RoutedEventArgs e)
{
richTextBox.Cut();
}
private void CopyMenuItem_Click(object sender, RoutedEventArgs e)
{
richTextBox.Copy();
}
private void PasteMenuItem_Click(object sender, RoutedEventArgs e)
{
richTextBox.Paste();
}
private void JishoMenuItem_Click(object sender, RoutedEventArgs e)
{
var content = System.Web.HttpUtility.UrlEncode(this.selectText);
String url = $"https://jisho.org/search/{content}";
//BrowserHelper.OpenBrowserUrl(url, BrowserType.Google);
}
private void NaverMenuItem_Click(object sender, RoutedEventArgs e)
{
var content = System.Web.HttpUtility.UrlEncode(this.selectText);
String url = $"https://ko.dict.naver.com/#/search?query={content}";
//BrowserHelper.OpenBrowserUrl(url, BrowserType.Google);
}
private void NaverjaMenuItem_Click(object sender, RoutedEventArgs e)
{
var content = System.Web.HttpUtility.UrlEncode(this.selectText);
String url = $"https://ja.dict.naver.com/#/search?query={content}&range=all";
//BrowserHelper.OpenBrowserUrl(url, BrowserType.Google);
}
private void EchodictMenuItem_Click(object sender, RoutedEventArgs e)
{
//var win = new EchoDictWindow(selectText);
//win.Show();
}
}
}