Other/Translator/MainWindow.xaml.cs

(开头部分) 18KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.Serialization.Json;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Navigation;
using System.Windows.Threading;
using System.Xml.Linq;
using System.Xml.XPath;
using Microsoft.Win32;
using XamlReader = System.Windows.Markup.XamlReader;

namespace Translator
{
    public partial class MainWindow : Window
    {
        private string TempPath => Path.Combine(".", "ScreenToGif", "Resources");

        private readonly List<ResourceDictionary> _resourceList = new List<ResourceDictionary>();
        private ObservableCollection<Translation> _translationList = new ObservableCollection<Translation>();
        private string _resourceTemplate;

        public MainWindow()
        {
            InitializeComponent();
        }

        #region Events

        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            StatusBand.Info("Dowloading available translations...");

            if (!Directory.Exists(TempPath))
                Directory.CreateDirectory(TempPath);

            await DownloadResources();

            var languageList = CultureInfo.GetCultures(CultureTypes.AllCultures).Select(x => new Culture { Code = x.IetfLanguageTag, Name = x.EnglishName }).ToList();
            languageList.RemoveAt(0);

            FromComboBox.ItemsSource = languageList;
            ToComboBox.ItemsSource = languageList;

            HeaderLabel.Content = "Translator";
            MainGrid.IsEnabled = true;

            FromComboBox.SelectedValue = "en";

后面还有 454 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。