public DictionaryWindow_ViewModel_WPF(
     ILogger Logger_, 
     INavigationService NavigationService_, 
     IDialogService DialogService_,
     IAudioAPI AudioAPI_,
     EFDbConnect EFDbConnect
     ) : base (Logger_,NavigationService_,DialogService_,AudioAPI_,EFDbConnect)
 {
 }
Example #2
0
 /// <summary>Initializes a new instance of the <see cref="OALDevice" /> class.</summary>
 /// <param name="api">The API.</param>
 /// <param name="name">Name of the device.</param>
 /// <exception cref="ArgumentNullException">
 /// API
 /// or
 /// Name.
 /// </exception>
 /// <exception cref="ArgumentException">DeviceName.</exception>
 internal OALDevice(IAudioAPI api, string name)
 {
     API  = api ?? throw new ArgumentNullException("API");
     Name = name ?? throw new ArgumentNullException("Name");
     string[] l_Devices = OAL.SafeNativeMethods.alcGetStringv(IntPtr.Zero, OAL.ALC_ALL_DEVICES_SPECIFIER);
     if (Array.IndexOf(l_Devices, name) < 0)
     {
         throw new ArgumentException(string.Format("Device Name {0} not found!", name), "DeviceName");
     }
 }
        public UnderstandingTest_ViewModel_WPF(
            ILogger Logger_,
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            IAudioAPI AudioAPI_,
            IMvxMessenger Messenger_,
            ISpeechAPI SpeechAPI_,
            ILocalization loc_) : 
            base (Logger_,NavigationService_,DialogService_,AppSetting_,AudioAPI_,Messenger_,SpeechAPI_,loc_)
        {

        }
 public PlayerWindow_ViewModel_WPF(
     ILogger logger,
     INavigationService navigationService,
     IDialogService dialogService,
     AppSetting appSetting,
     ISpeechAPI speechApi,
     IAudioAPI audioApi,
     IMvxMessenger messenger,
     ILocalization loc)
     : base(logger,navigationService,dialogService,appSetting,speechApi,audioApi,messenger,loc)
 {
     if (!IsInDesignModeNet())
     {
         player = Mvx.Resolve<IPlayer>(); 
     }
 }
        public WordsTranslation_ViewModel_WPF(
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            IAudioAPI AudioAPI_,
            IFolderService FolderService_,
            IMvxMessenger MvxMessenger_,
            ILocalization loc_
            ) : base (NavigationService_,DialogService_,AppSetting_,AudioAPI_,FolderService_,MvxMessenger_,loc_)
        {

            MaxWidth = UserModeWidth;
            MaxHeight = UserModeHeight;

            RightPanel_Properties.PropertyChanged += RightPanel_Properties_PropertyChanged;

            if (IsInDesignModeNet())
            {
                RightPanel_Properties.IsChecked = true;
            }
        }
        public UnderstandingTest_ViewModel(
            ILogger Logger_,
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            IAudioAPI AudioAPI_,
            IMvxMessenger Messenger_,
            ISpeechAPI SpeechAPI_,
            ILocalization Loc_
            )
        {
            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSetting = AppSetting_;
                AudioAPI = AudioAPI_;
                Messenger = Messenger_;
                SpeechAPI = SpeechAPI_;
                Loc = Loc_;

                Speak_Command = new MvxCommand(Speak_cmd);
                PressWordButton_Command = new MvxCommand<ButtonModel>(PressWordButton_Cmd);
            }

            ButtonsCollection = new ObservableCollection<ButtonModel>();

            if (IsInDesignMode)
            {
                string[] tarr = {
                    "Good news everyone !\nLine1\nLine2",
                    "What's happening here ?\nLine1",
                    "Hello world!" };
                for(int i = 0; i < 3; i++) ButtonsCollection.Add(new ButtonModel() {Text = tarr[i] });
                CurrentSub = new SubtitleItem() {
                    Text = "This is current subtitles item.\nLine 2\nLine3" };
            }

        }
