Пример #1
0
        public MainViewModel(
            TtsDocumentFactory docFactory,
            ITtsService ttsService,
            IMyRegistryService registryService,
            IDialogService dialogService)
            : base(ttsService, registryService, dialogService)
        {
            // .... services
            this.docFactory        = docFactory;
            this.myRegistryService = registryService;

            // .... commands
            SelectionFirstClickCommand = new RelayCommand <int>(OnSelectionFirstClick);
            SelectionChangedCommand    = new RelayCommand <int>(OnSelectionChanged);
            ShowSearchPanelCommand     = new RelayCommand(() =>
            {
                SearchPanelVisible = true;
                SearchTextInFocus  = true;
            });
            HideSearchPanelCommand = new RelayCommand(() => { SearchPanelVisible = false; });

            // .... logic
            docReader = new DocumentReaderByParagraph(ttsService);
            docReader.SelectWordPlease += DocReader_WordRead;
            ProgressTickFrequency       = 10;
        }
Пример #2
0
        public MainViewModel(ITtsService ttsService)
        {
            this.ttsService = ttsService;
            //// .... this was a test
            //ttsService.AddWordCallback((textBeingRead, start, length) =>
            //{
            //    // word
            //    PrependToLog($"[{start}:{length}] {textBeingRead.Substring(start, length)}");
            //});

            //TODO: use config file maybe
            var xmlFile = @"C:\OtherMiktemk\datafiles\german-grammar\german-grammar-split.xml";

            outputLang = "de";
            CurIndex   = 900;

            allText = XmlFactory.LoadFromFile <MultiLanguageText>(xmlFile);

            PlayStopCommand = new RelayCommand(PlayStop, () => true);

            PreviewKeyDownCommand = new RelayCommand <KeyEventArgs>((args) => {
                if (args.Key == Key.Left)
                {
                    CurIndex--;
                }
                if (args.Key == Key.Right)
                {
                    CurIndex++;
                }
                if (args.Key == Key.Space)
                {
                    PlayStop();
                }
            });
        }
Пример #3
0
        public MainViewModel(ITtsService ttsService)
        {
            this.ttsService = ttsService;
            //// .... this was a test
            //ttsService.AddWordCallback((textBeingRead, start, length) =>
            //{
            //    // word
            //    PrependToLog($"[{start}:{length}] {textBeingRead.Substring(start, length)}");
            //});

            //TODO: use config file maybe
            var xmlFile = @"C:\OtherMiktemk\datafiles\german-grammar\german-grammar-split.xml";
            outputLang = "de";
            CurIndex = 900;

            allText = XmlFactory.LoadFromFile<MultiLanguageText>(xmlFile);

            PlayStopCommand = new RelayCommand(PlayStop, () => true);

            PreviewKeyDownCommand = new RelayCommand<KeyEventArgs>((args) => {
                if (args.Key == Key.Left)
                    CurIndex--;
                if (args.Key == Key.Right)
                    CurIndex++;
                if (args.Key == Key.Space)
                    PlayStop();
            });
        }
        public MainViewModel(ITtsService ttsService)
        {
            // .... set up shit
            this.ttsService = ttsService;
            ttsService.AddWordCallback(ttsService_wordCallback);

            // .... process command line args
            var args = new CommandLineArgs(Environment.GetCommandLineArgs());

            if (args.ArgumentError)
            {
                System.Windows.Application.Current.Shutdown();
                return;
            }
            if (args.ShowHelp)
            {
                args.PrintHelpStringToConsole();
                System.Windows.Application.Current.Shutdown();
                return;
            }
            if (args.Filename == null)
            {
                Console.WriteLine("Please specify filename as command line argument");
                System.Windows.Application.Current.Shutdown();
                return;
            }
            if (args.Rate != null)
            {
                ttsService.SetVoiceOverrideSpeed(args.Rate);
            }

            // .... commands
            GoNextSentence    = new RelayCommand(GoNextSentenceFn);
            RepeatCurSentence = new RelayCommand(RepeatCurSentenceFn);

            // .... load input file
            var allLines = File.ReadAllLines(args.Filename);

            sentenceEnumerator = allLines.AsEnumerable().GetEnumerator();

            CurText = "";
            curLang = args.Lang;
        }
Пример #5
0
 public TtsDocumentFactory(ITtsService ttsService)
 {
     this.ttsService = ttsService;
 }
 public DocumentReaderByParagraph(ITtsService ttsService)
 {
     this.ttsService = ttsService;
     ttsService.AddWordCallback(ttsService_Word);
     searching = new ContextualSearchState();
 }