public Login_ViewModel(
            ILogger Logger_,
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSettings_
            )
        {
            Logger = Logger_;
            NavigationService = NavigationService_;
            DialogService = DialogService_;
            AppSettings = AppSettings_;

            if (!IsInDesignMode)
            {
                Login_Command = new MvxCommand(Login_cmd);
            }
            

            if (IsInDesignMode)
            {

            }


        }
 public Download_ViewModel_WPF(
     INavigationService NavigationService_,
     IDialogServiceExtended IDialogServiceExtended_,
     AppSetting AppSetting_,
     IStore Store_,
     ILocalization loc_,
     ILogger logger_,
     IWebAPI_Authorization MainWebAPI_
     ) : base (NavigationService_,IDialogServiceExtended_,AppSetting_,Store_,loc_,logger_)
 {
  }
        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 EditLearningItem_ViewModel_WPF(
            IDialogServiceExtended DialogService_, 
            IPlayer Player_,
            INavigationService NavigationService_,
            AppSetting AppSetting_,
            EFDbConnect EFDbConnect_)
        {
            
            if (!IsInDesignModeNet())
            {
                DialogService = DialogService_;
                Player = Player_;
                NavigationService = NavigationService_;
                AppSetting = AppSetting_;
                EFDbConnect = EFDbConnect_;

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

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

            }

            PlayerVisibility = Visibility.Visible;
            DownloadVideoButton = new ButtonModel();

            if (IsInDesignModeNet())
            {
                LearningItem = new LearningItem();
                LearningItem.Name = "Mazzy in Gondoland";
                
                LearningItem.VideoFileName = "C:\\Users\\Public\\Videos\\Sample Videos\\Mazzy.mkv";

                LearningItem.SubtitleCollection = new SynchronizedObservableCollection<Subtitles>();

                LearningItem.SubtitleCollection.Add(new Subtitles           {
                    Name = "English-Russian"
                });

                LearningItem.SubtitleCollection.Add(new Subtitles
                {
                    Name = "English-Ukraine"
                });

                //CurrentSubtitles = LearningItem.SubtitleCollection[0];
                
            }

           
        }
Exemple #5
0
        public Publish(
            AppSetting AppSetting_,
            IWebAPI_LearningItems WebAPI_LearningItems_,
            IWebAPI_Authorization WebAPI_Authorization_,
            IDBBulkOperations DBBulkOperations_
            )
        {
            AppSetting = AppSetting_;

            WebAPI_LearningItems = WebAPI_LearningItems_;
            WebAPI_LearningItems.Initialization(StaticProperties.StoreApiAdress, AppSetting.id.guid);
            WebAPI_Authorization = WebAPI_Authorization_;
            DBBulkOperations = DBBulkOperations_;

        }
