public LeftSideViewModel(ITesseractOrc orc) { _tesseractOrc = orc; OpenImageCommand = new RelayCommand(OpenImages); OpenPdfCommand = new RelayCommand(OpenPdf); BeginOcrCommand = new RelayCommand(BeginOcr); NextImageCommand = new RelayCommand(NextImage); PrevImageCommand = new RelayCommand(PrevImage); ExitCommand = new RelayCommand(Exit); OpenWebSiteCommand = new RelayCommand(OpenWebSite); AboutCommand = new RelayCommand(About); InstallLanguageCommand = new RelayCommand(InstallLanguage); OpenLanguageFolderCommand = new RelayCommand(OpenLanguageFolder); ImagesList = new List<ImageClass>(); CurrentImage = new ImageClass { Image = new BitmapImage(new Uri(@"pack://application:,,,/(a9t9)OcrDesktop;component/introtext.jpg", UriKind.Absolute)), FilePath = "introtext.jpg"//otherwise image not found, also: file has to be in same folder as EXE }; ImagesList.Add(CurrentImage); }
public MainWindowViewModel(Window windowForLanguageSupport, LeftSideViewModel leftSideViewModel,RightSideViewModel rightSideViewModel) { _windowForLanguageSupport = windowForLanguageSupport; _rightSideViewModel = rightSideViewModel; leftSideViewModel.RecoginedEvent += _leftSideViewModel_RecoginedEvent; _rightSideViewModel.LanguageEvent += _rightSideViewModel_LanguageEvent; leftSideViewModel.ExitEvent += LeftSideViewModelOnExitEvent; ChangeLanguage(); //var cultures = CultureInfo.GetCultures(CultureTypes.AllCultures); //var culturesName = cultures.Select(cultureInfo => cultureInfo.ThreeLetterWindowsLanguageName).ToList(); //var uniqueCultures = culturesName.Distinct().ToArray(); var filesName = new List<string>(); var path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\(a9t9)OcrDesktop\tessdata"; if (Directory.Exists(path)) { string[] filePaths = Directory.GetFiles(path, @"*.traineddata"); filesName.AddRange(filePaths.Select(f => new FileInfo(f)).Select(fi => fi.Name.Split('.')[0])); _rightSideViewModel.OcrLanguages = new ObservableCollection<string>(filesName); } else _rightSideViewModel.OcrLanguages = new ObservableCollection<string>(new List<string>()); _rightSideViewModel.CurrentOcrLanguage = "eng"; CloseWindowCommand = new RelayCommand(CloseWindow); MaximizeWindowCommand = new RelayCommand(MaximizeWindow); MinimizeWindowCommand = new RelayCommand(MinimizeWindow); }
public RightSideViewModel(ITesseractOrc tesseractOrc) { _tesseractOrc = tesseractOrc; SaveTextCommand = new RelayCommand(SaveText); SaveTextWordCommand = new RelayCommand(SaveTextWord); ChangeLanguageCommand = new RelayCommand(ChangeLanguage); RecognizedText = PushBeginOcr; }