Exemple #1
0
        public TranslateWindow()
        {
            InitializeComponent();

            _isShowSource = true;
            _isLocked     = false;

            _gameTextHistory = new Queue <string>();

            this.Topmost = true;
            UI_Init();
            IsOCRingFlag = false;


            _wordSpliter = WordSpliterAuto(Common.appSettings.WordSpliter);

            _textSpeechHelper = new TextSpeechHelper();
            if (Common.appSettings.ttsVoice == "")
            {
                Growl.InfoGlobal(Application.Current.Resources["TranslateWin_NoTTS_Hint"].ToString());
            }
            else
            {
                _textSpeechHelper.SetTTSVoice(Common.appSettings.ttsVoice);
                _textSpeechHelper.SetVolume(Common.appSettings.ttsVolume);
                _textSpeechHelper.SetRate(Common.appSettings.ttsRate);
            }

            if (Common.appSettings.xxgPath != string.Empty)
            {
                _dict = new XxgJpzhDict();
                _dict.DictInit(Common.appSettings.xxgPath, string.Empty);
            }

            IsPauseFlag  = true;
            _translator1 = TranslatorAuto(Common.appSettings.FirstTranslator);
            _translator2 = TranslatorAuto(Common.appSettings.SecondTranslator);

            _beforeTransHandle = new BeforeTransHandle(Convert.ToString(Common.GameID), Common.UsingSrcLang, Common.UsingDstLang);
            _afterTransHandle  = new AfterTransHandle(_beforeTransHandle);

            _artificialTransHelper = new ArtificialTransHelper(Convert.ToString(Common.GameID));

            if (Common.transMode == 1)
            {
                Common.textHooker.Sevent += DataRecvEventHandler;
            }
            else if (Common.transMode == 2)
            {
                MouseKeyboardHook_Init();
            }

            toggleRec.ToolTip = Common.appSettings.ATon ? REC_OFF: REC_ON;
            updateToggleRecDisplay(false);
        }
Exemple #2
0
        private void ConfirmBtn_Click(object sender, RoutedEventArgs e)
        {
            ArtificialTransHelper ath = new ArtificialTransHelper(Convert.ToString(Common.GameID));

            bool res = ath.UpdateTrans(srcText.Text, transText.Text);

            if (res)
            {
                HandyControl.Controls.Growl.InfoGlobal(Application.Current.Resources["ArtificialTransWin_Success_Hint"].ToString());
            }
            else
            {
                HandyControl.Controls.Growl.ErrorGlobal(Application.Current.Resources["ArtificialTransWin_Error_Hint"].ToString());
            }
        }