private void Open( string filePath ) { Task = TranslateTask.LoadTranslateTask( filePath ); WebBrowser.Navigate( Task.Translate() ); DataView.ItemsSource = Task.Terms; }
private void Open(string filePath) { Task = TranslateTask.LoadTranslateTask(filePath); WebBrowser.Navigate(Task.Translate()); DataView.DataContext = Task; DataView.Resources["CandidateTermsConverter"].CastTo <CandidateTermsConverter>().Task = Task; TranslationProgress.Maximum = Task.Terms.Length; FilenameTextBlock.Text = filePath; TranslationProgress.Value = Task.Terms.Count(t => t.SourceTerm != t.TranslatedTerm && !string.IsNullOrWhiteSpace(t.TranslatedTerm)); }
private void Open( string filePath ) { Task = TranslateTask.LoadTranslateTask( filePath ); WebBrowser.Navigate( Task.Translate() ); DataView.DataContext = Task; DataView.Resources["CandidateTermsConverter"].CastTo<CandidateTermsConverter>().Task = Task; TranslationProgress.Maximum = Task.Terms.Length; FilenameTextBlock.Text = filePath; TranslationProgress.Value = Task.Terms.Count( t => t.SourceTerm != t.TranslatedTerm && !string.IsNullOrWhiteSpace( t.TranslatedTerm ) ); }
public static TranslateTask LoadTranslateTask(string filepath) { if (filepath == null) { throw new ArgumentNullException("filepath"); } if (!File.Exists(filepath)) { throw new InvalidOperationException("文件不存在"); } var document = new JumonyParser().LoadDocument(File.OpenText(filepath), new Uri(filepath)); var task = new TranslateTask(document); task.Initialize(); return(task); }
public static TranslateTask LoadTranslateTask( string filepath ) { if ( filepath == null ) throw new ArgumentNullException( "filepath" ); if ( !File.Exists( filepath ) ) throw new InvalidOperationException( "文件不存在" ); var document = new JumonyParser().LoadDocument( File.OpenText( filepath ), new Uri( filepath ) ); var task = new TranslateTask( document ); task.Initialize(); return task; }
private void Open(string filePath) { Task = TranslateTask.LoadTranslateTask(filePath); WebBrowser.Navigate(Task.Translate()); DataView.ItemsSource = Task.Terms; }