Example #7
0
 /// <summary>Creates a new AudioDevice instance with the specified name and capabilities.</summary>
 /// <param name="api">The API.</param>
 /// <param name="name">The Name of the device.</param>
 /// <param name="capabilities">The capabilities of the device.</param>
 /// <exception cref="ArgumentNullException">
 /// API
 /// or
 /// Name.
 /// </exception>
 protected AudioDevice(IAudioAPI api, string name, IAudioDeviceCapabilities capabilities)
 {
     API          = api ?? throw new ArgumentNullException("API");
     Name         = name ?? throw new ArgumentNullException("Name");
     Capabilities = capabilities;
 }
Example #8
0
 /// <summary>Vergleicht das aktuelle Objekt mit einem anderen Objekt desselben Typs.</summary>
 /// <param name="other">Ein Objekt, das mit diesem Objekt verglichen werden soll.</param>
 /// <returns>
 /// Ein Wert, der die relative Reihenfolge der verglichenen Objekte angibt.Der Rückgabewert hat folgende Bedeutung:Wert Bedeutung Kleiner als 0 (null) Dieses Objekt ist kleiner als der <paramref name="other" />-Parameter.Zero Dieses Objekt ist gleich <paramref name="other" />. Größer als 0 (null) Dieses Objekt ist größer als <paramref name="other" />.
 /// </returns>
 public int CompareTo(IAudioAPI other) => Preference.CompareTo(other.Preference);
Example #9
0
 /// <summary>Initializes a new instance of the <see cref="PADevice" /> class.</summary>
 /// <param name="api">The API.</param>
 /// <param name="devIndex">Index of the device.</param>
 internal PADevice(IAudioAPI api, int devIndex)
     : base(api, GetName(devIndex), GetCapabilities(devIndex))
 {
     DeviceIndex = devIndex;
 }
