Example #1
0
        public MainWindow()
        {
            _typingTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(800)
            };
            _typingTimer.Tick += new EventHandler(HandleTypingTimerTimeoutAsync !);

            InitializeComponent();

            // 读取配置文件,设置位置、大小、主题颜色和语言模式
            try
            {
                Rect restoreBounds = Properties.Settings.Default.MainWindowsRect;
                Left   = restoreBounds.Left;
                Top    = restoreBounds.Top;
                Width  = restoreBounds.Width;
                Height = restoreBounds.Height;

                ThemeColor = Properties.Settings.Default.ThemeColor;
                LangModel  = Properties.Settings.Default.LangModel;
            }
            catch
            {
                Width  = WindowDefaultWidth;
                Height = WindowDefaultHeight;
                WindowStartupLocation = WindowStartupLocation.CenterScreen;

                ThemeColor = ThemeColors.Black;
                LangModel  = LangModels.ZhEn;
            }

            if (_translationService == null)
            {
                _translationService = new GoogleEnglishTranslationService();
            }

            _noteService = new CsvFileNoteService();
        }
Example #2
0
 /// <summary>
 /// 右键菜单
 /// 中文←→日本語
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MenuLangModelZhJp_Click(object sender, RoutedEventArgs e)
 {
     LangModel = LangModels.ZhJp;
 }