Exemple #6
0
 public Store(
     IDBBulkOperations DBBulkOperations_,
     IDialogService DialogService_,
     AppSetting AppSetting_,
     IWebAPI_LearningItems WebAPI_LearningItems_,
     IWebAPI_Authorization WebAPI_Authorization_
 )
 {
         DBBulkOperations = DBBulkOperations_;
         DialogService = DialogService_;
         AppSetting = AppSetting_;
         WebAPI_LearningItems = WebAPI_LearningItems_;
         WebAPI_LearningItems.Initialization(StaticProperties.StoreApiAdress, AppSetting.id.guid);
         WebAPI_Authorization = WebAPI_Authorization_;
 }
        public InitialWizard_ViewModel_WPF(
            ILogger Logger_, 
            INavigationService NavigationService_, 
            IDialogServiceExtended DialogService_,
            AppSetting AppSettings_,
            EFDbConnect EFDbConnect_,
            ObservableCollection<Language> languages_
            ) : base ()
        {

            PanelCount = 1;

            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSettings = AppSettings_;
                EFDbConnect = EFDbConnect_;
                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);

                //List<Language> lst = EFDbConnect.Table<Language>().ToList();
                //Languages = new ObservableCollection<Language>(lst);
                Languages = languages_;

                // Default values
                TargetLanguage = Languages.FirstOrDefault(x=>x.Code == "en");
                NativeLanguage = Languages.FirstOrDefault(x=>x.Code == System.Globalization.CultureInfo.CurrentCulture.IetfLanguageTag.Substring(0,2).ToLower());

                LearningWordStrategy strat = EFDbContext.Context.FirstOrDefault<LearningWordStrategy>();
                AppSettings.LearningWordStrategy = strat;

            }

            Drives = FileService.GetFixedDrivesList();
            if (Drives.Count > 0)
            {
                DriveForData = Drives.OrderByDescending(x => x.AvailableFreeSpace).FirstOrDefault();
            }

            if (IsInDesignMode)
            {
                SelectedIndex = 2;
                UpdateButtonState();
            }


        }
 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 MainWindow_ViewModel(
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            IStore Store_,
            ILocalization Loc_,
            ILogger logger_) : base()
        {

            if (!IsInDesignMode)
            {
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSettings = AppSetting_;
                Store = Store_;
                Tx = Loc_;
                logger = logger_;

               
                //OpenCommand = new MvxCommand<LearningItem>(Open);
                DeleteCommand = new MvxCommand<LearningItem>(Delete);
                //EditCommand = new MvxCommand<LearningItem>(Edit);
                OpenDictionary_Command = new MvxCommand(OpenDictionary_Cmd);
                OpenAppSetting_Command = new MvxCommand(OpenAppSetting_Cmd);
                Training_Command = new MvxCommand(Training_Cmd);

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
            }
            
            if (IsInDesignMode)
            {
                AppSettings = new AppSetting();

                AppSettings.LearningItems.Add(
                    new LearningItem {Name = "Mazzy in Gondoland" }
                    ); 
                AppSettings.LearningItems.Add(
                    new LearningItem {Name = "Lego movies" }
                    ); 
                AppSettings.LearningItems.Add(
                    new LearningItem {Name = "Futurama" }
                    );

            }
            

        }
        public Download_ViewModel(
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            IStore Store_,
            ILocalization Loc_,
            ILogger logger_) : base()
        {

            if (!IsInDesignMode)
            {
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSettings = AppSetting_;
                Store = Store_;
                Tx = Loc_;
                logger = logger_;

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
                Command_DownloadStoreItem = new MvxCommand<StoreItemExt>((x)=>CmdDispatcher_StoreItem(x,"Download"));
            }
            
            StoreItems = new SynchronizedObservableCollection<StoreItemExt>();
            
            if (IsInDesignMode)
            {

                StoreItemExt item;

                item = new StoreItemExt { Name = "South Park" };
                item.DownloadButton.State1 = true;
                StoreItems.Add(item);

                item = new StoreItemExt { Name = "Chuggington" };
                item.DownloadButton.State2 = true;
                StoreItems.Add(item);

                item = new StoreItemExt { Name = "Futurama" };
                item.DownloadButton.State3 = true;
                StoreItems.Add(item);

            }
            

        }
 public MainWindow_ViewModel_WPF(
     INavigationService NavigationService_,
     IDialogServiceExtended IDialogServiceExtended_,
     AppSetting AppSetting_,
     IStore Store_,
     ILocalization loc_,
     ILogger logger_,
     IWebAPI_Authorization MainWebAPI_
     ) : base (NavigationService_,IDialogServiceExtended_,AppSetting_,Store_,loc_,logger_)
 {
     
     IDialogServiceExtended = IDialogServiceExtended_;
     MainWebAPI = MainWebAPI_;
     
     if(!IsInDesignModeNet())
     {
         AddCommand = new MvxCommand(Add);
         CommandDispatecherWPF = new MvxCommand<string>(CmdDispatcherWPF);
     }
  }
        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" };
            }

        }
        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});
                    }
                }

            }

            
        }