Example #10
0
 /// <summary>Vergleicht das aktuelle Objekt mit einem anderen Objekt desselben Typs.</summary>
 /// <param name="other">Ein Objekt, das mit diesem Objekt verglichen werden soll.</param>
 /// <returns>
 /// Ein Wert, der die relative Reihenfolge der verglichenen Objekte angibt.Der Rückgabewert hat folgende Bedeutung:Wert Bedeutung Kleiner als 0 (null) Dieses Objekt ist kleiner als der <paramref name="other" />-Parameter.Zero Dieses Objekt ist gleich <paramref name="other" />. Größer als 0 (null) Dieses Objekt ist größer als <paramref name="other" />.
 /// </returns>
 public int CompareTo(IAudioAPI other)
 {
     return(Preference.CompareTo(other.Preference));
 }
        public PlayerWindow_ViewModel(
            ILogger Logger_,
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            ISpeechAPI SpeechAPI_,
            IAudioAPI AudioAPI_,
            IMvxMessenger Messenger_,
            ILocalization Loc_
            ) : base()
        {
            
             
            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSetting = AppSetting_;
                SpeechAPI = SpeechAPI_;
                AudioAPI = AudioAPI_;
                Messenger = Messenger_;
                Loc = Loc_;

                //Messenger.Default.Register<PlayerEvent>(this, Controller);
                _substoken = Messenger.Subscribe<PlayerEvent>(Controller);

                // Commands
                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);

                PressCollectWordsButton_Command = new MvxCommand<ButtonModel>(PressCollectWordsButton_Cmd);
                TranslateWord_Command = new MvxCommand<PhraseOfCollectMode.Word>(TranslateWord_Cmd);

            }
            
            

            CollectPhrases_Buttons = new ObservableCollection<ButtonModel>();
            
            if (IsInDesignMode)
            {
                
                string phr = "Cakes have layers!";
                var arr = phr.Split(' ');
                foreach(var elm in arr)
                {
                    CollectPhrases_Buttons.Add(new ButtonModel {WordOfButton = new PhraseOfCollectMode.Word { word_of_phrase = elm } });
                }
                
                CollectedPhraseText = "Everybody loves cake!";

                
                //LearningItem = new LearningItem();
                //LearningItem.Statistics = new Statistics();
                //LearningItem.MainSubs = new Subtitles();
                //LearningItem.MainSubs.Items = new SynchronizedObservableCollection<SubtitleItem>();
                
                string subs_ = @"
                    Once upon a time
                    there was a lovely princess.
                    But she had an enchantment
                    upon her of a fearful sort,
                    which could only be broken
                    by love's first kiss.
                    She was locked away in a castle
                    guarded by a terrible
                    fire-breathing dragon.
                    Many brave knights had attempted
                    to free her from this dreadful prison,
                    but none prevailed.
                    She waited in the dragon's keep
                    in the highest room of the tallest tower,
                    for her true love
                    and true love's first kiss.
                    Like that's ever gonna happen.
                    What a load of...";
                arr = subs_.Split('\n');
                foreach(var elm in arr)
                {
                    //LearningItem.MainSubs.Items.Add(new SubtitleItem { Text = elm.Trim()});
                }
                //LearningItem.CollectPhrases = true;
                
            }

        }
        public WordsTranslation_ViewModel(
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            IAudioAPI AudioAPI_,
            IFolderService FolderService_,
            IMvxMessenger MvxMessenger_,
            ILocalization Loc_
            )
        {
            
            // Design mode settings
            bool isButtonPressed = true;
            bool isPressedTrueButton = false;
            if (IsInDesignMode)
            {
                //mode = WordsTranslation_parameters.ViewMode.FoundNewWord;
                mode = WordsTranslation_parameters.ViewMode.Edit; // Subtitle editor
                //mode = WordsTranslation_parameters.ViewMode.Training; // Training mode
                //mode = WordsTranslation_parameters.ViewMode.WordTranslation; // Dictionary
                //mode = WordsTranslation_parameters.ViewMode.Training;
                //mode = WordsTranslation_parameters.ViewMode.DictionaryItem; 
            }
            
            if (!IsInDesignMode)
            {
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSetting = AppSetting_;
                AudioAPI = AudioAPI_;
                FolderService  = FolderService_;
                MvxMessenger = MvxMessenger_;
                Tx = Loc_;

                Statuses = new ObservableCollection<WordStatuses>(Enumeration.GetAll<WordStatuses>());

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
                PressWordButton_Command = new MvxCommand<ButtonModel>(PressWordButton_Cmd);
                Command_SelectLanguageService = new MvxCommand<LanguageService>(PressLanguageServiceButton_Cmd);

                PropertyChanged += WordsTranslation_ViewModel_PropertyChanged;
            }
            
            WordsForSelection_Buttons = new ObservableCollection<ButtonModel>();
            LanguageServiceCollection = new ObservableCollection<LanguageService>();
            
            btnNextButton = new ButtonModel();
            btnPreviousButton = new ButtonModel();
            btnAddToDictionary = new ButtonModel();
            btnSkip = new ButtonModel();
            WordsCollection_ListModel = new List_Model();
            btnTrainingNext = new ButtonModel();
            btnOk = new ButtonModel();
            Header_LabelModel = new Label_Model();
            Header2_LabelModel = new Label_Model();
            btnAllWordsList = new ButtonModel();
            MergeButton = new ButtonModel { IsEnabled = false };

            RightPanel_TranslationButton = new ButtonModel();
            RightPanel_Properties = new ButtonModel();
            RightPanel_AllWordsButton = new ButtonModel();

            SpeechParts = new ObservableCollection<Domain.SpeechParts>(Domain.SpeechParts.GetAll<SpeechParts>());

            if (IsInDesignMode)
            {

                //Statuses = WordOfDictionary.WordStatuses.Statuses;

                Header_LabelModel.Text = "This is a Header";
                Header2_LabelModel.Text = "second header";
                Tx = new LocalizationForDesignMode();

                CurrentWord = new WordOfDictionary();
                CurrentWord.word_of_dictionary = "White";
                CurrentWord.translation_as_string = "Белый";
                CurrentWord.transcription = "[wʌɪt]";
                CurrentWord.commentary = "Белый цвет, не черный, не зеленый, а [b]именно белый[/b]. \nСовершенно белый.\nНу может с [i]желтоватым отливом[/i]";
                CurrentWord.pictures_url = "http://d144fqpiyasmrr.cloudfront.net/uploads/picture/295623.png";
                CurrentWord.context = "of the color of milk or fresh snow, due to the reflection of most wavelengths of visible light; the opposite of black.";
                CurrentWord.SpeechPart = Domain.SpeechParts.Pronoun;
                
                CurrentWord.translations.Add(new TranslationOfWord {Translation="белый",Votes=150 });
                CurrentWord.translations.Add(new TranslationOfWord {Translation="беловатый",Votes=50 });
                CurrentWord.translations.Add(new TranslationOfWord {Translation="беленький, беловатый, бледноватный, беловатенькая, серобуромалиновенькая, ярко белая в крапинку",Votes=15 });
                
                WordsForSelection_Buttons.Add(new ButtonModel { Text="Зелёный"});
                WordsForSelection_Buttons.Add(new ButtonModel { Text="Белый"});
                WordsForSelection_Buttons.Add(new ButtonModel { Text="Черный"});
                WordsForSelection_Buttons.Add(new ButtonModel { Text="Пурпурный"});
                WordsForSelection_Buttons.Add(new ButtonModel { Text="Фиолетовый"});

                WordsCollection = new ObservableCollection<WordOfDictionary>();
                WordsCollection.Add(new WordOfDictionary {word_of_dictionary = "everybody"});
                WordsCollection.Add(new WordOfDictionary {word_of_dictionary = "likes"});
                WordsCollection.Add(new WordOfDictionary {word_of_dictionary = "cakes"});
                
                LanguageServiceCollection.Add(new LanguageService { Name = "Google translate"});
                LanguageServiceCollection.Add(new LanguageService { Name = "Yandex translate"});
                LanguageServiceCollection.Add(new LanguageService { Name = "LinguaLeo"});
                LanguageServiceCollection.Add(new LanguageService { Name = "Macmillan dictionary"});
                
                SetCurrentWord(CurrentWord);

                MergeWithStr = "I am";
                FoundedWord = new WordOfDictionary { word_of_dictionary = MergeWithStr };

                SpeechParts = new ObservableCollection<SpeechParts>
                {
                    Domain.SpeechParts.Adverb,
                    Domain.SpeechParts.Article,
                    Domain.SpeechParts.Conjuction,
                    Domain.SpeechParts.Pronoun
                };


            }

            if (IsInDesignMode)
            {
                if (mode == WordsTranslation_parameters.ViewMode.Training || mode == WordsTranslation_parameters.ViewMode.FoundNewWord)
                {
                    if (isButtonPressed)
                    {
                        PressWordButton_Cmd(new ButtonModel { IsItTrue = isPressedTrueButton});
                    }
                }

            }

            
        }
        public Dictionary_ViewModel(
            ILogger Logger_, 
            INavigationService NavigationService_, 
            IDialogService DialogService_,
            IAudioAPI AudioAPI_,
            EFDbConnect EFDbConnect_)
        {
            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                EFDbConnect = EFDbConnect_;
                AudioAPI = AudioAPI_;

                Languages = new ObservableCollection<Language>(EFDbConnect.Table<Language>().ToList());

                SpeechItem_Command = new MvxCommand<WordOfDictionary>(SpeechItem_Cmd);
                CommandDispatcher = new MvxCommand<string>(CommandDispatcher_); 
            }

            ViewModeDataGrid = VisualState.Collapsed;
            ViewModeList = VisualState.Collapsed;
            currentMode = ViewModes.List;
            SpeechPartsCollection =  new ObservableCollection<SpeechParts>(Enumeration.GetAll<SpeechParts>());
            ViewModesCollection = new ObservableCollection<ViewModes>(Enumeration.GetAll<ViewModes>());

            if (IsInDesignMode)
            {
                currentMode = ViewModes.DataGrid;

                Dictionary = new Dictionary();

                Dictionary.Words.Add(new WordOfDictionary {
                    word_of_dictionary = "Hello",
                    translation_as_string = "Привет",
                    transcription = "hello",
                    RepetitionPersent = 25,
                    SpeechPart = SpeechParts.Noun
                });

                Dictionary.Words.Add(new WordOfDictionary {
                    word_of_dictionary ="day",
                    translation_as_string = "день",
                    transcription ="day",
                    RepetitionPersent = 80,
                    SpeechPart =  SpeechParts.Noun
                });

                Dictionary.Words.Add(new WordOfDictionary {
                    word_of_dictionary ="I am",
                    translation_as_string = "я являюсь ...",
                    transcription ="...",
                    Forms = "I'm",
                    RepetitionPersent = 80,
                    SpeechPart =  SpeechParts.Noun
                });

            }

        }